diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h index 230056fc48c..a2f9b011820 100644 --- a/dom/media/AbstractMediaDecoder.h +++ b/dom/media/AbstractMediaDecoder.h @@ -93,6 +93,13 @@ public: // Set the media as being seekable or not. virtual void SetMediaSeekable(bool aMediaSeekable) = 0; + void DispatchSetMediaSeekable(bool aMediaSeekable) + { + nsCOMPtr r = NS_NewRunnableMethodWithArg( + this, &AbstractMediaDecoder::SetMediaSeekable, aMediaSeekable); + NS_DispatchToMainThread(r); + } + virtual VideoFrameContainer* GetVideoFrameContainer() = 0; virtual mozilla::layers::ImageContainer* GetImageContainer() = 0; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 69fbf1d8060..3510228e373 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -1110,6 +1110,7 @@ void MediaDecoder::UpdateEstimatedMediaDuration(int64_t aDuration) } void MediaDecoder::SetMediaSeekable(bool aMediaSeekable) { + MOZ_ASSERT(NS_IsMainThread()); ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); mMediaSeekable = aMediaSeekable; } diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 6f74403f485..eb402c7ffa7 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1932,7 +1932,7 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata) // Set mode to PLAYBACK after reading metadata. mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK); - mDecoder->SetMediaSeekable(mReader->IsMediaSeekable()); + mDecoder->DispatchSetMediaSeekable(mReader->IsMediaSeekable()); mInfo = aMetadata->mInfo; mMetadataTags = aMetadata->mTags.forget(); nsRefPtr self = this; diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index 64ee3718613..61b908ed55d 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -720,10 +720,7 @@ void OggReader::SetChained(bool aIsChained) { ReentrantMonitorAutoEnter mon(mMonitor); mIsChained = aIsChained; } - { - ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - mDecoder->SetMediaSeekable(false); - } + mDecoder->DispatchSetMediaSeekable(false); } bool OggReader::ReadOggChain()