Closed
Bug 1421179
Opened 7 years ago
Closed 7 years ago
Improve the accuracy of ChannelMediaDecoder::mPlaybackStatistics
Categories
(Core :: Audio/Video: Playback, enhancement, P3)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: jwwang, Assigned: jwwang)
References
Details
Attachments
(3 files)
My tests (playing dom/media/test/gizmo.webm) show that the WEMB demuxer needs to read bytes near the end of the stream when decoding metadata. This is bad for ChannelMediaDecoder::NotifyBytesConsumed() which makes an assumption that mDecoderPosition should progress steadily without jumping back and forth which is exactly what happens during seek and is avoided by the mIgnoreProgressData flag. We should start playback statistics only after loading metadata so we can get more accurate and stable statistics. https://searchfox.org/mozilla-central/rev/7a8c667bdd2a4a32746c9862356e199627c0896d/dom/media/ChannelMediaDecoder.cpp#315-329
Updated•7 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•7 years ago
|
||
https://searchfox.org/mozilla-central/rev/be78e6ea9b10b1f5b2b3b013f01d86e1062abb2b/dom/media/ChannelMediaDecoder.cpp#312,324 NotifyBytesConsumed() is called when data is consumed by the decoder. Therefore mPlaybackStatistics estimates the data rate consumed by the decoder instead of the player. Usually, the 2 rates won't differ too much for we throttle the decoder so it won't get ahead of the player too much. However, for small files, the difference might be noticeable since the decoder might be able to decode all frames even before playback starts. Ideally, we should count the data rate of the player instead of the decoder and pass it to BaseMediaResource::SetPlaybackRate() so the MediaCache can make better decisions on data eviction algorithm.
Assignee: nobody → jwwang
Blocks: 1369263
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Updated•7 years ago
|
Attachment #8933561 -
Flags: review?(bechen)
Attachment #8933562 -
Flags: review?(bechen)
Attachment #8933563 -
Flags: review?(bechen)
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8933561 [details] Bug 1421179. P1 - associate data with playback events published by MDSM. https://reviewboard.mozilla.org/r/204498/#review210056
Attachment #8933561 -
Flags: review?(bechen) → review+
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8933562 [details] Bug 1421179. P2 - mPlaybackStatistics should accumulate bytes as playback position progresses. https://reviewboard.mozilla.org/r/204500/#review210060 ::: dom/media/MediaDecoderStateMachine.cpp:3321 (Diff revision 1) > &MediaDecoderStateMachine::OnMediaSinkVideoComplete, > &MediaDecoderStateMachine::OnMediaSinkVideoError) > ->Track(mMediaSinkVideoPromise); > } > } > + if (!isStarted) { There is also a 'if (!isStarted)' at line 3299. How about early return 'if (isStarted)'?
Attachment #8933562 -
Flags: review?(bechen) → review+
Comment 7•7 years ago
|
||
mozreview-review |
Comment on attachment 8933563 [details] Bug 1421179. P3 - ComputePlaybackRate() should call mPlaybackStatistics.GetRate() instead of mPlaybackStatistics.GetRateAtLastStop(). https://reviewboard.mozilla.org/r/204502/#review210062 ::: dom/media/ChannelMediaDecoder.cpp:414 (Diff revision 1) > mPlaybackBytesPerSecond = length / mDuration; > return; > } > > bool reliable = false; > - mPlaybackBytesPerSecond = mPlaybackStatistics.GetRateAtLastStop(&reliable); > + mPlaybackBytesPerSecond = mPlaybackStatistics.GetRate(&reliable); Should we remove the GetRateAtLastStop() function entirely?
Attachment #8933563 -
Flags: review?(bechen) → review+
Assignee | ||
Comment 8•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8933562 [details] Bug 1421179. P2 - mPlaybackStatistics should accumulate bytes as playback position progresses. https://reviewboard.mozilla.org/r/204500/#review210060 > There is also a 'if (!isStarted)' at line 3299. > How about early return 'if (isStarted)'? Somehow, I should combine 2 if blocks.
Assignee | ||
Comment 9•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8933563 [details] Bug 1421179. P3 - ComputePlaybackRate() should call mPlaybackStatistics.GetRate() instead of mPlaybackStatistics.GetRateAtLastStop(). https://reviewboard.mozilla.org/r/204502/#review210062 > Should we remove the GetRateAtLastStop() function entirely? Let's discuss it in another bug.
Assignee | ||
Updated•7 years ago
|
Attachment #8933561 -
Flags: review?(gsquelart)
Attachment #8933562 -
Flags: review?(gsquelart)
Attachment #8933563 -
Flags: review?(gsquelart)
Comment 10•7 years ago
|
||
mozreview-review |
Comment on attachment 8933561 [details] Bug 1421179. P1 - associate data with playback events published by MDSM. https://reviewboard.mozilla.org/r/204498/#review210096
Attachment #8933561 -
Flags: review?(gsquelart) → review+
Comment 11•7 years ago
|
||
mozreview-review |
Comment on attachment 8933562 [details] Bug 1421179. P2 - mPlaybackStatistics should accumulate bytes as playback position progresses. https://reviewboard.mozilla.org/r/204500/#review210106
Attachment #8933562 -
Flags: review?(gsquelart) → review+
Comment 12•7 years ago
|
||
mozreview-review |
Comment on attachment 8933563 [details] Bug 1421179. P3 - ComputePlaybackRate() should call mPlaybackStatistics.GetRate() instead of mPlaybackStatistics.GetRateAtLastStop(). https://reviewboard.mozilla.org/r/204502/#review210108 ::: commit-message-77d8a:4 (Diff revision 1) > +Bug 1421179. P3 - ComputePlaybackRate() should call mPlaybackStatistics.GetRate() instead of mPlaybackStatistics.GetRateAtLastStop(). > + > +Otherwise mPlaybackBytesPerSecond will always be zero before playback is > +stopped for the 1st time. This is important for a live stream where playabck 'playabck' -> 'playback'
Attachment #8933563 -
Flags: review?(gsquelart) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 15•7 years ago
|
||
Thanks for the reviews!
Comment 16•7 years ago
|
||
Pushed by jwwang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d6b0da49aaf7 P1 - associate data with playback events published by MDSM. r=bechen,gerald https://hg.mozilla.org/integration/autoland/rev/43a77e985bfe P2 - mPlaybackStatistics should accumulate bytes as playback position progresses. r=bechen,gerald https://hg.mozilla.org/integration/autoland/rev/0132d8fe0d55 P3 - ComputePlaybackRate() should call mPlaybackStatistics.GetRate() instead of mPlaybackStatistics.GetRateAtLastStop(). r=bechen,gerald
Comment 17•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d6b0da49aaf7 https://hg.mozilla.org/mozilla-central/rev/43a77e985bfe https://hg.mozilla.org/mozilla-central/rev/0132d8fe0d55
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in
before you can comment on or make changes to this bug.
Description
•