[asterisk-commits] rtp engine: Failed assertion and wrong name given for codec (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 28 15:46:36 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: rtp_engine: Failed assertion and wrong name given for codec
......................................................................
rtp_engine: Failed assertion and wrong name given for codec
Fixed an assert check that would trigger when the passed in value was negative.
The negative value was being cast to an unsigned value. This resulted in the
check failing.
Also fixed another problem when loading formats in the engine. When setting the
mime type the format's name was being passed in instead of the codec's name.
Change-Id: I1a201cd419ba4d8e9a40d337e36b6fbe1737192c
---
M main/rtp_engine.c
1 file changed, 8 insertions(+), 6 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index feadda3..66b80e5 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -983,6 +983,7 @@
} else {
new_type->format = t->payload_type.format;
}
+
if (new_type->format) {
/* SDP parsing automatically increases the reference count */
new_type->format = ast_format_parse_sdp_fmtp(new_type->format, "");
@@ -2257,7 +2258,11 @@
int x;
struct ast_rtp_payload_type *type;
- ast_assert(map < ARRAY_LEN(static_RTP_PT));
+ /*
+ * ARRAY_LEN's result is cast to an int so 'map' is not autocast to a size_t,
+ * which if negative would cause an assertion.
+ */
+ ast_assert(map < (int)ARRAY_LEN(static_RTP_PT));
ast_rwlock_wrlock(&static_RTP_PT_lock);
if (map < 0) {
@@ -2268,6 +2273,7 @@
break;
}
}
+
if (map < 0) {
if (format) {
ast_log(LOG_WARNING, "No Dynamic RTP mapping available for format %s\n",
@@ -2300,14 +2306,10 @@
int ast_rtp_engine_load_format(struct ast_format *format)
{
- char *codec_name = ast_strdupa(ast_format_get_name(format));
-
- codec_name = ast_str_to_upper(codec_name);
-
set_next_mime_type(format,
0,
ast_codec_media_type2str(ast_format_get_type(format)),
- codec_name,
+ ast_format_get_codec_name(format),
ast_format_get_sample_rate(format));
add_static_payload(-1, format, 0);
--
To view, visit https://gerrit.asterisk.org/3359
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1a201cd419ba4d8e9a40d337e36b6fbe1737192c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-commits
mailing list