Bug 1193614 - Schedule State Machine when VideoQueue() is low. r=cpearce

If UpdateRenderedVideoFrames() can't find a frame in VideoQueue() that
is `in the future`, ie. has a time stamp that is greater than clock
time, the thread is scheduled in 40ms.

The logic in UpdateRenderedVideoFrames() always leaves the current frame
sent to the compositor at the head of the queue. It's time stamp is
always less than clock time.

Because there's always one, old frame in the queue, the logic in
OnVideoDecoded() needs to reschedule the state machine when queue size
is two, after adding the new frame.
This commit is contained in:
Dan Glastonbury 2015-10-14 14:28:34 +10:00
Родитель bf33ea16ea
Коммит 84e1a37ffe
1 изменённых файлов: 11 добавлений и 8 удалений

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

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@ -873,14 +874,16 @@ MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample)
StopPrerollingVideo();
}
// Schedule the state machine to send stream data as soon as possible or
// the VideoQueue() is empty before the Push().
// VideoQueue() is empty implies the state machine thread doesn't have
// precise time information about video frames. Once the first video
// frame pushed in the queue, schedule the state machine as soon as
// possible to render the video frame or delay the state machine thread
// accurately.
if (VideoQueue().GetSize() == 1) {
// 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();
}