Bug 1401471. P4 - always access mChannelOffset within the cache monitor. r=gerald

MozReview-Commit-ID: KIQU3PrBUj1

--HG--
extra : rebase_source : 5b012b8ace153124a1f2f158efeaad9057927dd4
extra : intermediate-source : d5219d074f525e614164e7c3076a9df695c55e6c
extra : source : 8f07a48d4ac13162add83cce8677322e148d6f74
This commit is contained in:
JW Wang 2017-09-20 16:23:21 +08:00
Родитель 184fd3f455
Коммит 4ead787594
2 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -462,7 +462,6 @@ MediaCacheStream::MediaCacheStream(ChannelMediaResource* aClient,
, mIsTransportSeekable(false)
, mCacheSuspended(false)
, mChannelEnded(false)
, mChannelOffset(0)
, mStreamLength(-1)
, mStreamOffset(0)
, mPlaybackBytesPerSecond(10000)
@ -2206,7 +2205,7 @@ MediaCacheStream::GetLength()
int64_t
MediaCacheStream::GetOffset() const
{
MOZ_ASSERT(NS_IsMainThread());
ReentrantMonitorAutoEnter mon(mMediaCache->GetReentrantMonitor());
return mChannelOffset;
}

Просмотреть файл

@ -460,8 +460,6 @@ private:
bool mCacheSuspended;
// True if the channel ended and we haven't seeked it again.
bool mChannelEnded;
// The offset where the next data from the channel will arrive
int64_t mChannelOffset;
// The reported or discovered length of the data, or -1 if nothing is
// known
int64_t mStreamLength;
@ -469,6 +467,8 @@ private:
// The following fields are protected by the cache's monitor can can be written
// by any thread.
// The offset where the next data from the channel will arrive
int64_t mChannelOffset = 0;
// The offset where the reader is positioned in the stream
int64_t mStreamOffset;
// For each block in the stream data, maps to the cache entry for the