Bug 1136827 - Call OnAudioSinkError on state machine thread. r=jww

This commit is contained in:
Bobby Holley 2015-03-24 20:40:40 -07:00
parent 7c31bd272b
commit f97a613114
3 changed files with 8 additions and 3 deletions

View File

@ -162,8 +162,7 @@ AudioSink::AudioLoop()
if (NS_FAILED(InitializeAudioStream())) {
NS_WARNING("Initializing AudioStream failed.");
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
mStateMachine->OnAudioSinkError();
mStateMachine->DispatchOnAudioSinkError();
return;
}

View File

@ -3455,7 +3455,8 @@ void MediaDecoderStateMachine::OnAudioSinkComplete()
void MediaDecoderStateMachine::OnAudioSinkError()
{
AssertCurrentThreadInMonitor();
MOZ_ASSERT(OnStateMachineThread());
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
// AudioSink not used with captured streams, so ignore errors in this case.
if (mAudioCaptured) {
return;

View File

@ -718,6 +718,11 @@ protected:
// Called by the AudioSink to signal errors.
void OnAudioSinkError();
void DispatchOnAudioSinkError()
{
TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::OnAudioSinkError));
}
// Return true if the video decoder's decode speed can not catch up the
// play time.
bool NeedToSkipToNextKeyframe();