[Asterisk-code-review] res pjsip sdp rtp: Fix opus pass-through (asterisk[13])

Sean Bright asteriskteam at digium.com
Fri May 8 09:59:28 CDT 2015


Sean Bright has uploaded a new change for review.

  https://gerrit.asterisk.org/407

Change subject: res_pjsip_sdp_rtp: Fix opus pass-through
......................................................................

res_pjsip_sdp_rtp: Fix opus pass-through

UA implementations that support opus use the optional encoder
parameters in the rtpmap attributes in the SDP to indicate the number
of channels, for example:

    a=rtpmap:111 opus/48000/2

The RTP engine doesn't have a way of persisting this information, so
when we copy to the outgoing leg, the encoding parameters are lost:

    a=rtpmap:111 opus/48000

Which causes a codec negotiation failure. This patch hacks in a check
for opus and adds the '/2' so that negoitation will succeed and
pass-through will work.

Note that this will still spam the logs with:

    codec.c: Unable to calculate samples for codec opus

I'm not sure at this point why Asterisk cares about the number of
samples in a native bridge, but the audio is still properly passed
from one endpoint to another.

ASTERISK-24779 #close
Reported by: PowerPBX

Change-Id: Ieff1ccf4af6ec0c7d20f6f85b4dbe365d9431436
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/07/407/1

diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 1bd3b0c..a2f513d 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -316,8 +316,14 @@
 	rtpmap.pt = media->desc.fmt[media->desc.fmt_count - 1];
 	rtpmap.clock_rate = ast_rtp_lookup_sample_rate2(asterisk_format, format, code);
 	pj_strdup2(pool, &rtpmap.enc_name, ast_rtp_lookup_mime_subtype2(asterisk_format, format, code, 0));
-	rtpmap.param.slen = 0;
-	rtpmap.param.ptr = NULL;
+
+	if (!pj_stricmp2(&rtpmap.enc_name, "opus")) {
+		rtpmap.param.slen = 1;
+		rtpmap.param.ptr = "2";
+	} else {
+		rtpmap.param.slen = 0;
+		rtpmap.param.ptr = NULL;
+	}
 
 	pjmedia_sdp_rtpmap_to_attr(pool, &rtpmap, &attr);
 

-- 
To view, visit https://gerrit.asterisk.org/407
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieff1ccf4af6ec0c7d20f6f85b4dbe365d9431436
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>



More information about the asterisk-code-review mailing list