Closed
Bug 915957
Opened 11 years ago
Closed 11 years ago
Call MediaDecoder::NotifyBytesConsumed() from MediaResource::Read functions
Categories
(Core :: Audio/Video, defect)
Core
Audio/Video
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: cpearce, Assigned: cpearce)
Details
Attachments
(1 file, 1 obsolete file)
26.69 KB,
patch
|
kinetik
:
review+
|
Details | Diff | Splinter Review |
In every MediaDecoderReader backend we have to remember to call MediaDecoder::NotifyBytesConsumed() after every call to MediaResource::Read(). This is silly, we can just have MediaResource::Read() and friends call this for us, then we wouldn't forget to call this in the readers. We also forgot to call NotifyBytesConsumed() in our B2G and Android backends, we won't need to worry about that now. Green with attached patch: https://tbpl.mozilla.org/?tree=Try&rev=e9df2df1e3e6
Attachment #804156 -
Flags: review?(kinetik)
Comment 1•11 years ago
|
||
Comment on attachment 804156 [details] [diff] [review] Patch: Call MediaDecoder::NotifyBytesConsumed from MediaResource::Read functions Review of attachment 804156 [details] [diff] [review]: ----------------------------------------------------------------- r+ with the ReadAt issue resolved. ::: content/media/MediaResource.cpp @@ +818,5 @@ > NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread"); > > + nsresult rv = mCacheStream.ReadAt(aOffset, aBuffer, aCount, aBytes); > + if (NS_SUCCEEDED(rv)) { > + DispatchBytesConsumed(*aBytes); I don't think we can do this for ReadAt because of the explicit offset parameter unless you save the highest reported offset and only report reads that extend that value. If the caller did ReadAt(0, ..., 1024, ...) three times, we'd report 3072 bytes consumed despite logically having consumed only 1024 from the stream.
Attachment #804156 -
Flags: review?(kinetik) → review+
Assignee | ||
Comment 2•11 years ago
|
||
(In reply to Matthew Gregan [:kinetik] from comment #1) > I don't think we can do this for ReadAt because of the explicit offset > parameter unless you save the highest reported offset and only report reads > that extend that value. If the caller did ReadAt(0, ..., 1024, ...) three > times, we'd report 3072 bytes consumed despite logically having consumed > only 1024 from the stream. Hmm, but then if we seeked to the end of stream, say to get an index, then we'd stop reporting any reads. How about: 1. We have MediaDecoder::NotifyBytesConsumed() ignore the notification if mIgnoreProgressData==false (so we don't send notifications when we're reading metadata and seeking, which is when we don't have a valid mDecoderPosition field). 2. We add an offset parameter to MediaDecoder::NotifyBytesConsumed(), to denote the start offset where the data was read. MediaDecoder::NotifyBytesConsumed() can then keep track of whether the read appends to mDecoderPosition and ignores the notification for offsets < mDecoderPosition. For offsets >= mDecoderPosition, we set mDecoderPosition to offset+aBytesConsumed (the end of the range read).
Comment 3•11 years ago
|
||
Sounds good.
Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Chris Pearce (:cpearce) from comment #2) > (In reply to Matthew Gregan [:kinetik] from comment #1) > > I don't think we can do this for ReadAt because of the explicit offset > > parameter unless you save the highest reported offset and only report reads > > that extend that value. If the caller did ReadAt(0, ..., 1024, ...) three > > times, we'd report 3072 bytes consumed despite logically having consumed > > only 1024 from the stream. > > Hmm, but then if we seeked to the end of stream, say to get an index, then > we'd stop reporting any reads. > > How about: > 1. We have MediaDecoder::NotifyBytesConsumed() ignore the notification if > mIgnoreProgressData==false (so we don't send notifications when we're > reading metadata and seeking, which is when we don't have a valid > mDecoderPosition field). Urgh, I mean ignore the notification if mIgnoreProgressData == *true* of course.
Assignee | ||
Comment 5•11 years ago
|
||
With the above discussed changes.
Attachment #804156 -
Attachment is obsolete: true
Attachment #806342 -
Flags: review?(kinetik)
Updated•11 years ago
|
Attachment #806342 -
Flags: review?(kinetik) → review+
Assignee | ||
Comment 6•11 years ago
|
||
Greenish on try: https://tbpl.mozilla.org/?tree=Try&rev=d8f596e0a52d
Assignee | ||
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/10065efeed2f
Comment 8•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/10065efeed2f
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in
before you can comment on or make changes to this bug.
Description
•