diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-07-27 19:10:11 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-07-30 20:34:23 -0500 |
commit | 89b21fd9a38bcd89402249440c1670ce48781f30 (patch) | |
tree | b23fc3c0a735c74c6ad8a53f3ed5fe1548fcdfc5 /main | |
parent | 7427c7f13b1d0c9095e83a3ea38394f521d3a75e (diff) |
rtp_engine.h: No sense allowing payload types larger than RFC allows.
* Tweaked add_static_payload() to not use magic numbers.
Change-Id: I1719ff0f6d3ce537a91572501eae5bcd912a420b
Diffstat (limited to 'main')
-rw-r--r-- | main/rtp_engine.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c index f139dc454..296d84f2c 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -1740,22 +1740,24 @@ static void set_next_mime_type(struct ast_format *format, int rtp_code, const ch static void add_static_payload(int map, struct ast_format *format, int rtp_code) { int x; + + ast_assert(map < ARRAY_LEN(static_RTP_PT)); + ast_rwlock_wrlock(&static_RTP_PT_lock); if (map < 0) { /* find next available dynamic payload slot */ - for (x = 96; x < 127; x++) { + for (x = AST_RTP_PT_FIRST_DYNAMIC; x < AST_RTP_MAX_PT; ++x) { if (!static_RTP_PT[x].asterisk_format && !static_RTP_PT[x].rtp_code) { map = x; break; } } - } - - if (map < 0) { - ast_log(LOG_WARNING, "No Dynamic RTP mapping available for format %s\n", - ast_format_get_name(format)); - ast_rwlock_unlock(&static_RTP_PT_lock); - return; + if (map < 0) { + ast_log(LOG_WARNING, "No Dynamic RTP mapping available for format %s\n", + ast_format_get_name(format)); + ast_rwlock_unlock(&static_RTP_PT_lock); + return; + } } if (format) { |