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

Friendly Automation asteriskteam at digium.com
Sat Sep 10 11:00:02 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18991 )

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(-)

Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Michael Bradeen: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit




diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 3b2e299..35b2932 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1820,6 +1820,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/+/18991
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I3e37569aa4ca341260e6ca5904dc2f75e46a1749
Gerrit-Change-Number: 18991
Gerrit-PatchSet: 3
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220910/3a01ab67/attachment.html>


More information about the asterisk-code-review mailing list