diff --git a/dom/media/webm/WebMBufferedParser.cpp b/dom/media/webm/WebMBufferedParser.cpp index 62333ab96cbd..c0e37c18838f 100644 --- a/dom/media/webm/WebMBufferedParser.cpp +++ b/dom/media/webm/WebMBufferedParser.cpp @@ -313,7 +313,7 @@ bool WebMBufferedState::CalculateBufferedForRange(int64_t aStartOffset, int64_t aEndOffset, uint64_t* aStartTime, uint64_t* aEndTime) { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); // Find the first WebMTimeDataOffset at or after aStartOffset. uint32_t start = mTimeMapping.IndexOfFirstElementGt(aStartOffset - 1, @@ -360,7 +360,7 @@ bool WebMBufferedState::CalculateBufferedForRange(int64_t aStartOffset, } bool WebMBufferedState::GetOffsetForTime(uint64_t aTime, int64_t* aOffset) { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); if (mTimeMapping.IsEmpty()) { return false; @@ -412,7 +412,7 @@ void WebMBufferedState::NotifyDataArrived(const unsigned char* aBuffer, } { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); mRangeParsers[idx].Append(aBuffer, aLength, mTimeMapping); } @@ -432,12 +432,12 @@ void WebMBufferedState::NotifyDataArrived(const unsigned char* aBuffer, return; } - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); mLastBlockOffset = mRangeParsers.LastElement().mBlockEndOffset; } void WebMBufferedState::Reset() { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); mRangeParsers.Clear(); mTimeMapping.Clear(); } @@ -500,13 +500,13 @@ int64_t WebMBufferedState::GetInitEndOffset() { } int64_t WebMBufferedState::GetLastBlockOffset() { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); return mLastBlockOffset; } bool WebMBufferedState::GetStartTime(uint64_t* aTime) { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); if (mTimeMapping.IsEmpty()) { return false; @@ -523,7 +523,7 @@ bool WebMBufferedState::GetStartTime(uint64_t* aTime) { bool WebMBufferedState::GetNextKeyframeTime(uint64_t aTime, uint64_t* aKeyframeTime) { - ReentrantMonitorAutoEnter mon(mReentrantMonitor); + MutexAutoLock lock(mMutex); int64_t offset = 0; bool rv = GetOffsetForTime(aTime, &offset); if (!rv) { diff --git a/dom/media/webm/WebMBufferedParser.h b/dom/media/webm/WebMBufferedParser.h index 66de893b530d..8bce578320ff 100644 --- a/dom/media/webm/WebMBufferedParser.h +++ b/dom/media/webm/WebMBufferedParser.h @@ -8,7 +8,7 @@ # include "nsISupportsImpl.h" # include "nsTArray.h" -# include "mozilla/ReentrantMonitor.h" +# include "mozilla/Mutex.h" # include "MediaResource.h" namespace mozilla { @@ -261,8 +261,7 @@ class WebMBufferedState final { NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebMBufferedState) public: - WebMBufferedState() - : mReentrantMonitor("WebMBufferedState"), mLastBlockOffset(-1) { + WebMBufferedState() : mMutex("WebMBufferedState"), mLastBlockOffset(-1) { MOZ_COUNT_CTOR(WebMBufferedState); } @@ -296,13 +295,13 @@ class WebMBufferedState final { MOZ_COUNTED_DTOR(WebMBufferedState) // Synchronizes access to the mTimeMapping array and mLastBlockOffset. - ReentrantMonitor mReentrantMonitor; + Mutex mMutex; // Sorted (by offset) map of data offsets to timecodes. Populated // on the main thread as data is received and parsed by WebMBufferedParsers. - nsTArray mTimeMapping GUARDED_BY(mReentrantMonitor); + nsTArray mTimeMapping GUARDED_BY(mMutex); // The last complete block parsed. -1 if not set. - int64_t mLastBlockOffset GUARDED_BY(mReentrantMonitor); + int64_t mLastBlockOffset GUARDED_BY(mMutex); // Sorted (by offset) live parser instances. Main thread only. nsTArray mRangeParsers;