};
-static int get_channels(const switch_codec_implementation_t *imp)
+static int get_channels(const char *name, int dft)
{
- if (!strcasecmp(imp->iananame, "opus")) {
+ if (!strcasecmp(name, "opus")) {
return 2; /* IKR???*/
}
- return imp->number_of_channels;
+ return dft ? dft : 1;
}
static void _switch_core_media_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core_session_t *bleg_session, switch_media_type_t type)
}
if (smh->ianacodes[i] > 95 || switch_channel_test_flag(session->channel, CF_VERBOSE_SDP)) {
- int channels = get_channels(imp);
+ int channels = get_channels(imp->iananame, imp->number_of_channels);
if (channels > 1) {
switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d %s/%d/%d\n", smh->ianacodes[i], imp->iananame, rate, channels);
rate = a_engine->codec_params.adv_rm_rate;
- //if (!strcasecmp(a_engine->codec_params.rm_encoding, "opus")) {
- // a_engine->codec_params.adv_channels = 2;
- //}
+ if (!a_engine->codec_params.adv_channels) {
+ a_engine->codec_params.adv_channels = get_channels(a_engine->codec_params.rm_encoding, 1);
+ }
if (a_engine->codec_params.adv_channels > 1) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d/%d\n",
rate = imp->samples_per_second;
}
- channels = get_channels(imp);
+ channels = get_channels(imp->iananame, imp->number_of_channels);
if (!strcasecmp(imp->iananame, "VP8")) {
vp8 = ianacode;