Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Opus decoder PLC setting #4015

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pjmedia/src/pjmedia-codec/opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ static pj_status_t codec_open( pjmedia_codec *codec,
struct opus_data *opus_data = (struct opus_data *)codec->codec_data;
int idx, err;
pj_bool_t auto_bit_rate = PJ_TRUE;
pj_bool_t enc_use_plc = PJ_FALSE;

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

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

/* Check vad */
Expand Down Expand Up @@ -750,7 +754,7 @@ static pj_status_t codec_open( pjmedia_codec *codec,
opus_encoder_ctl(opus_data->enc, OPUS_SET_DTX(attr->setting.vad ? 1 : 0));
/* Set PLC */
opus_encoder_ctl(opus_data->enc,
OPUS_SET_INBAND_FEC(attr->setting.plc ? 1 : 0));
OPUS_SET_INBAND_FEC(enc_use_plc));
/* Set bandwidth */
opus_encoder_ctl(opus_data->enc,
OPUS_SET_MAX_BANDWIDTH(get_opus_bw_constant(
Expand Down
Loading