From ccc013e032756c0fcbb8fe32a6d347d26a6a281d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Oct 2013 03:48:55 +0500 Subject: [PATCH] opus drama stable edition --- src/mod/endpoints/mod_sofia/sofia_glue.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9839688ca0..92e018acce 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -39,13 +39,13 @@ switch_cache_db_handle_t *_sofia_glue_get_db_handle(sofia_profile_t *profile, const char *file, const char *func, int line); #define sofia_glue_get_db_handle(_p) _sofia_glue_get_db_handle(_p, __FILE__, __SWITCH_FUNC__, __LINE__) -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; } void sofia_glue_set_udptl_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *t38_options, int insist) @@ -317,7 +317,7 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, } if (tech_pvt->ianacodes[i] > 95 || 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", tech_pvt->ianacodes[i], imp->iananame, rate, channels); @@ -547,6 +547,10 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch rate = tech_pvt->adv_rm_rate; + if (!tech_pvt->adv_channels) { + tech_pvt->adv_channels = get_channels(tech_pvt->rm_encoding, 1); + } + if (tech_pvt->adv_channels > 1) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d/%d\n", tech_pvt->agreed_pt, tech_pvt->rm_encoding, rate, tech_pvt->adv_channels); @@ -776,7 +780,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch rate = imp->samples_per_second; } - channels = get_channels(imp); + channels = get_channels(imp->iananame, imp->number_of_channels); if (channels > 1) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d/%d\n", ianacode, imp->iananame,