diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 25d5208e6d5..2a72c58baf4 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -412,7 +412,7 @@ bool MediaDecoderStateMachine::HasFutureAudio() // we've completely decoded all audio (but not finished playing it yet // as per 1). return !mAudioCompleted && - (AudioDecodedUsecs() > + (GetDecodedAudioDuration() > mLowAudioThresholdUsecs * mPlaybackRate || AudioQueue().IsFinished()); } @@ -1817,18 +1817,6 @@ MediaDecoderStateMachine::StartMediaSink() } } -int64_t MediaDecoderStateMachine::AudioDecodedUsecs() -{ - MOZ_ASSERT(OnTaskQueue()); - NS_ASSERTION(HasAudio(), - "Should only call AudioDecodedUsecs() when we have audio"); - // The amount of audio we have decoded is the amount of audio data we've - // already decoded and pushed to the hardware, plus the amount of audio - // data waiting to be pushed to the hardware. - int64_t pushed = mMediaSink->IsStarted() ? (AudioEndTime() - GetMediaTime()) : 0; - return pushed + AudioQueue().Duration(); -} - bool MediaDecoderStateMachine::HasLowDecodedData(int64_t aAudioUsecs) { MOZ_ASSERT(OnTaskQueue()); @@ -1837,7 +1825,7 @@ bool MediaDecoderStateMachine::HasLowDecodedData(int64_t aAudioUsecs) // provided we've not decoded to the end of the audio stream, or // if we're low on video frames, provided // we've not decoded to the end of the video stream. - return ((IsAudioDecoding() && AudioDecodedUsecs() < aAudioUsecs) || + return ((IsAudioDecoding() && GetDecodedAudioDuration() < aAudioUsecs) || (IsVideoDecoding() && static_cast(VideoQueue().GetSize()) < LOW_VIDEO_FRAMES)); } diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 10a44709335..1580b163bfe 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -448,12 +448,6 @@ protected: // Returns true if we have less than aUsecs of undecoded data available. bool HasLowUndecodedData(int64_t aUsecs); - // Returns the number of unplayed usecs of audio we've got decoded and/or - // pushed to the hardware waiting to play. This is how much audio we can - // play without having to run the audio decoder. The decoder monitor - // must be held. - int64_t AudioDecodedUsecs(); - // Returns true when there's decoded audio waiting to play. // The decoder monitor must be held. bool HasFutureAudio();