[asterisk-commits] file: trunk r370860 - in /trunk: include/asterisk/rtp_engine.h main/rtp_engine.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 7 14:59:54 CDT 2012
Author: file
Date: Tue Aug 7 14:59:51 2012
New Revision: 370860
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370860
Log:
Payload and RTP code are must remain separate since in non-Asterisk format cases they differ.
Modified:
trunk/include/asterisk/rtp_engine.h
trunk/main/rtp_engine.c
Modified: trunk/include/asterisk/rtp_engine.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/rtp_engine.h?view=diff&rev=370860&r1=370859&r2=370860
==============================================================================
--- trunk/include/asterisk/rtp_engine.h (original)
+++ trunk/include/asterisk/rtp_engine.h Tue Aug 7 14:59:51 2012
@@ -236,7 +236,8 @@
struct ast_format format;
/*! Actual internal RTP specific value of the payload */
int rtp_code;
-
+ /*! Actual payload number */
+ int payload;
};
/*! Structure that represents statistics from an RTP instance */
Modified: trunk/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/rtp_engine.c?view=diff&rev=370860&r1=370859&r2=370860
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Tue Aug 7 14:59:51 2012
@@ -421,17 +421,17 @@
static int rtp_payload_type_hash(const void *obj, const int flags)
{
const struct ast_rtp_payload_type *type = obj;
- const int *rtp_code = obj;
-
- return (flags & OBJ_KEY) ? *rtp_code : type->rtp_code;
+ const int *payload = obj;
+
+ return (flags & OBJ_KEY) ? *payload : type->payload;
}
static int rtp_payload_type_cmp(void *obj, void *arg, int flags)
{
struct ast_rtp_payload_type *type1 = obj, *type2 = arg;
- const int *rtp_code = arg;
-
- return (type1->rtp_code == (OBJ_KEY ? *rtp_code : type2->rtp_code)) ? CMP_MATCH | CMP_STOP : 0;
+ const int *payload = arg;
+
+ return (type1->payload == (OBJ_KEY ? *payload : type2->payload)) ? CMP_MATCH | CMP_STOP : 0;
}
int ast_rtp_codecs_payloads_initialize(struct ast_rtp_codecs *codecs)
@@ -479,6 +479,7 @@
continue;
}
+ type->payload = i;
type->asterisk_format = static_RTP_PT[i].asterisk_format;
type->rtp_code = static_RTP_PT[i].rtp_code;
ast_format_copy(&type->format, &static_RTP_PT[i].format);
@@ -513,6 +514,7 @@
ast_debug(2, "Copying payload %d from %p to %p\n", i, src, dest);
+ new_type->payload = i;
*new_type = *type;
ao2_link_flags(dest->payloads, new_type, OBJ_NOLOCK);
@@ -539,6 +541,7 @@
type->asterisk_format = static_RTP_PT[payload].asterisk_format;
type->rtp_code = static_RTP_PT[payload].rtp_code;
+ type->payload = payload;
ast_format_copy(&type->format, &static_RTP_PT[payload].format);
ast_debug(1, "Setting payload %d based on m type on %p\n", payload, codecs);
@@ -590,12 +593,12 @@
if (!(type = ao2_alloc(sizeof(*type), NULL))) {
continue;
}
- type->rtp_code = pt;
+ type->payload = pt;
ao2_link_flags(codecs->payloads, type, OBJ_NOLOCK);
}
*type = t->payload_type;
- type->rtp_code = pt;
+ type->payload = pt;
if ((t->payload_type.format.id == AST_FORMAT_G726) && t->payload_type.asterisk_format && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
ast_format_set(&type->format, AST_FORMAT_G726_AAL2, 0);
@@ -724,11 +727,11 @@
int i, res = -1;
if (asterisk_format && format && (type = ao2_callback(codecs->payloads, OBJ_NOLOCK, rtp_payload_type_find_format, (void*)format))) {
- res = type->rtp_code;
+ res = type->payload;
ao2_ref(type, -1);
return res;
} else if (!asterisk_format && (type = ao2_find(codecs->payloads, &code, OBJ_NOLOCK | OBJ_KEY))) {
- res = type->rtp_code;
+ res = type->payload;
ao2_ref(type, -1);
return res;
}
More information about the asterisk-commits
mailing list