diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-27 19:24:17 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-27 19:24:17 +0000 |
commit | bb9210c7a960fa9b4ec5c3d6167b25339b0428f0 (patch) | |
tree | 010456feea8c290b3ad46768771d566dba273121 /main | |
parent | 3db53911ba5ee17df139b45c6ccac18fb916d276 (diff) |
The following patch with updates for trunk. Works much better in trunk.
Also by accident fixed a bad typo by a previous committer, which actually made video calls
not work fully...
Merged revisions 89630 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r89630 | oej | 2007-11-27 16:23:17 +0100 (Tis, 27 Nov 2007) | 12 lines
If we get a codec offer using a well-known payload type, but using it for another
codec that we don't know, Asterisk did not remove that codec from the list.
With this patch, we remove the codec from audio and video rtp objects and
deny it ever existed. Thanks to lasse for testing.
(closes issue #11376)
Reported by: lasse
Patches:
bug11376.txt uploaded by oej (license 306)
Tested by: lasse
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89698 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/rtp.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/main/rtp.c b/main/rtp.c index afaf42836..87630f6e0 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -1939,23 +1939,36 @@ void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt) rtp_bridge_unlock(rtp); } +/*! \brief remove setting from payload type list if the rtpmap header indicates + an unknown media type */ +void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt) +{ + rtp_bridge_lock(rtp); + rtp->current_RTP_PT[pt].isAstFormat = 0; + rtp->current_RTP_PT[pt].code = 0; + rtp_bridge_unlock(rtp); +} + /*! \brief Make a note of a RTP payload type (with MIME type) that was seen in * an SDP "a=rtpmap:" line. + * \return 0 if the MIME type was found and set, -1 if it wasn't found */ -void ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt, +int ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt, char *mimeType, char *mimeSubtype, enum ast_rtp_options options) { unsigned int i; + int found = 0; if (pt < 0 || pt > MAX_RTP_PT) - return; /* bogus payload type */ + return -1; /* bogus payload type */ rtp_bridge_lock(rtp); for (i = 0; i < sizeof(mimeTypes)/sizeof(mimeTypes[0]); ++i) { if (strcasecmp(mimeSubtype, mimeTypes[i].subtype) == 0 && strcasecmp(mimeType, mimeTypes[i].type) == 0) { + found = 1; rtp->current_RTP_PT[pt] = mimeTypes[i].payloadType; if ((mimeTypes[i].payloadType.code == AST_FORMAT_G726) && mimeTypes[i].payloadType.isAstFormat && @@ -1967,7 +1980,7 @@ void ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt, rtp_bridge_unlock(rtp); - return; + return (found ? 0 : -1); } /*! \brief Return the union of all of the codecs that were set by rtp_set...() calls |