author | JW Wang <jwwang@mozilla.com> |
Sun, 05 Oct 2014 19:29:00 +0200 | |
changeset 232138 | 5f13639d2f126da7e774723b94f537ce30529f11 |
parent 232137 | a799b8e48161c3ac3f11cece3036747dc5f23960 |
child 232139 | 314fd7709123e77ae8fd22faae5530c108535a21 |
push id | 4187 |
push user | bhearsum@mozilla.com |
push date | Fri, 28 Nov 2014 15:29:12 +0000 |
treeherder | mozilla-beta@f23cc6a30c11 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | roc |
bugs | 1076691, 762282, 1001317 |
milestone | 35.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/media/MediaResource.cpp +++ b/content/media/MediaResource.cpp @@ -78,17 +78,16 @@ ChannelMediaResource::ChannelMediaResour nsIURI* aURI, const nsACString& aContentType) : BaseMediaResource(aDecoder, aChannel, aURI, aContentType), mOffset(0), mSuspendCount(0), mReopenOnError(false), mIgnoreClose(false), mCacheStream(MOZ_THIS_IN_INITIALIZER_LIST()), mLock("ChannelMediaResource.mLock"), mIgnoreResume(false), - mSeekingForMetadata(false), mIsTransportSeekable(true) { #ifdef PR_LOGGING if (!gMediaResourceLog) { gMediaResourceLog = PR_NewLogModule("MediaResource"); } #endif } @@ -353,21 +352,17 @@ ChannelMediaResource::OnStartRequest(nsI { MutexAutoLock lock(mLock); mIsTransportSeekable = seekable; mChannelStatistics->Start(); } 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 // No need to call PossiblySuspend here since the channel is // definitely in the right state for us in OnStartRequest. mChannel->Suspend(); mIgnoreResume = false; } @@ -803,26 +798,16 @@ nsresult ChannelMediaResource::Seek(int3 { NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread"); CMLOG("Seek requested for aOffset [%lld] for decoder [%p]", aOffset, mDecoder); 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"); return mCacheStream.Tell(); } nsresult ChannelMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges) @@ -1226,18 +1211,16 @@ public: // Other thread virtual void SetReadMode(MediaCacheStream::ReadMode aMode) {} virtual void SetPlaybackRate(uint32_t aBytesPerSecond) {} virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes); 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 virtual void Pin() {} virtual void Unpin() {} virtual double GetDownloadRate(bool* aIsReliable) { // The data's all already here
--- a/content/media/MediaResource.h +++ b/content/media/MediaResource.h @@ -306,18 +306,16 @@ public: // // The default strategy does not do any seeking - the only issue is // a blocked read which it handles by causing the listener to close // the pipe, as per the http case. // // 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 // block the load event. Any new loads initiated (for example to seek) // will also be in the background. virtual void MoveLoadsToBackground() {} // Ensures that the value returned by IsSuspendedByCache below is up to date // (i.e. the cache has examined this stream at least once). @@ -583,18 +581,16 @@ public: // Other thread virtual void SetReadMode(MediaCacheStream::ReadMode aMode); virtual void SetPlaybackRate(uint32_t aBytesPerSecond); virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes); 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 virtual void Pin(); virtual void Unpin(); virtual double GetDownloadRate(bool* aIsReliable); virtual int64_t GetLength(); virtual int64_t GetNextCachedData(int64_t aOffset); @@ -709,19 +705,16 @@ protected: Mutex mLock; nsRefPtr<MediaChannelStatistics> mChannelStatistics; // True if we couldn't suspend the stream and we therefore don't want // to resume later. This is usually due to the channel not being in the // 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; // True if the stream can seek into unbuffered ranged, i.e. if the // connection supports byte range requests. bool mIsTransportSeekable; };
--- a/content/media/RtspMediaResource.h +++ b/content/media/RtspMediaResource.h @@ -126,20 +126,16 @@ public: MOZ_OVERRIDE { return NS_OK; } // dummy virtual nsresult Seek(int32_t aWhence, int64_t aOffset) MOZ_OVERRIDE { 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 virtual void Pin() MOZ_OVERRIDE {} virtual void Unpin() MOZ_OVERRIDE {} virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return mIsSuspend; }
--- a/content/media/mediasource/MediaSourceResource.h +++ b/content/media/mediasource/MediaSourceResource.h @@ -34,18 +34,16 @@ public: virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() MOZ_OVERRIDE { UNIMPLEMENTED(); return nullptr; } virtual bool CanClone() MOZ_OVERRIDE { UNIMPLEMENTED(); return false; } virtual already_AddRefed<MediaResource> CloneData(MediaDecoder* aDecoder) MOZ_OVERRIDE { UNIMPLEMENTED(); return nullptr; } virtual void SetReadMode(MediaCacheStream::ReadMode aMode) MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void SetPlaybackRate(uint32_t aBytesPerSecond) MOZ_OVERRIDE { UNIMPLEMENTED(); } 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(); } virtual double GetDownloadRate(bool* aIsReliable) MOZ_OVERRIDE { UNIMPLEMENTED(); *aIsReliable = false; return 0; } virtual int64_t GetLength() MOZ_OVERRIDE { UNIMPLEMENTED(); return -1; } virtual int64_t GetNextCachedData(int64_t aOffset) MOZ_OVERRIDE { UNIMPLEMENTED(); return -1; } virtual int64_t GetCachedDataEnd(int64_t aOffset) MOZ_OVERRIDE { UNIMPLEMENTED(); return -1; } virtual bool IsDataCachedToEndOfResource(int64_t aOffset) MOZ_OVERRIDE { UNIMPLEMENTED(); return false; }
--- a/content/media/mediasource/SourceBufferResource.h +++ b/content/media/mediasource/SourceBufferResource.h @@ -52,18 +52,16 @@ public: virtual void Resume() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() MOZ_OVERRIDE { UNIMPLEMENTED(); return nullptr; } virtual already_AddRefed<MediaResource> CloneData(MediaDecoder* aDecoder) MOZ_OVERRIDE { UNIMPLEMENTED(); return nullptr; } virtual void SetReadMode(MediaCacheStream::ReadMode aMode) MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void SetPlaybackRate(uint32_t aBytesPerSecond) MOZ_OVERRIDE { UNIMPLEMENTED(); } 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(); } virtual double GetDownloadRate(bool* aIsReliable) MOZ_OVERRIDE { UNIMPLEMENTED(); *aIsReliable = false; return 0; } virtual int64_t GetLength() MOZ_OVERRIDE { return mInputBuffer.GetLength(); } virtual int64_t GetNextCachedData(int64_t aOffset) MOZ_OVERRIDE { ReentrantMonitorAutoEnter mon(mMonitor); MOZ_ASSERT(aOffset >= 0);
--- a/content/media/ogg/OggReader.cpp +++ b/content/media/ogg/OggReader.cpp @@ -484,31 +484,29 @@ nsresult OggReader::ReadMetadata(MediaIn MediaResource* resource = mDecoder->GetResource(); if (mDecoder->GetMediaDuration() == -1 && !mDecoder->IsShutdown() && resource->GetLength() >= 0 && mDecoder->IsMediaSeekable()) { // 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"); int64_t endTime = 0; { ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor()); endTime = RangeEndTime(length); } if (endTime != -1) { mDecoder->SetMediaEndTime(endTime); LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime)); } - mDecoder->GetResource()->EndSeekingForMetadata(); } } else { return NS_ERROR_FAILURE; } *aInfo = mInfo; return NS_OK; }