Bug 1421134. P1 - default MediaCacheStream::mCurrentMode to MODE_METADATA. r=bechen,gerald

We always read metadata when decoding starts. This allows us to remove the call
to mResource->SetReadMode(MediaCacheStream::MODE_METADATA) in ChannelMediaDecoder::Load().

MozReview-Commit-ID: AQMq4HxDZdT

--HG--
extra : rebase_source : 141c43bb93f274d8320a270b5c7289bd1eab134d
extra : source : 7de3d88ddb5c99352f4b5bd0b5e648a52a4a67a5
This commit is contained in:
JW Wang 2017-11-28 10:43:50 +08:00
Родитель 57ea5cf9d9
Коммит 1ae4603e61
4 изменённых файлов: 2 добавлений и 6 удалений

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

@ -64,7 +64,7 @@ public:
// Resume any downloads that have been suspended.
virtual void Resume() = 0;
// The mode is initially MODE_PLAYBACK.
// The mode is initially MODE_METADATA.
virtual void SetReadMode(MediaCacheStream::ReadMode aMode) = 0;
// Returns true if the resource can be seeked to unbuffered ranges, i.e.

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

@ -255,9 +255,6 @@ ChannelMediaDecoder::Load(nsIChannel* aChannel,
rv = mResource->Open(aStreamListener);
NS_ENSURE_SUCCESS(rv, rv);
// Set mode to METADATA since we are about to read metadata.
mResource->SetReadMode(MediaCacheStream::MODE_METADATA);
SetStateMachine(CreateStateMachine());
NS_ENSURE_TRUE(GetStateMachine(), NS_ERROR_FAILURE);

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

@ -507,7 +507,6 @@ MediaCacheStream::MediaCacheStream(ChannelMediaResource* aClient,
, mStreamOffset(0)
, mPlaybackBytesPerSecond(10000)
, mPinCount(0)
, mCurrentMode(MODE_PLAYBACK)
, mMetadataInPartialBlockBuffer(false)
, mIsPrivateBrowsing(aIsPrivateBrowsing)
{

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

@ -523,7 +523,7 @@ private:
// when mDidNotifyDataEnded is true.
nsresult mNotifyDataEndedStatus;
// The last reported read mode
ReadMode mCurrentMode;
ReadMode mCurrentMode = MODE_METADATA;
// True if some data in mPartialBlockBuffer has been read as metadata
bool mMetadataInPartialBlockBuffer;
// The load ID of the current channel. Used to check whether the data is