mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1109437 - Stop using buffering heuristics when they're not requested. r=cpearce
Given that we set the buffering wait to 0 in this case already, the only practical impact on our behavior of this change is that we'll no longer ping-pong between states.
This commit is contained in:
parent
72d88fedcb
commit
4166dff3db
@ -2658,9 +2658,16 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
NS_ASSERTION(!mBufferingStart.IsNull(), "Must know buffering start time.");
|
||||
|
||||
// We will remain in the buffering state if we've not decoded enough
|
||||
// data to begin playback, or if we've not downloaded a reasonable
|
||||
// amount of data inside our buffering time.
|
||||
// When we enter buffering mode from playback, we push our most recent
|
||||
// video frame back into the queue. So depending on how we started
|
||||
// buffering, we may have one dummy frame in the queue. :-(
|
||||
bool outOfAudio = IsAudioDecoding() && !AudioQueue().IsFinished() && AudioQueue().GetSize() == 0;
|
||||
bool outOfVideo = IsVideoDecoding() && !VideoQueue().IsFinished() && VideoQueue().GetSize() <= 1;
|
||||
|
||||
// With buffering heuristics we will remain in the buffering state if
|
||||
// we've not decoded enough data to begin playback, or if we've not
|
||||
// downloaded a reasonable amount of data inside our buffering time.
|
||||
if (mReader->UseBufferingHeuristics()) {
|
||||
TimeDuration elapsed = now - mBufferingStart;
|
||||
bool isLiveStream = resource->GetLength() == -1;
|
||||
if ((isLiveStream || !mDecoder->CanPlayThrough()) &&
|
||||
@ -2674,11 +2681,17 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
(mQuickBuffering ? "(quick exit)" : ""));
|
||||
ScheduleStateMachine(USECS_PER_S);
|
||||
return NS_OK;
|
||||
} else {
|
||||
}
|
||||
} else if (outOfAudio || outOfVideo) {
|
||||
DECODER_LOG("Out of decoded data - polling for 1s");
|
||||
DispatchDecodeTasksIfNeeded();
|
||||
ScheduleStateMachine(USECS_PER_S);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DECODER_LOG("Changed state from BUFFERING to DECODING");
|
||||
DECODER_LOG("Buffered for %.3lfs", (now - mBufferingStart).ToSeconds());
|
||||
StartDecoding();
|
||||
}
|
||||
|
||||
// Notify to allow blocked decoder thread to continue
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
@ -2938,7 +2951,7 @@ void MediaDecoderStateMachine::AdvanceFrame()
|
||||
mDecoder->GetState() == MediaDecoder::PLAY_STATE_PLAYING &&
|
||||
HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) &&
|
||||
mDecoder->IsExpectingMoreData()) {
|
||||
if (JustExitedQuickBuffering() || HasLowUndecodedData()) {
|
||||
if (!mReader->UseBufferingHeuristics() || JustExitedQuickBuffering() || HasLowUndecodedData()) {
|
||||
if (currentFrame) {
|
||||
VideoQueue().PushFront(currentFrame);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user