mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 14:56:58 +00:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@58436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
18
main/rtp.c
18
main/rtp.c
@@ -1533,7 +1533,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;
|
||||
enum ast_rtp_get_result audio_src_res = AST_RTP_GET_FAILED, video_src_res = AST_RTP_GET_FAILED;
|
||||
int srccodec;
|
||||
int srccodec, destcodec;
|
||||
|
||||
/* Lock channels */
|
||||
ast_channel_lock(dest);
|
||||
@@ -1565,8 +1565,18 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
|
||||
audio_src_res = srcpr->get_rtp_info(src, &srcp);
|
||||
video_src_res = srcpr->get_vrtp_info ? srcpr->get_vrtp_info(src, &vsrcp) : 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);
|
||||
@@ -1575,10 +1585,6 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
|
||||
ast_rtp_pt_copy(destp, srcp);
|
||||
if (vdestp && vsrcp)
|
||||
ast_rtp_pt_copy(vdestp, vsrcp);
|
||||
if (srcpr->get_codec)
|
||||
srccodec = srcpr->get_codec(src);
|
||||
else
|
||||
srccodec = 0;
|
||||
if (media) {
|
||||
/* Bridge early */
|
||||
if (destpr->set_rtp_peer(dest, srcp, vsrcp, srccodec, ast_test_flag(srcp, FLAG_NAT_ACTIVE)))
|
||||
|
Reference in New Issue
Block a user