MT#56782 use stereo= fmtp for Opus channels

If the remote Opus decoder prefers receiving single-channel encoded
audio, honour it and send them single-channel audio.

Change-Id: I4bf952b9f922099c95e19b0ab51fbdffb2cc19db
pull/1640/head
Richard Fuchs 3 years ago
parent 0408e2328d
commit deafee1a04

@ -2105,8 +2105,13 @@ static void opus_select_encoder_format(encoder_t *enc, format_t *req_format, con
break;
}
// switch to mono encoding if possible
if (req_format->channels == 2 && f->channels == 1)
// honour remote stereo=0/1 flag if given,
// otherwise go with the input format
if (fmtp && fmtp->parsed.opus.stereo_send == -1)
req_format->channels = 1;
else if (fmtp && fmtp->parsed.opus.stereo_send == 1)
req_format->channels = 2;
else if (req_format->channels == 2 && f->channels == 1)
req_format->channels = 1;
}
static void opus_select_decoder_format(decoder_t *dec, const struct rtp_codec_format *fmtp) {

Loading…
Cancel
Save