[Asterisk-code-review] res_rtp_asterisk: Don't assume setting retrans props means to enable. (asterisk[17])
Joshua Colp
asteriskteam at digium.com
Fri Jun 12 03:42:18 CDT 2020
Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14531 )
Change subject: res_rtp_asterisk: Don't assume setting retrans props means to enable.
......................................................................
res_rtp_asterisk: Don't assume setting retrans props means to enable.
The "value" passed in when setting an RTP property determines
whether it should be enabled or disabled. The RTP send and
receive retrans props did not examine this to know if the
buffers should be enabled. They assumed they always should be.
This change makes it so that the "value" passed in is
respected.
ASTERISK-28939
Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc
---
M res/res_rtp_asterisk.c
1 file changed, 22 insertions(+), 3 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, approved
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, but someone else must approve
Joshua Colp: Approved for Submit
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 28fa12a..1820ab1 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -8236,10 +8236,29 @@
} else if (property == AST_RTP_PROPERTY_ASYMMETRIC_CODEC) {
rtp->asymmetric_codec = value;
} else if (property == AST_RTP_PROPERTY_RETRANS_SEND) {
- rtp->send_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_SEND_BUFFER_SIZE);
+ if (value) {
+ if (!rtp->send_buffer) {
+ rtp->send_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_SEND_BUFFER_SIZE);
+ }
+ } else {
+ if (rtp->send_buffer) {
+ ast_data_buffer_free(rtp->send_buffer);
+ rtp->send_buffer = NULL;
+ }
+ }
} else if (property == AST_RTP_PROPERTY_RETRANS_RECV) {
- rtp->recv_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_RECV_BUFFER_SIZE);
- AST_VECTOR_INIT(&rtp->missing_seqno, 0);
+ if (value) {
+ if (!rtp->recv_buffer) {
+ rtp->recv_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_RECV_BUFFER_SIZE);
+ AST_VECTOR_INIT(&rtp->missing_seqno, 0);
+ }
+ } else {
+ if (rtp->recv_buffer) {
+ ast_data_buffer_free(rtp->recv_buffer);
+ rtp->recv_buffer = NULL;
+ AST_VECTOR_FREE(&rtp->missing_seqno);
+ }
+ }
}
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14531
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc
Gerrit-Change-Number: 14531
Gerrit-PatchSet: 2
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: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200612/eb6f5296/attachment-0001.html>
More information about the asterisk-code-review
mailing list