mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1240201: [opus] P2. Properly determine sample duration and time in webm demuxer. r=kinetik
This commit is contained in:
parent
b1525f0117
commit
c0c2bb479c
@ -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 {
|
||||
@ -573,6 +575,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;
|
||||
}
|
||||
@ -606,7 +619,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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user