mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1040550 - Prevent MediaSource::SetDuration from being called outside the main thread. r=kinetik
This commit is contained in:
parent
7e5806cf78
commit
e2367255f8
@ -231,6 +231,12 @@ private:
|
||||
return mDecoders[mActiveVideoDecoder]->GetReader();
|
||||
}
|
||||
|
||||
void SetMediaSourceDuration(double aDuration) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ErrorResult dummy;
|
||||
mMediaSource->SetDuration(aDuration, dummy);
|
||||
}
|
||||
|
||||
nsTArray<nsRefPtr<SubBufferDecoder>> mPendingDecoders;
|
||||
nsTArray<nsRefPtr<SubBufferDecoder>> mDecoders;
|
||||
|
||||
@ -585,8 +591,9 @@ MediaSourceReader::ReadMetadata(MediaInfo* aInfo, MetadataTags** aTags)
|
||||
if (maxDuration != -1) {
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->SetMediaDuration(maxDuration);
|
||||
ErrorResult dummy;
|
||||
mMediaSource->SetDuration(maxDuration, dummy);
|
||||
nsRefPtr<nsIRunnable> task (
|
||||
NS_NewRunnableMethodWithArg<double>(this, &MediaSourceReader::SetMediaSourceDuration, maxDuration));
|
||||
NS_DispatchToMainThread(task);
|
||||
}
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user