aboutsummaryrefslogtreecommitdiffstats
path: root/main/rtp.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-08 18:05:54 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-08 18:05:54 +0000
commite676dc69e54b933fa05d8277d03c5e961daceca1 (patch)
tree82b0235722534aca492e9ed5c7b7c8e72c840858 /main/rtp.c
parent21e626b1e7db99c69c579ca432952c36897069b6 (diff)
Merged revisions 58436 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r58436 | file | 2007-03-08 13:01:00 -0500 (Thu, 08 Mar 2007) | 2 lines Make early SDP seeding even smarter! We have to check codecs in the make_compatible function too. (issue #9221 reported by marcelbarbulescu) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@58437 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r--main/rtp.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/main/rtp.c b/main/rtp.c
index 1ff0a453d..a6a473a5a 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -1627,7 +1627,7 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
struct ast_rtp_protocol *destpr = NULL, *srcpr = NULL;
enum ast_rtp_get_result audio_dest_res = AST_RTP_GET_FAILED, video_dest_res = AST_RTP_GET_FAILED, text_dest_res = AST_RTP_GET_FAILED;
enum ast_rtp_get_result audio_src_res = AST_RTP_GET_FAILED, video_src_res = AST_RTP_GET_FAILED, text_src_res = AST_RTP_GET_FAILED;
- int srccodec;
+ int srccodec, destcodec;
/* Lock channels */
ast_channel_lock(dest);
@@ -1661,8 +1661,18 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
video_src_res = srcpr->get_vrtp_info ? srcpr->get_vrtp_info(src, &vsrcp) : AST_RTP_GET_FAILED;
text_src_res = srcpr->get_trtp_info ? srcpr->get_trtp_info(src, &tsrcp) : AST_RTP_GET_FAILED;
+ /* Ensure we have at least one matching codec */
+ if (srcpr->get_codec)
+ srccodec = srcpr->get_codec(src);
+ else
+ srccodec = 0;
+ if (destpr->get_codec)
+ destcodec = destpr->get_codec(dest);
+ else
+ destcodec = 0;
+
/* Check if bridge is still possible (In SIP canreinvite=no stops this, like NAT) */
- if (audio_dest_res != AST_RTP_TRY_NATIVE || audio_src_res != AST_RTP_TRY_NATIVE) {
+ if (audio_dest_res != AST_RTP_TRY_NATIVE || audio_src_res != AST_RTP_TRY_NATIVE || !(srccodec & destcodec)) {
/* Somebody doesn't want to play... */
ast_channel_unlock(dest);
ast_channel_unlock(src);
@@ -1673,10 +1683,6 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
ast_rtp_pt_copy(vdestp, vsrcp);
if (tdestp && tsrcp)
ast_rtp_pt_copy(tdestp, tsrcp);
- if (srcpr->get_codec)
- srccodec = srcpr->get_codec(src);
- else
- srccodec = 0;
if (media) {
/* Bridge early */
if (destpr->set_rtp_peer(dest, srcp, vsrcp, tsrcp, srccodec, ast_test_flag(srcp, FLAG_NAT_ACTIVE)))