mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
[mod_opus] add cfg setting to overwrite the fmtp stereo param coming from remote. Eg: incoming SDP has stereo=1 but we want a mono call so we answer with stereo=0.
* [mod_opus] add cfg setting to overwrite the fmtp stereo param coming from remote. Eg: incoming SDP has stereo=1 but we want a mono call so we answer with stereo=0. sprop-stereo will be set to 0 too. * [core] opus: use switch_core_max_audio_channels() with remote fmtp stereo=1 to allow disabling of stereo.
This commit is contained in:
@@ -160,6 +160,7 @@ struct {
|
||||
int debuginfo;
|
||||
uint32_t use_jb_lookahead;
|
||||
switch_mutex_t *mutex;
|
||||
int mono;
|
||||
} opus_prefs;
|
||||
|
||||
static struct {
|
||||
@@ -283,7 +284,7 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt
|
||||
}
|
||||
|
||||
if (!strcasecmp(data, "stereo")) {
|
||||
codec_settings->stereo = atoi(arg);
|
||||
codec_settings->stereo = opus_prefs.mono ? 0 : atoi(arg);
|
||||
codec_fmtp->stereo = codec_settings->stereo;
|
||||
}
|
||||
|
||||
@@ -563,6 +564,11 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
|
||||
|
||||
opus_codec_settings.usedtx = opus_prefs.use_dtx;
|
||||
|
||||
if (opus_prefs.mono) {
|
||||
opus_codec_settings.stereo = 0;
|
||||
opus_codec_settings.sprop_stereo = 0;
|
||||
}
|
||||
|
||||
codec->fmtp_out = gen_fmtp(&opus_codec_settings, codec->memory_pool);
|
||||
|
||||
if (encoding) {
|
||||
@@ -1080,6 +1086,8 @@ static switch_status_t opus_load_config(switch_bool_t reload)
|
||||
if (!switch_opus_acceptable_rate(opus_prefs.sprop_maxcapturerate)) {
|
||||
opus_prefs.sprop_maxcapturerate = 0; /* value not supported */
|
||||
}
|
||||
} else if (!strcasecmp(key, "mono")) {
|
||||
opus_prefs.mono = atoi(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user