mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 650157 - Push nsBuiltinDecoderReader::mDataOffset down into nsOggReader. r=doublec
This commit is contained in:
parent
74ff849e2d
commit
5d950fcb8f
@ -208,8 +208,7 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo,
|
||||
|
||||
nsBuiltinDecoderReader::nsBuiltinDecoderReader(nsBuiltinDecoder* aDecoder)
|
||||
: mMonitor("media.decoderreader"),
|
||||
mDecoder(aDecoder),
|
||||
mDataOffset(0)
|
||||
mDecoder(aDecoder)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsBuiltinDecoderReader);
|
||||
}
|
||||
|
@ -92,10 +92,6 @@ public:
|
||||
// to and displayed at this size.
|
||||
nsIntSize mDisplay;
|
||||
|
||||
// The offset of the first non-header page in the file, in bytes.
|
||||
// Used to seek to the start of the media.
|
||||
PRInt64 mDataOffset;
|
||||
|
||||
// Indicates the frame layout for single track stereo videos.
|
||||
mozilla::layers::StereoMode mStereoMode;
|
||||
|
||||
@ -513,10 +509,6 @@ protected:
|
||||
// reader's monitor when accessing this.
|
||||
nsBuiltinDecoder* mDecoder;
|
||||
|
||||
// The offset of the start of the first non-header page in the file.
|
||||
// Used to seek to media start time.
|
||||
PRInt64 mDataOffset;
|
||||
|
||||
// Stores presentation info required for playback. The reader's monitor
|
||||
// must be held when accessing this.
|
||||
nsVideoInfo mInfo;
|
||||
|
@ -1557,10 +1557,9 @@ VideoData* nsBuiltinDecoderStateMachine::FindStartTime()
|
||||
PRInt64 startTime = 0;
|
||||
mStartTime = 0;
|
||||
VideoData* v = nsnull;
|
||||
PRInt64 dataOffset = mInfo.mDataOffset;
|
||||
{
|
||||
MonitorAutoExit exitMon(mDecoder->GetMonitor());
|
||||
v = mReader->FindStartTime(dataOffset, startTime);
|
||||
v = mReader->FindStartTime(0, startTime);
|
||||
}
|
||||
if (startTime != 0) {
|
||||
mStartTime = startTime;
|
||||
|
@ -107,7 +107,8 @@ nsOggReader::nsOggReader(nsBuiltinDecoder* aDecoder)
|
||||
mTheoraSerial(0),
|
||||
mPageOffset(0),
|
||||
mTheoraGranulepos(-1),
|
||||
mVorbisGranulepos(-1)
|
||||
mVorbisGranulepos(-1),
|
||||
mDataOffset(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsOggReader);
|
||||
}
|
||||
@ -324,7 +325,6 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
mInfo.mDisplay = nsIntSize(mInfo.mPicture.width,
|
||||
mInfo.mPicture.height);
|
||||
}
|
||||
mInfo.mDataOffset = mDataOffset;
|
||||
|
||||
if (mSkeletonState && mSkeletonState->HasIndex()) {
|
||||
// Extract the duration info out of the index, so we don't need to seek to
|
||||
@ -906,9 +906,13 @@ VideoData* nsOggReader::FindStartTime(PRInt64 aOffset,
|
||||
"Should be on state machine thread.");
|
||||
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||
NS_ENSURE_TRUE(stream != nsnull, nsnull);
|
||||
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
|
||||
// Ensure aOffset is after mDataOffset, the offset of the first non-header page.
|
||||
// This prevents us from trying to parse header pages as content pages.
|
||||
NS_ASSERTION(mDataOffset > 0, "Must know mDataOffset by now");
|
||||
PRInt64 offset = NS_MAX(mDataOffset, aOffset);
|
||||
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, offset);
|
||||
NS_ENSURE_SUCCESS(res, nsnull);
|
||||
return nsBuiltinDecoderReader::FindStartTime(aOffset, aOutStartTime);
|
||||
return nsBuiltinDecoderReader::FindStartTime(offset, aOutStartTime);
|
||||
}
|
||||
|
||||
PRInt64 nsOggReader::FindEndTime(PRInt64 aEndOffset)
|
||||
@ -918,7 +922,8 @@ PRInt64 nsOggReader::FindEndTime(PRInt64 aEndOffset)
|
||||
"Should be on state machine thread.");
|
||||
NS_ASSERTION(mDataOffset > 0,
|
||||
"Should have offset of first non-header page");
|
||||
PRInt64 endTime = FindEndTime(mDataOffset, aEndOffset, PR_FALSE, &mOggState);
|
||||
PRInt64 offset = NS_MAX(mDataOffset, aEndOffset);
|
||||
PRInt64 endTime = FindEndTime(mDataOffset, offset, PR_FALSE, &mOggState);
|
||||
// Reset read head to start of media data.
|
||||
nsMediaStream* stream = mDecoder->GetCurrentStream();
|
||||
NS_ENSURE_TRUE(stream != nsnull, -1);
|
||||
|
@ -282,6 +282,11 @@ private:
|
||||
|
||||
// The granulepos of the last decoded Vorbis sample.
|
||||
PRInt64 mVorbisGranulepos;
|
||||
|
||||
// The offset of the first non-header page in the file, in bytes.
|
||||
// Used to seek to the start of the media, and to prevent us trying to
|
||||
// decode pages before this offset (the header pages) as content pages.
|
||||
PRInt64 mDataOffset;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -112,7 +112,6 @@ public:
|
||||
|
||||
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);
|
||||
virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime);
|
||||
virtual PRInt64 FindEndTime(PRInt64 aEndOffset);
|
||||
virtual nsresult GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime);
|
||||
|
||||
private:
|
||||
|
@ -164,7 +164,6 @@ nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
mInfo.mHasVideo = PR_FALSE;
|
||||
mInfo.mAudioRate = mSampleRate;
|
||||
mInfo.mAudioChannels = mChannels;
|
||||
mInfo.mDataOffset = -1;
|
||||
|
||||
*aInfo = mInfo;
|
||||
|
||||
|
@ -330,11 +330,6 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
|
||||
mInfo.mStereoMode = STEREO_MODE_MONO;
|
||||
}
|
||||
}
|
||||
|
||||
// mDataOffset is not used by the WebM backend.
|
||||
// See bug 566779 for a suggestion to refactor
|
||||
// and remove it.
|
||||
mInfo.mDataOffset = -1;
|
||||
}
|
||||
else if (!mHasAudio && type == NESTEGG_TRACK_AUDIO) {
|
||||
nestegg_audio_params params;
|
||||
|
Loading…
Reference in New Issue
Block a user