Bug 566501 - Remove unnecessary seek from the video decoder base class. r=cpearce

This commit is contained in:
Chris Double 2010-05-21 09:13:01 +12:00
parent 5b7c6059a4
commit 264f50b5de
5 changed files with 18 additions and 11 deletions

View File

@ -266,9 +266,6 @@ VideoData* nsBuiltinDecoderReader::FindStartTime(PRInt64 aOffset,
{
NS_ASSERTION(mDecoder->OnStateMachineThread(), "Should be on state machine thread.");
nsMediaStream* stream = mDecoder->GetCurrentStream();
stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
if (NS_FAILED(ResetDecode())) {
return nsnull;
}

View File

@ -429,8 +429,8 @@ public:
// Stores the presentation time of the first sample in the stream in
// aOutStartTime, and returns the first video sample, if we have video.
VideoData* FindStartTime(PRInt64 aOffset,
PRInt64& aOutStartTime);
virtual VideoData* FindStartTime(PRInt64 aOffset,
PRInt64& aOutStartTime);
// Returns the end time of the last page which occurs before aEndOffset.
// This will not read past aEndOffset. Returns -1 on failure.

View File

@ -1213,12 +1213,6 @@ void nsBuiltinDecoderStateMachine::FindEndTime()
mEndTime = endTime;
}
NS_ASSERTION(mReader->GetInfo().mDataOffset > 0,
"Should have offset of first non-header page");
{
MonitorAutoExit exitMon(mDecoder->GetMonitor());
stream->Seek(nsISeekableStream::NS_SEEK_SET, mReader->GetInfo().mDataOffset);
}
LOG(PR_LOG_DEBUG, ("%p Media end time is %lldms", mDecoder, mEndTime));
}

View File

@ -800,6 +800,16 @@ GetChecksum(ogg_page* page)
return c;
}
VideoData* nsOggReader::FindStartTime(PRInt64 aOffset,
PRInt64& aOutStartTime)
{
NS_ASSERTION(mDecoder->OnStateMachineThread(), "Should be on state machine thread.");
nsMediaStream* stream = mDecoder->GetCurrentStream();
stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
return nsBuiltinDecoderReader::FindStartTime(aOffset, aOutStartTime);
}
PRInt64 nsOggReader::FindEndTime(PRInt64 aEndOffset)
{
MonitorAutoEnter mon(mMonitor);
@ -914,6 +924,10 @@ PRInt64 nsOggReader::FindEndTime(PRInt64 aEndOffset)
ogg_sync_reset(&mOggState);
NS_ASSERTION(mDataOffset > 0,
"Should have offset of first non-header page");
stream->Seek(nsISeekableStream::NS_SEEK_SET, mDataOffset);
return endTime;
}

View File

@ -62,6 +62,8 @@ public:
// read have valid time info.
virtual PRBool DecodeVideoFrame(PRBool &aKeyframeSkip,
PRInt64 aTimeThreshold);
virtual VideoData* FindStartTime(PRInt64 aOffset,
PRInt64& aOutStartTime);
virtual PRInt64 FindEndTime(PRInt64 aEndOffset);
virtual PRBool HasAudio()