diff options
author | Richard Mudgett <rmudgett@digium.com> | 2015-07-27 19:10:11 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2015-07-30 17:11:58 -0500 |
commit | e2d5d4db3561b3d2b1a43999b3e6e60c734de349 (patch) | |
tree | 552b012ae6e39ee3b072aa5a73fdb2a68d25ec2f /main/rtp_engine.c | |
parent | bc1eae55cb818c9d7963549ba9927a06c6b6f1ac (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/rtp_engine.c')
-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 069b2fc60..6e647d381 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) { |