зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1415766. P2 - move Seek() to private and tighten up some assertions. r=bechen,gerald
MozReview-Commit-ID: BBsXqKUrOi1 --HG-- extra : rebase_source : 1b785f50254ba824037b983896fc40e91eff801a extra : intermediate-source : 6971ed66e78c4e1956bf0e382a04c1c8816dbaf8 extra : source : 6590c3f4691e9730858689839a5eb7b7143ceafb
This commit is contained in:
Родитель
cd5164d38d
Коммит
c51610e0e4
|
@ -2415,18 +2415,18 @@ MediaCacheStream::SetPlaybackRate(uint32_t aBytesPerSecond)
|
||||||
nsresult
|
nsresult
|
||||||
MediaCacheStream::Seek(int64_t aOffset)
|
MediaCacheStream::Seek(int64_t aOffset)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
|
mMediaCache->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||||
|
|
||||||
ReentrantMonitorAutoEnter mon(mMediaCache->GetReentrantMonitor());
|
if (!IsOffsetAllowed(aOffset)) {
|
||||||
|
return NS_ERROR_ILLEGAL_VALUE;
|
||||||
|
}
|
||||||
if (mClosed) {
|
if (mClosed) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_ABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t oldOffset = mStreamOffset;
|
int64_t oldOffset = mStreamOffset;
|
||||||
int64_t newOffset = aOffset;
|
mStreamOffset = aOffset;
|
||||||
if (!IsOffsetAllowed(newOffset)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
mStreamOffset = newOffset;
|
|
||||||
LOG("Stream %p Seek to %" PRId64, this, mStreamOffset);
|
LOG("Stream %p Seek to %" PRId64, this, mStreamOffset);
|
||||||
mMediaCache->NoteSeek(this, oldOffset);
|
mMediaCache->NoteSeek(this, oldOffset);
|
||||||
mMediaCache->QueueUpdate();
|
mMediaCache->QueueUpdate();
|
||||||
|
|
|
@ -339,7 +339,6 @@ public:
|
||||||
// These methods must be called on a different thread from the main
|
// These methods must be called on a different thread from the main
|
||||||
// thread. They should always be called on the same thread for a given
|
// thread. They should always be called on the same thread for a given
|
||||||
// stream.
|
// stream.
|
||||||
nsresult Seek(int64_t aOffset);
|
|
||||||
int64_t Tell();
|
int64_t Tell();
|
||||||
// *aBytes gets the number of bytes that were actually read. This can
|
// *aBytes gets the number of bytes that were actually read. This can
|
||||||
// be less than aCount. If the first byte of data is not in the cache,
|
// be less than aCount. If the first byte of data is not in the cache,
|
||||||
|
@ -433,6 +432,9 @@ private:
|
||||||
Result<uint32_t, nsresult> ReadBlockFromCache(int64_t aOffset,
|
Result<uint32_t, nsresult> ReadBlockFromCache(int64_t aOffset,
|
||||||
Span<char> aBuffer);
|
Span<char> aBuffer);
|
||||||
|
|
||||||
|
// Non-main thread only.
|
||||||
|
nsresult Seek(int64_t aOffset);
|
||||||
|
|
||||||
// Returns the end of the bytes starting at the given offset
|
// Returns the end of the bytes starting at the given offset
|
||||||
// which are in cache.
|
// which are in cache.
|
||||||
// This method assumes that the cache monitor is held and can be called on
|
// This method assumes that the cache monitor is held and can be called on
|
||||||
|
|
Загрузка…
Ссылка в новой задаче