From bb5fe27bf5a7fabd9c7fdb0efe0ceefc7678c157 Mon Sep 17 00:00:00 2001 From: Chris Double Date: Thu, 25 Sep 2008 19:32:16 +1200 Subject: [PATCH] Backed out changeset 62295a6ef00a --- .../html/content/src/nsHTMLMediaElement.cpp | 1 - content/media/video/src/nsOggDecoder.cpp | 36 ++++--------------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index 7f267442e78..bb54ab42b09 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -662,7 +662,6 @@ void nsHTMLMediaElement::PlaybackEnded() { mBegun = PR_FALSE; mEnded = PR_TRUE; - mPaused = PR_TRUE; SetCurrentTime(0); DispatchSimpleEvent(NS_LITERAL_STRING("ended")); } diff --git a/content/media/video/src/nsOggDecoder.cpp b/content/media/video/src/nsOggDecoder.cpp index 02e3a2f1f2d..7df93830683 100644 --- a/content/media/video/src/nsOggDecoder.cpp +++ b/content/media/video/src/nsOggDecoder.cpp @@ -307,8 +307,8 @@ public: float DisplayFrame(OggPlayCallbackInfo** aFrame, nsAudioStream* aAudioStream); // Decode and display the initial frame after the oggplay buffers - // have been cleared (during a seek for example). The decode monitor - // is obtained internally by this method for synchronisation. + // have been cleared (during a seek for example).The decode monitor + // must be obtained before calling. float DisplayInitialFrame(); protected: @@ -444,10 +444,9 @@ float nsOggDecodeStateMachine::DisplayFrame(OggPlayCallbackInfo** aFrame, nsAudi float nsOggDecodeStateMachine::DisplayInitialFrame() { - nsAutoMonitor mon(mDecoder->GetMonitor()); + // NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "DisplayInitialFrame() called without acquiring decoder monitor"); float time = 0.0; OggPlayCallbackInfo **frame = NextFrame(); - mon.Exit(); while (!frame) { OggPlayErrorCode r = DecodeFrame(); if (r != E_OGGPLAY_CONTINUE && @@ -455,21 +454,13 @@ float nsOggDecodeStateMachine::DisplayInitialFrame() r != E_OGGPLAY_TIMEOUT) { break; } - mon.Enter(); - if (mState == DECODER_STATE_SHUTDOWN) - return 0.0; mBufferFull = (r == E_OGGPLAY_USER_INTERRUPT); frame = NextFrame(); - mon.Exit(); } - mon.Enter(); + if (frame) { - if (mState != DECODER_STATE_SHUTDOWN) { - // If shutting down, don't display the frame as this can - // cause events to be posted. - time = DisplayFrame(frame, nsnull); - } + time = DisplayFrame(frame, nsnull); ReleaseFrame(frame); mBufferFull = PR_FALSE; } @@ -520,9 +511,6 @@ float nsOggDecodeStateMachine::DisplayTrack(int aTrackNumber, OggPlayCallbackInf } void nsOggDecodeStateMachine::HandleVideoData(int aTrackNum, OggPlayVideoData* aVideoData) { - if (!aVideoData) - return; - CopyVideoFrame(aTrackNum, aVideoData, mFramerate); nsCOMPtr event = @@ -716,19 +704,9 @@ nsresult nsOggDecodeStateMachine::Run() continue; } - mBufferFull = PR_FALSE; - + mDecoder->mDisplayStateMachine->UpdateFrameTime(DisplayInitialFrame()); mon.Exit(); - float time = DisplayInitialFrame(); - mon.Enter(); - - if (mState == DECODER_STATE_SHUTDOWN) { - continue; - } - - mDecoder->mDisplayStateMachine->UpdateFrameTime(time); - mon.Exit(); - + nsCOMPtr stopEvent = NS_NEW_RUNNABLE_METHOD(nsOggDecoder, mDecoder, SeekingStopped); NS_DispatchToMainThread(stopEvent, NS_DISPATCH_SYNC);