Bug 1076691 - Revert the change in bug 762282 since bug 1001317 has landed. r=roc

This commit is contained in:
JW Wang 2014-10-05 19:29:00 +02:00
parent a26dae6439
commit b23bee89cb
6 changed files with 1 additions and 35 deletions

View File

@ -83,7 +83,6 @@ ChannelMediaResource::ChannelMediaResource(MediaDecoder* aDecoder,
mCacheStream(MOZ_THIS_IN_INITIALIZER_LIST()), mCacheStream(MOZ_THIS_IN_INITIALIZER_LIST()),
mLock("ChannelMediaResource.mLock"), mLock("ChannelMediaResource.mLock"),
mIgnoreResume(false), mIgnoreResume(false),
mSeekingForMetadata(false),
mIsTransportSeekable(true) mIsTransportSeekable(true)
{ {
#ifdef PR_LOGGING #ifdef PR_LOGGING
@ -358,11 +357,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
} }
mReopenOnError = false; mReopenOnError = false;
// If we are seeking to get metadata, because we are playing an OGG file, mIgnoreClose = false;
// 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;
if (mSuspendCount > 0) { if (mSuspendCount > 0) {
// Re-suspend the channel if it needs to be suspended // 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); return mCacheStream.Seek(aWhence, aOffset);
} }
void ChannelMediaResource::StartSeekingForMetadata()
{
mSeekingForMetadata = true;
}
void ChannelMediaResource::EndSeekingForMetadata()
{
mSeekingForMetadata = false;
}
int64_t ChannelMediaResource::Tell() int64_t ChannelMediaResource::Tell()
{ {
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread"); NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
@ -1231,8 +1216,6 @@ public:
virtual nsresult ReadAt(int64_t aOffset, char* aBuffer, virtual nsresult ReadAt(int64_t aOffset, char* aBuffer,
uint32_t aCount, uint32_t* aBytes); uint32_t aCount, uint32_t* aBytes);
virtual nsresult Seek(int32_t aWhence, int64_t aOffset); virtual nsresult Seek(int32_t aWhence, int64_t aOffset);
virtual void StartSeekingForMetadata() {};
virtual void EndSeekingForMetadata() {};
virtual int64_t Tell(); virtual int64_t Tell();
// Any thread // Any thread

View File

@ -311,8 +311,6 @@ public:
// The file strategy doesn't block for any great length of time so // The file strategy doesn't block for any great length of time so
// is fine for a no-op cancel. // is fine for a no-op cancel.
virtual nsresult Seek(int32_t aWhence, int64_t aOffset) = 0; 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. // Report the current offset in bytes from the start of the stream.
virtual int64_t Tell() = 0; virtual int64_t Tell() = 0;
// Moves any existing channel loads into the background, so that they don't // 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, virtual nsresult ReadAt(int64_t offset, char* aBuffer,
uint32_t aCount, uint32_t* aBytes); uint32_t aCount, uint32_t* aBytes);
virtual nsresult Seek(int32_t aWhence, int64_t aOffset); virtual nsresult Seek(int32_t aWhence, int64_t aOffset);
virtual void StartSeekingForMetadata();
virtual void EndSeekingForMetadata();
virtual int64_t Tell(); virtual int64_t Tell();
// Any thread // Any thread
@ -714,9 +710,6 @@ protected:
// isPending state at the time of the suspend request. // isPending state at the time of the suspend request.
bool mIgnoreResume; 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. // Start and end offset of the bytes to be requested.
MediaByteRange mByteRange; MediaByteRange mByteRange;

View File

@ -131,10 +131,6 @@ public:
return NS_OK; return NS_OK;
} }
// dummy // dummy
virtual void StartSeekingForMetadata() MOZ_OVERRIDE {}
// dummy
virtual void EndSeekingForMetadata() MOZ_OVERRIDE {}
// dummy
virtual int64_t Tell() MOZ_OVERRIDE { return 0; } virtual int64_t Tell() MOZ_OVERRIDE { return 0; }
// Any thread // Any thread

View File

@ -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 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 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 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 int64_t Tell() MOZ_OVERRIDE { UNIMPLEMENTED(); return -1; }
virtual void Pin() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void Pin() MOZ_OVERRIDE { UNIMPLEMENTED(); }
virtual void Unpin() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void Unpin() MOZ_OVERRIDE { UNIMPLEMENTED(); }

View File

@ -57,8 +57,6 @@ public:
virtual nsresult Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) MOZ_OVERRIDE; 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 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 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 int64_t Tell() MOZ_OVERRIDE { return mOffset; }
virtual void Pin() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void Pin() MOZ_OVERRIDE { UNIMPLEMENTED(); }
virtual void Unpin() MOZ_OVERRIDE { UNIMPLEMENTED(); } virtual void Unpin() MOZ_OVERRIDE { UNIMPLEMENTED(); }

View File

@ -489,7 +489,6 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo,
{ {
// We didn't get a duration from the index or a Content-Duration header. // 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. // Seek to the end of file to find the end time.
mDecoder->GetResource()->StartSeekingForMetadata();
int64_t length = resource->GetLength(); int64_t length = resource->GetLength();
NS_ASSERTION(length > 0, "Must have a content length to get end time"); 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); mDecoder->SetMediaEndTime(endTime);
LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime)); LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime));
} }
mDecoder->GetResource()->EndSeekingForMetadata();
} }
} else { } else {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;