зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135785 - Make DecodeError safe to run on any thread. r=cpearce
This is necessary so that we can make On{Audio,Video}{,Not}Decoded run on the state machine thread in the next patch.
This commit is contained in:
Родитель
820ba52b21
Коммит
5173a29934
|
@ -2154,13 +2154,24 @@ void
|
|||
MediaDecoderStateMachine::DecodeError()
|
||||
{
|
||||
AssertCurrentThreadInMonitor();
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
|
||||
if (mState == DECODER_STATE_SHUTDOWN) {
|
||||
// Already shutdown.
|
||||
return;
|
||||
}
|
||||
|
||||
// DecodeError should probably be redesigned so that it doesn't need to run
|
||||
// on the Decode Task Queue, but this does the trick for now.
|
||||
if (!OnDecodeThread()) {
|
||||
RefPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::AcquireMonitorAndInvokeDecodeError));
|
||||
nsresult rv = DecodeTaskQueue()->Dispatch(task);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
DECODER_WARN("Failed to dispatch AcquireMonitorAndInvokeDecodeError");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Change state to shutdown before sending error report to MediaDecoder
|
||||
// and the HTMLMediaElement, so that our pipeline can start exiting
|
||||
// cleanly during the sync dispatch below.
|
||||
|
@ -3643,12 +3654,7 @@ void MediaDecoderStateMachine::OnAudioSinkError()
|
|||
|
||||
// Otherwise notify media decoder/element about this error for it makes
|
||||
// no sense to play an audio-only file without sound output.
|
||||
RefPtr<nsIRunnable> task(
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::AcquireMonitorAndInvokeDecodeError));
|
||||
nsresult rv = DecodeTaskQueue()->Dispatch(task);
|
||||
if (NS_FAILED(rv)) {
|
||||
DECODER_WARN("Failed to dispatch AcquireMonitorAndInvokeDecodeError");
|
||||
}
|
||||
DecodeError();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче