Skip to content

Commit 526f4b1

Browse files
authored
Merge pull request #136 from yilun-zhangs/IAMF-OPUS
fix iamf-opus non-48kHz issue
2 parents ab7b196 + 675bab3 commit 526f4b1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

code/src/iamf_dec/IAMF_decoder.c

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,9 @@ static int iamf_codec_conf_get_sampling_rate(IAMF_CodecConf *c) {
626626
if (c->decoder_conf_size < 6) return IAMF_ERR_BAD_ARG;
627627
return reads32be(c->decoder_conf, 2);
628628
} else if (cid == IAMF_CODEC_OPUS) {
629-
if (c->decoder_conf_size < 8) return IAMF_ERR_BAD_ARG;
630-
return reads32be(c->decoder_conf, 4);
629+
// https://aomediacodec.github.io/iamf/v1.1.0.html#opus-specific
630+
// The sample rate used for computing offsets SHALL be 48 kHz.
631+
return 48000;
631632
} else if (cid == IAMF_CODEC_AAC) {
632633
BitStream b;
633634
int ret, type;

code/src/iamf_dec/opus/IAMF_opus_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int iamf_opus_init(IAMF_CodecContext *ths) {
8080
return IAMF_ERR_BAD_ARG;
8181
}
8282

83-
ths->sample_rate = readu32be(config, 4);
83+
ths->sample_rate = 48000; // readu32be(config, 4);
8484
ths->channel_mapping_family = config[10];
8585

8686
ctx->dec = opus_multistream2_decoder_create(ths->sample_rate, ths->streams,

0 commit comments

Comments
 (0)