Bug 1242845 - Make the computation of MediaDecoderStateMachine::HasLowUndecodedData() more accurate and consistent. r=jya.

This commit is contained in:
JW Wang 2016-01-27 15:12:49 +08:00
Родитель 72a2a1e4c2
Коммит f01d10313b
1 изменённых файлов: 11 добавлений и 8 удалений

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

@ -1877,14 +1877,17 @@ bool MediaDecoderStateMachine::HasLowUndecodedData(int64_t aUsecs)
return false; return false;
} }
int64_t endOfDecodedVideoData = INT64_MAX; // We are never low in decoded data when we don't have audio/video or have
if (HasVideo() && !VideoQueue().AtEndOfStream()) { // decoded all audio/video samples.
endOfDecodedVideoData = VideoQueue().Peek() ? VideoQueue().Peek()->GetEndTime() : VideoEndTime(); int64_t endOfDecodedVideoData =
} (HasVideo() && !VideoQueue().IsFinished()) ?
int64_t endOfDecodedAudioData = INT64_MAX; mDecodedVideoEndTime :
if (HasAudio() && !AudioQueue().AtEndOfStream()) { INT64_MAX;
endOfDecodedAudioData = mDecodedAudioEndTime; int64_t endOfDecodedAudioData =
} (HasAudio() && !AudioQueue().IsFinished()) ?
mDecodedAudioEndTime :
INT64_MAX;
int64_t endOfDecodedData = std::min(endOfDecodedVideoData, endOfDecodedAudioData); int64_t endOfDecodedData = std::min(endOfDecodedVideoData, endOfDecodedAudioData);
if (Duration().ToMicroseconds() < endOfDecodedData) { if (Duration().ToMicroseconds() < endOfDecodedData) {
// Our duration is not up to date. No point buffering. // Our duration is not up to date. No point buffering.