Estimate Ogg buffered ranges on B2G

RESOLVED FIXED in mozilla18

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: cpearce, Assigned: cpearce)

Tracking

unspecified
mozilla18
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

On B2G we can't do I/O on the main thread, but the Ogg buffered implementation does just that.

So as suggested by Matthew in bug 785909 comment 8, we can reuse the buffered ranges estimation code from nsMediaPluginReader on B2G to avoid main thread I/O.

Ideally we'd rewrite the nsOggReader to parse incoming pages in NotifyDataArrived, similar to how nsWebMReader does things (bug 737745), but that's a bigger piece of work. Whereas estimating based on offset/length is less accurate, but it's quick and easy to implement.

An alternative would be to use the OMX decoder on B2G for Ogg decoding, but we don't know whether that's been fuzzed.
Posted patch Patch v1Splinter Review
Tests pass locally with buffered estimation forced on.
Attachment #656751 - Flags: review?(kinetik)
Comment on attachment 656751 [details] [diff] [review]
Patch v1

Review of attachment 656751 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/media/VideoUtils.cpp
@@ +41,5 @@
>    }
>  }
> +
> +static uint64_t BytesToTime(int64_t offset, uint64_t length, uint64_t durationUs) {
> +  double perc = double(offset) / double(length);

Rename this to r or ratio, or at least percent.  Also, assert that offset is >= 0, and maybe handle length being zero (not sure if this can happen, but the caller only checks for -1).
Attachment #656751 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/mozilla-central/rev/476d122c82a6
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.