Closed
Bug 1112445
Opened 10 years ago
Closed 10 years ago
Bypass skipToKeyframe logic in MediaDecoderStateMachine when we have a fully async decoder
Categories
(Core :: Audio/Video, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: mattwoodrow, Assigned: cpearce)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
mattwoodrow
:
review+
Sylvestre
:
approval-mozilla-aurora+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
This code exists to stop video decoding from blocking audio, but this shouldn't be an issue with a fully async decoder.
Chris, do you think we want to remove it entirely, or just make it much more lenient?
Reporter | ||
Comment 1•10 years ago
|
||
Attachment #8537601 -
Flags: review?(cpearce)
Assignee | ||
Comment 2•10 years ago
|
||
Comment on attachment 8537601 [details] [diff] [review]
Avoid skipToKeyframe for async decoders
Review of attachment 8537601 [details] [diff] [review]:
-----------------------------------------------------------------
We can't bypass skip-to-next-keyframe entirely, as that broke A/V sync when I tested on low end hardware; the video decode never caught up once it fell behind.
I think we should instead make it more lenient when the reader is async.
Would ignoring the audio when calculating whether we should enter skip-to-next-keyframe for async readers work, i.e.:
if (mState == DECODER_STATE_DECODING &&
IsVideoDecoding() &&
((!mReader->IsAsync() && mIsAudioPrerolling && IsAudioDecoding() &&
GetDecodedAudioDuration() < mLowAudioThresholdUsecs * mPlaybackRate) ||
(!mIsVideoPrerolling && IsVideoDecoding() &&
// don't skip frame when |clock time| <= |mVideoFrameEndTime| for
// we are still in the safe range without underrunning video frames
GetClock() > mVideoFrameEndTime &&
(static_cast<uint32_t>(VideoQueue().GetSize())
< LOW_VIDEO_FRAMES * mPlaybackRate))) &&
!HasLowUndecodedData())
That may not work. We may need to come up with something else.
Why is the skip-to-next-keyframe logic triggering with MSE? Is the amount of buffered or decoded data running low when you switch decoders?
Attachment #8537601 -
Flags: review?(cpearce) → review-
Updated•10 years ago
|
Reporter | ||
Comment 3•10 years ago
|
||
Unfortunately I can't reproduce this happening any more, so I'm not sure. We're certainly not running out of decoded frames now, but that might not have been the case when I saw this previously.
Updated•10 years ago
|
Priority: -- → P1
Assignee | ||
Comment 4•10 years ago
|
||
I seemed to hit this on YouTube when I switched from 720p to 1080p on some GoPro Hero videos.
Assignee | ||
Comment 5•10 years ago
|
||
It might be worth testing the patch in Bug 1091992 to see if that makes things better here.
That patch checks how far ahead of the current playback position we've decoded the video, rather than just assuming that when the video queue is empty that we should skip. We could try making that video skip test more lenient too.
Comment 7•10 years ago
|
||
Removing from beta blockers because it is not caused by MSE and therefore would still occur in regular video elements on YouTube.
No longer blocks: ytb37
Assignee | ||
Updated•10 years ago
|
Assignee: matt.woodrow → cpearce
Assignee | ||
Comment 8•10 years ago
|
||
Don't consider audio when we determine whether we should skip-to-next-keyframe when we're using an async reader. Also don't increase the low audio threshold; since for async readers the video and audio decode happens on different task queues, there's nothing to be gained by increasing the threshold when we do engage skip-to-next-keyframe.
Attachment #8537601 -
Attachment is obsolete: true
Attachment #8548006 -
Flags: review?(matt.woodrow)
Reporter | ||
Comment 9•10 years ago
|
||
Comment on attachment 8548006 [details] [diff] [review]
Patch: don't consider audio in NeedToSkipToNextKeyframe() for async readers
Review of attachment 8548006 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/media/mediasource/MediaSourceReader.h
@@ +130,5 @@
> #endif
>
> + virtual bool IsAsync() const MOZ_OVERRIDE {
> + return (!mAudioReader || mAudioReader->IsAsync()) &&
> + (!mVideoReader || mVideoReader->IsAsync());
I'm pretty sure we require that the readers are of the same type, so you could probably just assert that they return matching results instead of checking both.
Attachment #8548006 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 10•10 years ago
|
||
Comment on attachment 8548006 [details] [diff] [review]
Patch: don't consider audio in NeedToSkipToNextKeyframe() for async readers
Review of attachment 8548006 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/media/mediasource/MediaSourceReader.h
@@ +130,5 @@
> #endif
>
> + virtual bool IsAsync() const MOZ_OVERRIDE {
> + return (!mAudioReader || mAudioReader->IsAsync()) &&
> + (!mVideoReader || mVideoReader->IsAsync());
Once WebM MSE is enabled, couldn't a vorbis sourcebuffer be peered with an h264 sourcebuffer, and since the WebMReader is stil synchronous, we'd then be mixing async and sync modes?
Assignee | ||
Comment 11•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Comment 13•10 years ago
|
||
Comment on attachment 8548006 [details] [diff] [review]
Patch: don't consider audio in NeedToSkipToNextKeyframe() for async readers
Approval Request Comment
[Feature/regressing bug #]: MSE
[User impact if declined]: Some videos stutter or freeze during playback. [Describe test coverage new/current, TBPL]: Landed on m-c.
[Risks and why]: This changes how we manage playback resources for all video playback, but is a straightforward change and isolated change. I'd say risk is low.
[String/UUID change made/needed]: None.
Attachment #8548006 -
Flags: approval-mozilla-beta?
Attachment #8548006 -
Flags: approval-mozilla-aurora?
Updated•10 years ago
|
Updated•10 years ago
|
Attachment #8548006 -
Flags: approval-mozilla-beta?
Attachment #8548006 -
Flags: approval-mozilla-beta+
Attachment #8548006 -
Flags: approval-mozilla-aurora?
Attachment #8548006 -
Flags: approval-mozilla-aurora+
Comment 14•10 years ago
|
||
Updated•10 years ago
|
Comment 15•10 years ago
|
||
status-b2g-v2.2:
--- → fixed
status-b2g-master:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•