Bug 1288329: [ogg/vorbis] P2. Pass extra information to the decoder so that it can perform proper trimmer. r=gerald,jwwang

The OggReader always passed a complete ogg_packet to the vorbis decoder, ensuring that the right number of frames was be returned. In the conversion to the new architecture, this information got lost making the vorbis decoder always return more frames than normal on the last packet.

MozReview-Commit-ID: HYHxqXfYntJ

--HG--
extra : rebase_source : 3d2a59b011ec1e996ab7aaf29e16baa495f7d31c
This commit is contained in:
Jean-Yves Avenard 2016-07-29 02:19:21 +10:00
parent 49ac56ce9a
commit 5d0a764769
4 changed files with 8 additions and 1 deletions

View File

@ -512,6 +512,7 @@ MediaRawData::Clone() const
s->mExtraData = mExtraData;
s->mCryptoInternal = mCryptoInternal;
s->mTrackInfo = mTrackInfo;
s->mEOS = mEOS;
if (!s->mBuffer.Append(mBuffer.Data(), mBuffer.Length())) {
return nullptr;
}

View File

@ -656,6 +656,10 @@ public:
const CryptoSample& mCrypto;
RefPtr<MediaByteBuffer> mExtraData;
// Used by the Vorbis decoder and Ogg demuxer.
// Indicates that this is the last packet of the stream.
bool mEOS = false;
RefPtr<SharedTrackInfo> mTrackInfo;
// Return a deep copy or nullptr if out of memory.

View File

@ -247,6 +247,7 @@ OggCodecState::PacketOutAsMediaRawData()
sample->mTime = end_tstamp - duration;
sample->mDuration = duration;
sample->mKeyframe = IsKeyframe(packet);
sample->mEOS = packet->e_o_s;
ReleasePacket(packet);

View File

@ -167,7 +167,8 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample)
mLastFrameTime = Some(aSample->mTime);
}
ogg_packet pkt = InitVorbisPacket(aData, aLength, false, false, -1, mPacketCount++);
ogg_packet pkt = InitVorbisPacket(aData, aLength, false, aSample->mEOS,
aSample->mTimecode, mPacketCount++);
if (vorbis_synthesis(&mVorbisBlock, &pkt) != 0) {
return -1;