зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1240201: [opus] P2. Properly determine sample duration and time in webm demuxer. r=kinetik
This commit is contained in:
Родитель
9b20eae811
Коммит
6369bae28e
|
@ -29,6 +29,8 @@
|
|||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
|
||||
#include <opus/opus.h>
|
||||
|
||||
#define WEBM_DEBUG(arg, ...) MOZ_LOG(gWebMDemuxerLog, mozilla::LogLevel::Debug, ("WebMDemuxer(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -578,6 +580,17 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
|
|||
FramesToTimeUnit(nsamples, mInfo.mAudio.mRate).ToMicroseconds();
|
||||
break;
|
||||
}
|
||||
case NESTEGG_CODEC_OPUS:
|
||||
{
|
||||
int nsamples =
|
||||
opus_packet_get_nb_samples(data, length, mInfo.mAudio.mRate);
|
||||
if (nsamples < 0) {
|
||||
return false;
|
||||
}
|
||||
duration =
|
||||
FramesToTimeUnit(nsamples, mInfo.mAudio.mRate).ToMicroseconds();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -612,7 +625,8 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
|
|||
sample->mExtraData->AppendElements(&c[0], 8);
|
||||
}
|
||||
aSamples->Push(sample);
|
||||
if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
|
||||
if (mAudioCodec == NESTEGG_CODEC_VORBIS ||
|
||||
mAudioCodec == NESTEGG_CODEC_OPUS) {
|
||||
tstamp += duration;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче