Bug 1163223 - Check for shutdown in AwaitStartTime callbacks. r=me

This commit is contained in:
Bobby Holley 2015-06-12 09:16:45 -07:00
parent 21b88ea248
commit c4803dd32f

View File

@ -2165,6 +2165,7 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
mStartTimeRendezvous->AwaitStartTime()->Then(TaskQueue(), __func__,
[self] () -> void {
NS_ENSURE_TRUE_VOID(!self->IsShutdown());
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
self->mReader->SetStartTime(self->StartTime());
},
@ -2177,6 +2178,7 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
} else if (mInfo.mUnadjustedMetadataEndTime.isSome()) {
mStartTimeRendezvous->AwaitStartTime()->Then(TaskQueue(), __func__,
[self] () -> void {
NS_ENSURE_TRUE_VOID(!self->IsShutdown());
TimeUnit unadjusted = self->mInfo.mUnadjustedMetadataEndTime.ref();
TimeUnit adjustment = TimeUnit::FromMicroseconds(self->StartTime());
self->mInfo.mMetadataDuration.emplace(unadjusted - adjustment);
@ -3339,7 +3341,6 @@ void MediaDecoderStateMachine::PreservesPitchChanged()
bool MediaDecoderStateMachine::IsShutdown()
{
AssertCurrentThreadInMonitor();
return mState == DECODER_STATE_ERROR ||
mState == DECODER_STATE_SHUTDOWN;
}