Skip to content

Commit 9b10599

Browse files
authored
Fixed Opus decoder PLC setting (#4015)
1 parent ca43d10 commit 9b10599

File tree

1 file changed

+6
-2
lines changed
  • pjmedia/src/pjmedia-codec

1 file changed

+6
-2
lines changed

pjmedia/src/pjmedia-codec/opus.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ static pj_status_t codec_open( pjmedia_codec *codec,
641641
struct opus_data *opus_data = (struct opus_data *)codec->codec_data;
642642
int idx, err;
643643
pj_bool_t auto_bit_rate = PJ_TRUE;
644+
pj_bool_t enc_use_plc = PJ_FALSE;
644645

645646
PJ_ASSERT_RETURN(codec && attr && opus_data, PJ_EINVAL);
646647

@@ -697,7 +698,10 @@ static pj_status_t codec_open( pjmedia_codec *codec,
697698
if (idx >= 0) {
698699
unsigned plc;
699700
plc = (unsigned) pj_strtoul(&attr->setting.enc_fmtp.param[idx].val);
700-
attr->setting.plc = plc > 0? PJ_TRUE: PJ_FALSE;
701+
if (plc > 0)
702+
enc_use_plc = PJ_TRUE;
703+
/* Do not modify local PLC setting as it's used for decoding. */
704+
// attr->setting.plc = plc > 0? PJ_TRUE: PJ_FALSE
701705
}
702706

703707
/* Check vad */
@@ -750,7 +754,7 @@ static pj_status_t codec_open( pjmedia_codec *codec,
750754
opus_encoder_ctl(opus_data->enc, OPUS_SET_DTX(attr->setting.vad ? 1 : 0));
751755
/* Set PLC */
752756
opus_encoder_ctl(opus_data->enc,
753-
OPUS_SET_INBAND_FEC(attr->setting.plc ? 1 : 0));
757+
OPUS_SET_INBAND_FEC(enc_use_plc));
754758
/* Set bandwidth */
755759
opus_encoder_ctl(opus_data->enc,
756760
OPUS_SET_MAX_BANDWIDTH(get_opus_bw_constant(

0 commit comments

Comments
 (0)