From b23bee89cb558d7d80375a8384aa1a05e90c72a2 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Sun, 5 Oct 2014 19:29:00 +0200 Subject: [PATCH] Bug 1076691 - Revert the change in bug 762282 since bug 1001317 has landed. r=roc --- content/media/MediaResource.cpp | 19 +------------------ content/media/MediaResource.h | 7 ------- content/media/RtspMediaResource.h | 4 ---- .../media/mediasource/MediaSourceResource.h | 2 -- .../media/mediasource/SourceBufferResource.h | 2 -- content/media/ogg/OggReader.cpp | 2 -- 6 files changed, 1 insertion(+), 35 deletions(-) diff --git a/content/media/MediaResource.cpp b/content/media/MediaResource.cpp index 0864c91dbe4..194734fc68f 100644 --- a/content/media/MediaResource.cpp +++ b/content/media/MediaResource.cpp @@ -83,7 +83,6 @@ ChannelMediaResource::ChannelMediaResource(MediaDecoder* aDecoder, mCacheStream(MOZ_THIS_IN_INITIALIZER_LIST()), mLock("ChannelMediaResource.mLock"), mIgnoreResume(false), - mSeekingForMetadata(false), mIsTransportSeekable(true) { #ifdef PR_LOGGING @@ -358,11 +357,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest) } mReopenOnError = false; - // If we are seeking to get metadata, because we are playing an OGG file, - // ignore if the channel gets closed without us suspending it explicitly. We - // don't want to tell the element that the download has finished whereas we - // just happended to have reached the end of the media while seeking. - mIgnoreClose = mSeekingForMetadata; + mIgnoreClose = false; if (mSuspendCount > 0) { // Re-suspend the channel if it needs to be suspended @@ -808,16 +803,6 @@ nsresult ChannelMediaResource::Seek(int32_t aWhence, int64_t aOffset) return mCacheStream.Seek(aWhence, aOffset); } -void ChannelMediaResource::StartSeekingForMetadata() -{ - mSeekingForMetadata = true; -} - -void ChannelMediaResource::EndSeekingForMetadata() -{ - mSeekingForMetadata = false; -} - int64_t ChannelMediaResource::Tell() { NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread"); @@ -1231,8 +1216,6 @@ public: virtual nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes); virtual nsresult Seek(int32_t aWhence, int64_t aOffset); - virtual void StartSeekingForMetadata() {}; - virtual void EndSeekingForMetadata() {}; virtual int64_t Tell(); // Any thread diff --git a/content/media/MediaResource.h b/content/media/MediaResource.h index dd56211d874..f9ff63b5ef3 100644 --- a/content/media/MediaResource.h +++ b/content/media/MediaResource.h @@ -311,8 +311,6 @@ public: // The file strategy doesn't block for any great length of time so // is fine for a no-op cancel. virtual nsresult Seek(int32_t aWhence, int64_t aOffset) = 0; - virtual void StartSeekingForMetadata() = 0; - virtual void EndSeekingForMetadata() = 0; // Report the current offset in bytes from the start of the stream. virtual int64_t Tell() = 0; // Moves any existing channel loads into the background, so that they don't @@ -588,8 +586,6 @@ public: virtual nsresult ReadAt(int64_t offset, char* aBuffer, uint32_t aCount, uint32_t* aBytes); virtual nsresult Seek(int32_t aWhence, int64_t aOffset); - virtual void StartSeekingForMetadata(); - virtual void EndSeekingForMetadata(); virtual int64_t Tell(); // Any thread @@ -714,9 +710,6 @@ protected: // isPending state at the time of the suspend request. bool mIgnoreResume; - // True if we are seeking to get the real duration of the file. - bool mSeekingForMetadata; - // Start and end offset of the bytes to be requested. MediaByteRange mByteRange; diff --git a/content/media/RtspMediaResource.h b/content/media/RtspMediaResource.h index bb59073f890..934fbc6efd7 100644 --- a/content/media/RtspMediaResource.h +++ b/content/media/RtspMediaResource.h @@ -131,10 +131,6 @@ public: return NS_OK; } // dummy - virtual void StartSeekingForMetadata() MOZ_OVERRIDE {} - // dummy - virtual void EndSeekingForMetadata() MOZ_OVERRIDE {} - // dummy virtual int64_t Tell() MOZ_OVERRIDE { return 0; } // Any thread diff --git a/content/media/mediasource/MediaSourceResource.h b/content/media/mediasource/MediaSourceResource.h index 8c9eba4dcbf..8d602a4b617 100644 --- a/content/media/mediasource/MediaSourceResource.h +++ b/content/media/mediasource/MediaSourceResource.h @@ -39,8 +39,6 @@ public: virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE { UNIMPLEMENTED(); return NS_ERROR_FAILURE; } virtual nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE { UNIMPLEMENTED(); return NS_ERROR_FAILURE; } virtual nsresult Seek(int32_t aWhence, int64_t aOffset) MOZ_OVERRIDE { UNIMPLEMENTED(); return NS_ERROR_FAILURE; } - virtual void StartSeekingForMetadata() MOZ_OVERRIDE { UNIMPLEMENTED(); } - virtual void EndSeekingForMetadata() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual int64_t Tell() MOZ_OVERRIDE { UNIMPLEMENTED(); return -1; } virtual void Pin() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void Unpin() MOZ_OVERRIDE { UNIMPLEMENTED(); } diff --git a/content/media/mediasource/SourceBufferResource.h b/content/media/mediasource/SourceBufferResource.h index e8c0fa912a6..74b4805d9d8 100644 --- a/content/media/mediasource/SourceBufferResource.h +++ b/content/media/mediasource/SourceBufferResource.h @@ -57,8 +57,6 @@ public: virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE; virtual nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE; virtual nsresult Seek(int32_t aWhence, int64_t aOffset) MOZ_OVERRIDE; - virtual void StartSeekingForMetadata() MOZ_OVERRIDE { UNIMPLEMENTED(); } - virtual void EndSeekingForMetadata() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual int64_t Tell() MOZ_OVERRIDE { return mOffset; } virtual void Pin() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void Unpin() MOZ_OVERRIDE { UNIMPLEMENTED(); } diff --git a/content/media/ogg/OggReader.cpp b/content/media/ogg/OggReader.cpp index d7eff58e5f7..e0b52df3658 100644 --- a/content/media/ogg/OggReader.cpp +++ b/content/media/ogg/OggReader.cpp @@ -489,7 +489,6 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo, { // We didn't get a duration from the index or a Content-Duration header. // Seek to the end of file to find the end time. - mDecoder->GetResource()->StartSeekingForMetadata(); int64_t length = resource->GetLength(); NS_ASSERTION(length > 0, "Must have a content length to get end time"); @@ -503,7 +502,6 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo, mDecoder->SetMediaEndTime(endTime); LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime)); } - mDecoder->GetResource()->EndSeekingForMetadata(); } } else { return NS_ERROR_FAILURE;