[Asterisk-code-review] res_pjsip_sdp_rtp: Skip formats without SDP details. (asterisk[20])

Joshua Colp asteriskteam at digium.com
Wed Sep 7 07:46:59 CDT 2022


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19090 )


Change subject: res_pjsip_sdp_rtp: Skip formats without SDP details.
......................................................................

res_pjsip_sdp_rtp: Skip formats without SDP details.

When producing an outgoing SDP we iterate through the configured
formats and produce SDP information. It is possible for some
configured formats to not have SDP information available. If this
is the case we skip over them to allow the SDP to still be
produced.

ASTERISK-29185

Change-Id: I3e37569aa4ca341260e6ca5904dc2f75e46a1749
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 27 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/19090/1

diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 3e10cfd..e7b19e4 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1902,6 +1902,16 @@
 			continue;
 		}
 
+		/* It is possible for some formats not to have SDP information available for them
+		 * and if this is the case, skip over them so the SDP can still be created.
+		 */
+		if (!ast_rtp_lookup_sample_rate2(1, format, 0)) {
+			ast_log(LOG_WARNING, "Format '%s' can not be added to SDP, consider disallowing it on endpoint '%s'\n",
+				ast_format_get_name(format), ast_sorcery_object_get_id(session->endpoint));
+			ao2_ref(format, -1);
+			continue;
+		}
+
 		/* If this stream is not a transport we need to use the transport codecs structure for payload management to prevent
 		 * conflicts.
 		 */

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19090
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I3e37569aa4ca341260e6ca5904dc2f75e46a1749
Gerrit-Change-Number: 19090
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220907/96c35fb7/attachment-0001.html>


More information about the asterisk-code-review mailing list