From 0087b72a49e996b6d8b7dc5961664362f06dfdeb Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Fri, 5 Feb 2010 17:06:08 +1300 Subject: [PATCH] Bug 525401 - Fix resuming from pause when playing poorly muxed videos. r=chris.double --HG-- extra : rebase_source : 36bed71b92803c1b2f864cdd090db7d575b58d6b --- content/media/ogg/nsOggDecoder.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/content/media/ogg/nsOggDecoder.cpp b/content/media/ogg/nsOggDecoder.cpp index ce978dc25c75..805e1166c5d7 100644 --- a/content/media/ogg/nsOggDecoder.cpp +++ b/content/media/ogg/nsOggDecoder.cpp @@ -1084,9 +1084,6 @@ void nsOggDecodeStateMachine::StartPlayback() // Null out mPauseStartTime mPauseStartTime = TimeStamp(); } - mPlayStartTime = TimeStamp::Now(); - mPauseDuration = 0; - } void nsOggDecodeStateMachine::StopPlayback() @@ -1107,9 +1104,6 @@ void nsOggDecodeStateMachine::PausePlayback() mAudioStream->Pause(); mPlaying = PR_FALSE; mPauseStartTime = TimeStamp::Now(); - if (mAudioStream->GetPosition() < 0) { - mLastFrame = mDecodedFrames.ResetTimes(mCallbackPeriod); - } } void nsOggDecodeStateMachine::ResumePlayback() @@ -1128,8 +1122,6 @@ void nsOggDecodeStateMachine::ResumePlayback() // Null out mPauseStartTime mPauseStartTime = TimeStamp(); } - mPlayStartTime = TimeStamp::Now(); - mPauseDuration = 0; } void nsOggDecodeStateMachine::UpdatePlaybackPosition(float aTime) @@ -1509,6 +1501,9 @@ nsresult nsOggDecodeStateMachine::Run() QueueDecodedFrames(); while (mDecodedFrames.IsEmpty() && !mDecodingCompleted && !mBufferExhausted) { + if (mPlaying) { + PausePlayback(); + } mon.Wait(PR_MillisecondsToInterval(PRInt64(mCallbackPeriod*500))); if (mState != DECODER_STATE_DECODING) break;