diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 50403b60d7a3..8c21f7fa08bc 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -328,14 +328,6 @@ MediaDecoder::DecodedStreamGraphListener::NotifyOutput(MediaStreamGraph* aGraph, void MediaDecoder::DecodedStreamGraphListener::DoNotifyFinished() { - if (mData && mData->mDecoder) { - if (mData->mDecoder->GetState() == PLAY_STATE_PLAYING) { - nsCOMPtr event = - NS_NewRunnableMethod(mData->mDecoder, &MediaDecoder::PlaybackEnded); - NS_DispatchToCurrentThread(event); - } - } - MutexAutoLock lock(mMutex); mStreamFinishedOnMainThread = true; } diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index eb5e76265a16..8a158e9a05f2 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2895,7 +2895,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine() // end of the media, and so that we update the readyState. if (VideoQueue().GetSize() > 0 || (HasAudio() && !mAudioCompleted) || - (mDecoder->GetDecodedStream() && !mDecoder->GetDecodedStream()->IsFinished())) + (mAudioCaptured && !mDecoder->GetDecodedStream()->IsFinished())) { AdvanceFrame(); NS_ASSERTION(mDecoder->GetState() != MediaDecoder::PLAY_STATE_PLAYING || @@ -2917,10 +2917,8 @@ nsresult MediaDecoderStateMachine::RunStateMachine() } StopAudioThread(); - // When we're decoding to a stream, the stream's main-thread finish signal - // will take care of calling MediaDecoder::PlaybackEnded. - if (mDecoder->GetState() == MediaDecoder::PLAY_STATE_PLAYING && - !mDecoder->GetDecodedStream()) { + + if (mDecoder->GetState() == MediaDecoder::PLAY_STATE_PLAYING) { int64_t clockTime = std::max(mAudioEndTime, mVideoFrameEndTime); clockTime = std::max(int64_t(0), std::max(clockTime, mEndTime)); UpdatePlaybackPosition(clockTime);