зеркало из https://github.com/mozilla/gecko-dev.git
Bug 449159 - Part 2 of Ogg backend seeking implementation - s+sr=roc
This commit is contained in:
Родитель
6ef90c1e96
Коммит
7e6bd93800
|
@ -662,6 +662,7 @@ void nsHTMLMediaElement::PlaybackEnded()
|
|||
{
|
||||
mBegun = PR_FALSE;
|
||||
mEnded = PR_TRUE;
|
||||
mPaused = PR_TRUE;
|
||||
SetCurrentTime(0);
|
||||
DispatchSimpleEvent(NS_LITERAL_STRING("ended"));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
// must be obtained before calling.
|
||||
// have been cleared (during a seek for example). The decode monitor
|
||||
// is obtained internally by this method for synchronisation.
|
||||
float DisplayInitialFrame();
|
||||
|
||||
protected:
|
||||
|
@ -444,9 +444,10 @@ float nsOggDecodeStateMachine::DisplayFrame(OggPlayCallbackInfo** aFrame, nsAudi
|
|||
|
||||
float nsOggDecodeStateMachine::DisplayInitialFrame()
|
||||
{
|
||||
// NS_ASSERTION(PR_InMonitor(mDecoder->GetMonitor()), "DisplayInitialFrame() called without acquiring decoder monitor");
|
||||
nsAutoMonitor mon(mDecoder->GetMonitor());
|
||||
float time = 0.0;
|
||||
OggPlayCallbackInfo **frame = NextFrame();
|
||||
mon.Exit();
|
||||
while (!frame) {
|
||||
OggPlayErrorCode r = DecodeFrame();
|
||||
if (r != E_OGGPLAY_CONTINUE &&
|
||||
|
@ -454,13 +455,21 @@ 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) {
|
||||
time = DisplayFrame(frame, nsnull);
|
||||
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);
|
||||
}
|
||||
ReleaseFrame(frame);
|
||||
mBufferFull = PR_FALSE;
|
||||
}
|
||||
|
@ -511,6 +520,9 @@ float nsOggDecodeStateMachine::DisplayTrack(int aTrackNumber, OggPlayCallbackInf
|
|||
}
|
||||
|
||||
void nsOggDecodeStateMachine::HandleVideoData(int aTrackNum, OggPlayVideoData* aVideoData) {
|
||||
if (!aVideoData)
|
||||
return;
|
||||
|
||||
CopyVideoFrame(aTrackNum, aVideoData, mFramerate);
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
|
@ -704,9 +716,19 @@ nsresult nsOggDecodeStateMachine::Run()
|
|||
continue;
|
||||
}
|
||||
|
||||
mDecoder->mDisplayStateMachine->UpdateFrameTime(DisplayInitialFrame());
|
||||
mBufferFull = PR_FALSE;
|
||||
|
||||
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче