diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index 893d87fc0b8..9a7a03a3eac 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -1748,6 +1748,7 @@ SourceMediaStream::AdvanceKnownTracksTime(StreamTime aKnownTime) void SourceMediaStream::FinishWithLockHeld() { + mMutex.AssertCurrentThreadOwns(); mUpdateFinished = true; if (!mDestroyed) { GraphImpl()->EnsureNextIteration(); @@ -1757,12 +1758,10 @@ SourceMediaStream::FinishWithLockHeld() void SourceMediaStream::EndAllTrackAndFinish() { - { - MutexAutoLock lock(mMutex); - for (uint32_t i = 0; i < mUpdateTracks.Length(); ++i) { - SourceMediaStream::TrackData* data = &mUpdateTracks[i]; - data->mCommands |= TRACK_END; - } + MutexAutoLock lock(mMutex); + for (uint32_t i = 0; i < mUpdateTracks.Length(); ++i) { + SourceMediaStream::TrackData* data = &mUpdateTracks[i]; + data->mCommands |= TRACK_END; } FinishWithLockHeld(); // we will call NotifyFinished() to let GetUserMedia know