[Asterisk-code-review] bridge: Don't try to match audio formats. (asterisk[certified/16.8])

Benjamin Keith Ford asteriskteam at digium.com
Fri Feb 12 10:14:09 CST 2021


Hello Joshua Colp,

I'd like you to do a code review. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/15444

to review the following change.


Change subject: bridge: Don't try to match audio formats.
......................................................................

bridge: Don't try to match audio formats.

When bridging channels we were trying to match the audio
formats of both sides in combination with the configured
formats. While this is allowed in SDP in practice this
causes extra reinvites and problems. This change ensures
that audio streams use the formats of the first existing
active audio stream. It is only when other stream types
(like video) exist that this will result in re-negotiation
occurring for those streams only.

ASTERISK-28871

Change-Id: I22f5a3e7db29e00c165e74d05d10856f6086fe47
---
M bridges/bridge_native_rtp.c
M bridges/bridge_simple.c
2 files changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/15444/1

diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index a6addf2..2853b99 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -893,8 +893,8 @@
 				continue;
 			}
 
-			ast_format_cap_append_from_cap(ast_stream_get_formats(stream), audio_formats,
-				AST_MEDIA_TYPE_AUDIO);
+			/* We haven't actually modified audio_formats so this is safe */
+			ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);
 		}
 	}
 
diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c
index 545b3ad..1750d27 100644
--- a/bridges/bridge_simple.c
+++ b/bridges/bridge_simple.c
@@ -97,8 +97,8 @@
 				continue;
 			}
 
-			ast_format_cap_append_from_cap(ast_stream_get_formats(stream), audio_formats,
-				AST_MEDIA_TYPE_AUDIO);
+			/* We haven't actually modified audio_formats so this is safe */
+			ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);
 		}
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15444
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: I22f5a3e7db29e00c165e74d05d10856f6086fe47
Gerrit-Change-Number: 15444
Gerrit-PatchSet: 1
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: 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/20210212/f02dcfdc/attachment.html>


More information about the asterisk-code-review mailing list