Backout Bug 449159 - Part 2 of Ogg backend seeking implementation - s+sr=roc

This commit is contained in:
Chris Double 2008-09-25 19:32:44 +12:00
commit e9a2bab93a
2 changed files with 7 additions and 30 deletions

View File

@ -662,7 +662,6 @@ void nsHTMLMediaElement::PlaybackEnded()
{
mBegun = PR_FALSE;
mEnded = PR_TRUE;
mPaused = PR_TRUE;
SetCurrentTime(0);
DispatchSimpleEvent(NS_LITERAL_STRING("ended"));
}

View File

@ -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<nsIRunnable> 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<nsIRunnable> stopEvent =
NS_NEW_RUNNABLE_METHOD(nsOggDecoder, mDecoder, SeekingStopped);
NS_DispatchToMainThread(stopEvent, NS_DISPATCH_SYNC);