Bug 1218311 - Port the fix of bug 1193614 to VideoSink. r=cpearce. f=dglastonbury.

This commit is contained in:
JW Wang 2015-11-03 11:36:24 +08:00
Родитель 9ede18e7fe
Коммит 18d1d4fd3d
2 изменённых файлов: 9 добавлений и 16 удалений

Просмотреть файл

@ -890,19 +890,6 @@ MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample)
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,

Просмотреть файл

@ -221,9 +221,15 @@ void
VideoSink::OnVideoQueueEvent()
{
AssertOwnerThread();
// Listen to push event, VideoSink should try rendering ASAP if first frame
// arrives but update scheduler is not triggered yet.
TryUpdateRenderedVideoFrames();
// 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();
}
}
void