mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Bug 1482841 - P2. Fix opus in mp4 decoding. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D3233
This commit is contained in:
parent
caf8ead5fc
commit
5f024b5f70
@ -74,12 +74,16 @@ MP4AudioInfo::Update(const Mp4parseTrackInfo* track,
|
||||
// The Opus decoder expects the container's codec delay or
|
||||
// pre-skip value, in microseconds, as a 64-bit int at the
|
||||
// start of the codec-specific config blob.
|
||||
MOZ_ASSERT(audio->extra_data.data);
|
||||
MOZ_ASSERT(audio->extra_data.length >= 12);
|
||||
uint16_t preskip =
|
||||
mozilla::LittleEndian::readUint16(audio->extra_data.data + 10);
|
||||
mozilla::OpusDataDecoder::AppendCodecDelay(mCodecSpecificConfig,
|
||||
mozilla::FramesToUsecs(preskip, 48000).value());
|
||||
if (audio->codec_specific_config.data &&
|
||||
audio->codec_specific_config.length >= 12) {
|
||||
uint16_t preskip = mozilla::LittleEndian::readUint16(
|
||||
audio->codec_specific_config.data + 10);
|
||||
mozilla::OpusDataDecoder::AppendCodecDelay(
|
||||
mCodecSpecificConfig, mozilla::FramesToUsecs(preskip, 48000).value());
|
||||
} else {
|
||||
// This file will error later as it will be rejected by the opus decoder.
|
||||
mozilla::OpusDataDecoder::AppendCodecDelay(mCodecSpecificConfig, 0);
|
||||
}
|
||||
} else if (track->codec == MP4PARSE_CODEC_AAC) {
|
||||
mMimeType = NS_LITERAL_CSTRING("audio/mp4a-latm");
|
||||
} else if (track->codec == MP4PARSE_CODEC_FLAC) {
|
||||
|
@ -283,6 +283,8 @@ var gPlayTests = [
|
||||
// Ambisonics AAC, requires AAC extradata to be set when creating decoder (see bug 1431169)
|
||||
// Also test 4.0 decoding.
|
||||
{ name:"ambisonics.mp4", type:"audio/mp4", duration:16.48 },
|
||||
// Opus in MP4 channel mapping=0 sample file
|
||||
{ name:"opus-sample.mp4", type:"audio/mp4; codecs=opus", duration:10.92 },
|
||||
|
||||
{ name:"small-shot.m4a", type:"audio/mp4", duration:0.29 },
|
||||
{ name:"small-shot.mp3", type:"audio/mpeg", duration:0.27 },
|
||||
|
@ -506,6 +506,8 @@ support-files =
|
||||
no-cues.webm^headers^
|
||||
notags.mp3
|
||||
notags.mp3^headers^
|
||||
opus-sample.mp4
|
||||
opus-sample.mp4^headers^
|
||||
owl-funnier-id3.mp3
|
||||
owl-funnier-id3.mp3^headers^
|
||||
owl-funny-id3.mp3
|
||||
|
BIN
dom/media/test/opus-sample.mp4
Normal file
BIN
dom/media/test/opus-sample.mp4
Normal file
Binary file not shown.
1
dom/media/test/opus-sample.mp4^headers^
Normal file
1
dom/media/test/opus-sample.mp4^headers^
Normal file
@ -0,0 +1 @@
|
||||
Cache-Control: no-store
|
Loading…
Reference in New Issue
Block a user