[Asterisk-code-review] res_pjsip_session: Ensure reused streams have correct bundle group (asterisk[certified/16.8])

George Joseph asteriskteam at digium.com
Thu Jul 23 14:50:04 CDT 2020


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14695 )


Change subject: res_pjsip_session: Ensure reused streams have correct bundle group
......................................................................

res_pjsip_session: Ensure reused streams have correct bundle group

When a bundled stream is removed, its bundle_group is reset to -1.
If that stream is later reused, the bundle_group needs to be reset
to 0 or it could mistakenly be rebundled with a stream that was
removed and never reused.  Since the removed stream has no rtp
instance, a crash will result.

Change-Id: Ie2b792220f9291587ab5f9fd123145559dba96d7
---
M res/res_pjsip_session.c
1 file changed, 7 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/95/14695/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index d05f2c5..b0de0fe 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -486,6 +486,13 @@
 		/* A stream can never exist without an accompanying media session */
 		if (session_media->type == type) {
 			ao2_ref(session_media, +1);
+			/*
+			 * If this session_media was previously removed, its bundle group was probably reset
+			 * to -1.  We need to reset it to 0 if bundling is enabled.
+			 */
+			if (session->endpoint->media.bundle && session_media->bundle_group == -1) {
+				session_media->bundle_group = 0;
+			}
 		} else {
 			session_media = NULL;
 		}

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

Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: Ie2b792220f9291587ab5f9fd123145559dba96d7
Gerrit-Change-Number: 14695
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200723/65abd420/attachment.html>


More information about the asterisk-code-review mailing list