[DOM media] Adjust lock scope in MediaSourceDemuxer

This commit is contained in:
Moonchild 2022-02-10 11:09:42 +00:00 committed by roytam1
commit 368848ad12

View file

@ -465,10 +465,12 @@ MediaSourceTrackDemuxer::DoGetSamples(int32_t aNumSamples)
}
RefPtr<SamplesHolder> samples = new SamplesHolder;
samples->mSamples.AppendElement(sample);
if (mNextRandomAccessPoint.ToMicroseconds() <= sample->mTime) {
{
MonitorAutoLock mon(mMonitor);
mNextRandomAccessPoint =
mManager->GetNextRandomAccessPoint(mType, MediaSourceDemuxer::EOS_FUZZ);
if (mNextRandomAccessPoint.ToMicroseconds() <= sample->mTime) {
mNextRandomAccessPoint =
mManager->GetNextRandomAccessPoint(mType, MediaSourceDemuxer::EOS_FUZZ);
}
}
return SamplesPromise::CreateAndResolve(samples, __func__);
}