author | Carsten "Tomcat" Book <cbook@mozilla.com> |
Tue, 03 Nov 2015 12:28:05 +0100 | |
changeset 271006 | d84d28b5c9be |
parent 271005 | d2aaa8d2568d |
child 271007 | 5bd197b129a8 |
push id | 29631 |
push user | cbook@mozilla.com |
push date | 2015-11-04 11:00 +0000 |
treeherder | mozilla-central@6077f51254c6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1218311 |
milestone | 45.0a1 |
backs out | 9ce253c10b9a |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/media/MediaDecoderStateMachine.cpp | file | annotate | diff | comparison | revisions | |
dom/media/mediasink/VideoSink.cpp | file | annotate | diff | comparison | revisions |
--- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -885,16 +885,29 @@ MediaDecoderStateMachine::OnVideoDecoded Push(video, MediaData::VIDEO_DATA); if (MaybeFinishDecodeFirstFrame()) { return; } if (mIsVideoPrerolling && DonePrerollingVideo()) { StopPrerollingVideo(); } + // Schedule the state machine to send stream data as soon as possible if + // the VideoQueue() is empty or contains one frame before the Push(). + // + // The state machine threads requires a frame in VideoQueue() that is `in + // the future` to gather precise timing information. The head of + // VideoQueue() is always `in the past`. + // + // Schedule the state machine as soon as possible to render the video + // frame or delay the state machine thread accurately. + if (VideoQueue().GetSize() <= 2) { + ScheduleStateMachine(); + } + // For non async readers, if the requested video sample was slow to // arrive, increase the amount of audio we buffer to ensure that we // don't run out of audio. This is unnecessary for async readers, // since they decode audio and video on different threads so they // are unlikely to run out of decoded audio. if (mReader->IsAsync()) { return; }
--- a/dom/media/mediasink/VideoSink.cpp +++ b/dom/media/mediasink/VideoSink.cpp @@ -216,25 +216,19 @@ VideoSink::Shutdown() mAudioSink->Shutdown(); } void VideoSink::OnVideoQueueEvent() { AssertOwnerThread(); - - // The video queue is empty or contains only one frame before Push() which - // means we are slow in video decoding and don't have enough information to - // schedule next render loop accurately (default timeout is 40ms). We need - // to render incoming frames immediately so render loop can be scheduled - // again accurately. - if (mAudioSink->IsPlaying() && VideoQueue().GetSize() <= 2) { - UpdateRenderedVideoFrames(); - } + // Listen to push event, VideoSink should try rendering ASAP if first frame + // arrives but update scheduler is not triggered yet. + TryUpdateRenderedVideoFrames(); } void VideoSink::Redraw() { AssertOwnerThread(); RenderVideoFrames(1); }