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 : 3aa215576fe77357dd9a484626c0e5759aeedb3c
This commit is contained in:
Jean-Yves Avenard 2016-07-29 02:19:21 +10:00
Родитель eabdba0469
Коммит eba49ebd1c
4 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;