From f08642b928dbfada86a78bb72640b9a017dbdd61 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 25 Nov 2011 15:06:20 +1300 Subject: [PATCH] Bug 703379. Rename nsMediaDecoder::GetCurrentStream to GetStream. Make nsMediaStream::URI() const. r=doublec --- .../html/content/src/nsHTMLMediaElement.cpp | 4 ++-- content/media/nsBuiltinDecoder.cpp | 2 +- content/media/nsBuiltinDecoder.h | 2 +- .../media/nsBuiltinDecoderStateMachine.cpp | 8 +++---- content/media/nsMediaDecoder.cpp | 4 ++-- content/media/nsMediaDecoder.h | 4 ++-- content/media/nsMediaStream.h | 2 +- content/media/ogg/nsOggReader.cpp | 24 +++++++++---------- content/media/raw/nsRawReader.cpp | 6 ++--- content/media/wave/nsWaveReader.cpp | 24 +++++++++---------- content/media/webm/nsWebMReader.cpp | 12 +++++----- 11 files changed, 46 insertions(+), 46 deletions(-) diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index cbc36f4e5d6c..100bd950a5ef 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -1811,7 +1811,7 @@ nsHTMLMediaElement::CreateDecoder(const nsACString& aType) nsresult nsHTMLMediaElement::InitializeDecoderAsClone(nsMediaDecoder* aOriginal) { - nsMediaStream* originalStream = aOriginal->GetCurrentStream(); + nsMediaStream* originalStream = aOriginal->GetStream(); if (!originalStream) return NS_ERROR_FAILURE; nsRefPtr decoder = aOriginal->Clone(); @@ -2670,7 +2670,7 @@ void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic) void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString) { if (mDecoder) { - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); if (stream) { stream->URI()->GetSpec(aString); } diff --git a/content/media/nsBuiltinDecoder.cpp b/content/media/nsBuiltinDecoder.cpp index 07e50a733f8f..85588797d05f 100644 --- a/content/media/nsBuiltinDecoder.cpp +++ b/content/media/nsBuiltinDecoder.cpp @@ -377,7 +377,7 @@ double nsBuiltinDecoder::GetCurrentTime() return mCurrentTime; } -nsMediaStream* nsBuiltinDecoder::GetCurrentStream() +nsMediaStream* nsBuiltinDecoder::GetStream() { return mStream; } diff --git a/content/media/nsBuiltinDecoder.h b/content/media/nsBuiltinDecoder.h index bdf899e55b76..2a949492c956 100644 --- a/content/media/nsBuiltinDecoder.h +++ b/content/media/nsBuiltinDecoder.h @@ -405,7 +405,7 @@ class nsBuiltinDecoder : public nsMediaDecoder virtual void SetInfinite(bool aInfinite); virtual bool IsInfinite(); - virtual nsMediaStream* GetCurrentStream(); + virtual nsMediaStream* GetStream(); virtual already_AddRefed GetCurrentPrincipal(); virtual void NotifySuspendedStatusChanged(); diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index c93de4a0074c..74180b445d22 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -1571,7 +1571,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine() { mDecoder->GetReentrantMonitor().AssertCurrentThreadIn(); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream, NS_ERROR_NULL_POINTER); switch (mState) { @@ -1652,7 +1652,7 @@ nsresult nsBuiltinDecoderStateMachine::RunStateMachine() // data to begin playback, or if we've not downloaded a reasonable // amount of data inside our buffering time. TimeDuration elapsed = now - mBufferingStart; - bool isLiveStream = mDecoder->GetCurrentStream()->GetLength() == -1; + bool isLiveStream = mDecoder->GetStream()->GetLength() == -1; if ((isLiveStream || !mDecoder->CanPlayThrough()) && elapsed < TimeDuration::FromSeconds(mBufferingWait) && (mQuickBuffering ? HasLowDecodedData(QUICK_BUFFERING_LOW_DATA_USECS) @@ -1850,7 +1850,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame() // Check to see if we don't have enough data to play up to the next frame. // If we don't, switch to buffering mode. - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); if (mState == DECODER_STATE_DECODING && mDecoder->GetState() == nsBuiltinDecoder::PLAY_STATE_PLAYING && HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) && @@ -2028,7 +2028,7 @@ void nsBuiltinDecoderStateMachine::StartBuffering() } nsresult nsBuiltinDecoderStateMachine::GetBuffered(nsTimeRanges* aBuffered) { - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream, NS_ERROR_FAILURE); stream->Pin(); nsresult res = mReader->GetBuffered(aBuffered, mStartTime); diff --git a/content/media/nsMediaDecoder.cpp b/content/media/nsMediaDecoder.cpp index 884e8a0386c3..084047c05f3d 100644 --- a/content/media/nsMediaDecoder.cpp +++ b/content/media/nsMediaDecoder.cpp @@ -261,7 +261,7 @@ double nsMediaDecoder::GetFrameDelay() void nsMediaDecoder::PinForSeek() { - nsMediaStream* stream = GetCurrentStream(); + nsMediaStream* stream = GetStream(); if (!stream || mPinnedForSeek) { return; } @@ -271,7 +271,7 @@ void nsMediaDecoder::PinForSeek() void nsMediaDecoder::UnpinForSeek() { - nsMediaStream* stream = GetCurrentStream(); + nsMediaStream* stream = GetStream(); if (!stream || !mPinnedForSeek) { return; } diff --git a/content/media/nsMediaDecoder.h b/content/media/nsMediaDecoder.h index cf7cb66d35ad..a6ad64076abf 100644 --- a/content/media/nsMediaDecoder.h +++ b/content/media/nsMediaDecoder.h @@ -91,8 +91,8 @@ public: virtual bool Init(nsHTMLMediaElement* aElement); // Get the current nsMediaStream being used. Its URI will be returned - // by currentSrc. - virtual nsMediaStream* GetCurrentStream() = 0; + // by currentSrc. Returns what was passed to Load(), if Load() has been called. + virtual nsMediaStream* GetStream() = 0; // Return the principal of the current URI being played or downloaded. virtual already_AddRefed GetCurrentPrincipal() = 0; diff --git a/content/media/nsMediaStream.h b/content/media/nsMediaStream.h index ac35a25337d1..7ffaeccefa34 100644 --- a/content/media/nsMediaStream.h +++ b/content/media/nsMediaStream.h @@ -169,7 +169,7 @@ public: // The following can be called on the main thread only: // Get the URI - nsIURI* URI() { return mURI; } + nsIURI* URI() const { return mURI; } // Close the stream, stop any listeners, channels, etc. // Cancels any currently blocking Read request and forces that request to // return an error. diff --git a/content/media/ogg/nsOggReader.cpp b/content/media/ogg/nsOggReader.cpp index 7575e08dcaf7..9848cea44777 100644 --- a/content/media/ogg/nsOggReader.cpp +++ b/content/media/ogg/nsOggReader.cpp @@ -315,7 +315,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo) { ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); if (mDecoder->GetStateMachine()->GetDuration() == -1 && mDecoder->GetStateMachine()->GetState() != nsDecoderStateMachine::DECODER_STATE_SHUTDOWN && stream->GetLength() >= 0 && @@ -552,7 +552,7 @@ PRInt64 nsOggReader::ReadOggPage(ogg_page* aPage) // Read from the stream into the buffer PRUint32 bytesRead = 0; - nsresult rv = mDecoder->GetCurrentStream()->Read(buffer, 4096, &bytesRead); + nsresult rv = mDecoder->GetStream()->Read(buffer, 4096, &bytesRead); if (NS_FAILED(rv) || (bytesRead == 0 && ret == 0)) { // End of file. return -1; @@ -616,7 +616,7 @@ GetChecksum(ogg_page* page) PRInt64 nsOggReader::RangeStartTime(PRInt64 aOffset) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream != nsnull, nsnull); nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset); NS_ENSURE_SUCCESS(res, nsnull); @@ -640,7 +640,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aEndOffset) NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(), "Should be on state machine or decode thread."); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream != nsnull, -1); PRInt64 position = stream->Tell(); PRInt64 endTime = RangeEndTime(0, aEndOffset, false); @@ -653,7 +653,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset, PRInt64 aEndOffset, bool aCachedDataOnly) { - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); nsAutoOggSyncState sync; // We need to find the last page which ends before aEndOffset that @@ -770,7 +770,7 @@ nsresult nsOggReader::GetSeekRanges(nsTArray& aRanges) { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); nsTArray cached; - nsresult res = mDecoder->GetCurrentStream()->GetCachedRanges(cached); + nsresult res = mDecoder->GetStream()->GetCachedRanges(cached); NS_ENSURE_SUCCESS(res, res); for (PRUint32 index = 0; index < cached.Length(); index++) { @@ -809,7 +809,7 @@ nsOggReader::SelectSeekRange(const nsTArray& ranges, { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); PRInt64 so = 0; - PRInt64 eo = mDecoder->GetCurrentStream()->GetLength(); + PRInt64 eo = mDecoder->GetStream()->GetLength(); PRInt64 st = aStartTime; PRInt64 et = aEndTime; for (PRUint32 i = 0; i < ranges.Length(); i++) { @@ -837,7 +837,7 @@ nsOggReader::SelectSeekRange(const nsTArray& ranges, nsOggReader::IndexedSeekResult nsOggReader::RollbackIndexedSeek(PRInt64 aOffset) { mSkeletonState->Deactivate(); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream != nsnull, SEEK_FATAL_ERROR); nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset); NS_ENSURE_SUCCESS(res, SEEK_FATAL_ERROR); @@ -846,7 +846,7 @@ nsOggReader::IndexedSeekResult nsOggReader::RollbackIndexedSeek(PRInt64 aOffset) nsOggReader::IndexedSeekResult nsOggReader::SeekToKeyframeUsingIndex(PRInt64 aTarget) { - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream != nsnull, SEEK_FATAL_ERROR); if (!HasSkeleton() || !mSkeletonState->HasIndex()) { return SEEK_INDEX_FAIL; @@ -1014,7 +1014,7 @@ nsresult nsOggReader::Seek(PRInt64 aTarget, NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); nsresult res; - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ENSURE_TRUE(stream != nsnull, NS_ERROR_FAILURE); if (aTarget == aStartTime) { @@ -1139,7 +1139,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget, { NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); nsresult res; - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); if (aTarget == aRange.mTimeStart) { if (NS_FAILED(ResetDecode())) { @@ -1407,7 +1407,7 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime) return NS_OK; } - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); nsTArray ranges; nsresult res = stream->GetCachedRanges(ranges); NS_ENSURE_SUCCESS(res, res); diff --git a/content/media/raw/nsRawReader.cpp b/content/media/raw/nsRawReader.cpp index 603e2c907ab9..f1fb4f8a1103 100644 --- a/content/media/raw/nsRawReader.cpp +++ b/content/media/raw/nsRawReader.cpp @@ -71,7 +71,7 @@ nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo) NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ASSERTION(stream, "Decoder has no media stream"); if (!ReadFromStream(stream, reinterpret_cast(&mMetadata), @@ -189,7 +189,7 @@ bool nsRawReader::DecodeVideoFrame(bool &aKeyframeSkip, PRUint32 length = mFrameSize - sizeof(nsRawPacketHeader); nsAutoArrayPtr buffer(new PRUint8[length]); - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); NS_ASSERTION(stream, "Decoder has no media stream"); // We're always decoding one frame when called @@ -259,7 +259,7 @@ nsresult nsRawReader::Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread."); - nsMediaStream *stream = mDecoder->GetCurrentStream(); + nsMediaStream *stream = mDecoder->GetStream(); NS_ASSERTION(stream, "Decoder has no media stream"); PRUint32 frame = mCurrentFrame; diff --git a/content/media/wave/nsWaveReader.cpp b/content/media/wave/nsWaveReader.cpp index ad9e8fe918c1..9721b4d32dbc 100644 --- a/content/media/wave/nsWaveReader.cpp +++ b/content/media/wave/nsWaveReader.cpp @@ -261,7 +261,7 @@ nsresult nsWaveReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTim PRInt64 position = RoundDownToFrame(static_cast(TimeToBytes(seekTime))); NS_ASSERTION(PR_INT64_MAX - mWavePCMOffset > position, "Integer overflow during wave seek"); position += mWavePCMOffset; - return mDecoder->GetCurrentStream()->Seek(nsISeekableStream::NS_SEEK_SET, position); + return mDecoder->GetStream()->Seek(nsISeekableStream::NS_SEEK_SET, position); } static double RoundToUsecs(double aSeconds) { @@ -270,9 +270,9 @@ static double RoundToUsecs(double aSeconds) { nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime) { - PRInt64 startOffset = mDecoder->GetCurrentStream()->GetNextCachedData(mWavePCMOffset); + PRInt64 startOffset = mDecoder->GetStream()->GetNextCachedData(mWavePCMOffset); while (startOffset >= 0) { - PRInt64 endOffset = mDecoder->GetCurrentStream()->GetCachedDataEnd(startOffset); + PRInt64 endOffset = mDecoder->GetStream()->GetCachedDataEnd(startOffset); // Bytes [startOffset..endOffset] are cached. NS_ASSERTION(startOffset >= mWavePCMOffset, "Integer underflow in GetBuffered"); NS_ASSERTION(endOffset >= mWavePCMOffset, "Integer underflow in GetBuffered"); @@ -282,7 +282,7 @@ nsresult nsWaveReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime) // the media element. aBuffered->Add(RoundToUsecs(BytesToTime(startOffset - mWavePCMOffset)), RoundToUsecs(BytesToTime(endOffset - mWavePCMOffset))); - startOffset = mDecoder->GetCurrentStream()->GetNextCachedData(endOffset); + startOffset = mDecoder->GetStream()->GetNextCachedData(endOffset); } return NS_OK; } @@ -296,7 +296,7 @@ nsWaveReader::ReadAll(char* aBuf, PRInt64 aSize, PRInt64* aBytesRead) } do { PRUint32 read = 0; - if (NS_FAILED(mDecoder->GetCurrentStream()->Read(aBuf + got, PRUint32(aSize - got), &read))) { + if (NS_FAILED(mDecoder->GetStream()->Read(aBuf + got, PRUint32(aSize - got), &read))) { NS_WARNING("Stream read failed"); return false; } @@ -318,7 +318,7 @@ nsWaveReader::LoadRIFFChunk() char riffHeader[RIFF_INITIAL_SIZE]; const char* p = riffHeader; - NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() == 0, + NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() == 0, "LoadRIFFChunk called when stream in invalid state"); if (!ReadAll(riffHeader, sizeof(riffHeader))) { @@ -390,7 +390,7 @@ nsWaveReader::LoadFormatChunk() const char* p = waveFormat; // RIFF chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() % 2 == 0, + NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() % 2 == 0, "LoadFormatChunk called with unaligned stream"); // The "format" chunk may not directly follow the "riff" chunk, so skip @@ -455,7 +455,7 @@ nsWaveReader::LoadFormatChunk() } // RIFF chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() % 2 == 0, + NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() % 2 == 0, "LoadFormatChunk left stream unaligned"); // Make sure metadata is fairly sane. The rate check is fairly arbitrary, @@ -485,7 +485,7 @@ bool nsWaveReader::FindDataOffset() { // RIFF chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetCurrentStream()->Tell() % 2 == 0, + NS_ABORT_IF_FALSE(mDecoder->GetStream()->Tell() % 2 == 0, "FindDataOffset called with unaligned stream"); // The "data" chunk may not directly follow the "format" chunk, so skip @@ -495,7 +495,7 @@ nsWaveReader::FindDataOffset() return false; } - PRInt64 offset = mDecoder->GetCurrentStream()->Tell(); + PRInt64 offset = mDecoder->GetStream()->Tell(); if (offset <= 0 || offset > PR_UINT32_MAX) { NS_WARNING("PCM data offset out of range"); return false; @@ -535,7 +535,7 @@ nsWaveReader::GetDataLength() // If the decoder has a valid content length, and it's shorter than the // expected length of the PCM data, calculate the playback duration from // the content length rather than the expected PCM data length. - PRInt64 streamLength = mDecoder->GetCurrentStream()->GetLength(); + PRInt64 streamLength = mDecoder->GetStream()->GetLength(); if (streamLength >= 0) { PRInt64 dataLength = NS_MAX(0, streamLength - mWavePCMOffset); length = NS_MIN(dataLength, length); @@ -546,5 +546,5 @@ nsWaveReader::GetDataLength() PRInt64 nsWaveReader::GetPosition() { - return mDecoder->GetCurrentStream()->Tell(); + return mDecoder->GetStream()->Tell(); } diff --git a/content/media/webm/nsWebMReader.cpp b/content/media/webm/nsWebMReader.cpp index 546d7baab359..2b156f1d631e 100644 --- a/content/media/webm/nsWebMReader.cpp +++ b/content/media/webm/nsWebMReader.cpp @@ -86,7 +86,7 @@ static int webm_read(void *aBuffer, size_t aLength, void *aUserData) { NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder"); nsBuiltinDecoder* decoder = reinterpret_cast(aUserData); - nsMediaStream* stream = decoder->GetCurrentStream(); + nsMediaStream* stream = decoder->GetStream(); NS_ASSERTION(stream, "Decoder has no media stream"); nsresult rv = NS_OK; @@ -112,7 +112,7 @@ static int webm_seek(int64_t aOffset, int aWhence, void *aUserData) { NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder"); nsBuiltinDecoder* decoder = reinterpret_cast(aUserData); - nsMediaStream* stream = decoder->GetCurrentStream(); + nsMediaStream* stream = decoder->GetStream(); NS_ASSERTION(stream, "Decoder has no media stream"); nsresult rv = stream->Seek(aWhence, aOffset); return NS_SUCCEEDED(rv) ? 0 : -1; @@ -122,7 +122,7 @@ static int64_t webm_tell(void *aUserData) { NS_ASSERTION(aUserData, "aUserData must point to a valid nsBuiltinDecoder"); nsBuiltinDecoder* decoder = reinterpret_cast(aUserData); - nsMediaStream* stream = decoder->GetCurrentStream(); + nsMediaStream* stream = decoder->GetStream(); NS_ASSERTION(stream, "Decoder has no media stream"); return stream->Tell(); } @@ -559,7 +559,7 @@ nsReturnRef nsWebMReader::NextPacket(TrackType aTrackType) if (r <= 0) { return nsReturnRef(); } - PRInt64 offset = mDecoder->GetCurrentStream()->Tell(); + PRInt64 offset = mDecoder->GetStream()->Tell(); holder.own(new NesteggPacketHolder(packet, offset)); unsigned int track = 0; @@ -769,7 +769,7 @@ nsresult nsWebMReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTim nsresult nsWebMReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime) { - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); uint64_t timecodeScale; if (!mContext || nestegg_tstamp_scale(mContext, &timecodeScale) == -1) { @@ -783,7 +783,7 @@ nsresult nsWebMReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime) aBuffered->Add(0, duration / NS_PER_S); } } else { - nsMediaStream* stream = mDecoder->GetCurrentStream(); + nsMediaStream* stream = mDecoder->GetStream(); nsTArray ranges; nsresult res = stream->GetCachedRanges(ranges); NS_ENSURE_SUCCESS(res, res);