[Asterisk-code-review] res_rtp_asterisk: Don't assume setting retrans props means to enable. (asterisk[certified/16.8])
Friendly Automation
asteriskteam at digium.com
Thu Jun 11 18:00:49 CDT 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14530 )
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
Friendly Automation: Approved for Submit
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 134eebc..6004a2f 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -8136,10 +8136,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/+/14530
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: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc
Gerrit-Change-Number: 14530
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: 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/20200611/43839b23/attachment.html>
More information about the asterisk-code-review
mailing list