зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
eabdba0469
Коммит
eba49ebd1c
|
@ -512,6 +512,7 @@ MediaRawData::Clone() const
|
||||||
s->mExtraData = mExtraData;
|
s->mExtraData = mExtraData;
|
||||||
s->mCryptoInternal = mCryptoInternal;
|
s->mCryptoInternal = mCryptoInternal;
|
||||||
s->mTrackInfo = mTrackInfo;
|
s->mTrackInfo = mTrackInfo;
|
||||||
|
s->mEOS = mEOS;
|
||||||
if (!s->mBuffer.Append(mBuffer.Data(), mBuffer.Length())) {
|
if (!s->mBuffer.Append(mBuffer.Data(), mBuffer.Length())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -656,6 +656,10 @@ public:
|
||||||
const CryptoSample& mCrypto;
|
const CryptoSample& mCrypto;
|
||||||
RefPtr<MediaByteBuffer> mExtraData;
|
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;
|
RefPtr<SharedTrackInfo> mTrackInfo;
|
||||||
|
|
||||||
// Return a deep copy or nullptr if out of memory.
|
// Return a deep copy or nullptr if out of memory.
|
||||||
|
|
|
@ -247,6 +247,7 @@ OggCodecState::PacketOutAsMediaRawData()
|
||||||
sample->mTime = end_tstamp - duration;
|
sample->mTime = end_tstamp - duration;
|
||||||
sample->mDuration = duration;
|
sample->mDuration = duration;
|
||||||
sample->mKeyframe = IsKeyframe(packet);
|
sample->mKeyframe = IsKeyframe(packet);
|
||||||
|
sample->mEOS = packet->e_o_s;
|
||||||
|
|
||||||
ReleasePacket(packet);
|
ReleasePacket(packet);
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,8 @@ VorbisDataDecoder::DoDecode(MediaRawData* aSample)
|
||||||
mLastFrameTime = Some(aSample->mTime);
|
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) {
|
if (vorbis_synthesis(&mVorbisBlock, &pkt) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче