Handle playback ended in a consistent way for both file and stream case

This commit is contained in:
trav90
2017-03-08 00:43:27 -06:00
committed by roytam1
parent a068fb2b80
commit e1caa768c4
2 changed files with 3 additions and 13 deletions
+3 -5
View File
@@ -2673,7 +2673,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 ||
@@ -2695,10 +2695,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);