[asterisk-commits] rtp engine.c: Extract rtp codecs payload replace rx(). (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 21 08:39:17 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: rtp_engine.c: Extract rtp_codecs_payload_replace_rx().
......................................................................
rtp_engine.c: Extract rtp_codecs_payload_replace_rx().
ASTERISK-25166
Reported by: Kevin Harwell
ASTERISK-17410
Reported by: Boris Fox
Change-Id: I34e23bf5b084c8570f9c3e6ccd19b95fe85af239
---
M main/rtp_engine.c
1 file changed, 27 insertions(+), 16 deletions(-)
Approvals:
Anonymous Coward #1000019: Verified
Matt Jordan: Looks good to me, approved
Ashley Sanders: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 229af8f..cd2d38f 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -678,6 +678,31 @@
/*!
* \internal
+ * \brief Put the new_type into the rx payload type mapping.
+ * \since 14.0.0
+ *
+ * \param codecs Codecs structure to put new_type into
+ * \param payload type position to replace.
+ * \param new_type RTP payload mapping object to store.
+ *
+ * \note It is assumed that codecs is write locked before calling.
+ *
+ * \return Nothing
+ */
+static void rtp_codecs_payload_replace_rx(struct ast_rtp_codecs *codecs, int payload, struct ast_rtp_payload_type *new_type)
+{
+ ao2_ref(new_type, +1);
+ if (payload < AST_VECTOR_SIZE(&codecs->payload_mapping_rx)) {
+ ao2_t_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_rx, payload),
+ "cleaning up rx mapping vector element about to be replaced");
+ }
+ AST_VECTOR_REPLACE(&codecs->payload_mapping_rx, payload, new_type);
+
+ payload_mapping_rx_clear_primary(codecs, new_type);
+}
+
+/*!
+ * \internal
* \brief Copy the rx payload type mapping to the destination.
* \since 14.0.0
*
@@ -703,14 +728,7 @@
ast_debug(2, "Copying rx payload mapping %d (%p) from %p to %p\n",
idx, type, src, dest);
- ao2_ref(type, +1);
- if (idx < AST_VECTOR_SIZE(&dest->payload_mapping_rx)) {
- ao2_t_cleanup(AST_VECTOR_GET(&dest->payload_mapping_rx, idx),
- "cleaning up rx mapping vector element about to be replaced");
- }
- AST_VECTOR_REPLACE(&dest->payload_mapping_rx, idx, type);
-
- payload_mapping_rx_clear_primary(dest, type);
+ rtp_codecs_payload_replace_rx(dest, idx, type);
if (instance && instance->engine && instance->engine->payload_set) {
instance->engine->payload_set(instance, idx, type->asterisk_format, type->format, type->rtp_code);
@@ -851,14 +869,7 @@
ast_debug(2, "Crossover copying tx to rx payload mapping %d (%p) from %p to %p\n",
idx, type, src, dest);
- ao2_ref(type, +1);
- if (idx < AST_VECTOR_SIZE(&dest->payload_mapping_rx)) {
- ao2_t_cleanup(AST_VECTOR_GET(&dest->payload_mapping_rx, idx),
- "cleaning up rx mapping vector element about to be replaced");
- }
- AST_VECTOR_REPLACE(&dest->payload_mapping_rx, idx, type);
-
- payload_mapping_rx_clear_primary(dest, type);
+ rtp_codecs_payload_replace_rx(dest, idx, type);
if (instance && instance->engine && instance->engine->payload_set) {
instance->engine->payload_set(instance, idx, type->asterisk_format, type->format, type->rtp_code);
--
To view, visit https://gerrit.asterisk.org/1019
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I34e23bf5b084c8570f9c3e6ccd19b95fe85af239
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list