Merge of the "sdpcleanup" branch. Thanks to John Martin for a lot of tests
and some patches (all disclaimed). - Don't change RTP properties if we reject a re-INVITE - Don't add video to an outbound channel if there's no video on the inbound channel - Don't include video in the "preferred codec" list for codec selection - Clean up and document code that parses and adds SDP attachments Since we do not transcode video, we can't handle video the same way as audio. This is a bug fix patch. In future releases, we need to work on a solution for video negotiation, not codecs but formats and framerates instead. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@32597 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
77abfdfd00
commit
4506e03f3d
11
channel.c
11
channel.c
|
@ -539,7 +539,7 @@ char *ast_transfercapability2str(int transfercapability)
|
|||
}
|
||||
}
|
||||
|
||||
/*! \brief Pick the best codec */
|
||||
/*! \brief Pick the best audio codec */
|
||||
int ast_best_codec(int fmts)
|
||||
{
|
||||
/* This just our opinion, expressed in code. We are asked to choose
|
||||
|
@ -572,7 +572,9 @@ int ast_best_codec(int fmts)
|
|||
/*! Down to G.723.1 which is proprietary but at least designed for voice */
|
||||
AST_FORMAT_G723_1,
|
||||
};
|
||||
|
||||
|
||||
/* Strip out video */
|
||||
fmts &= AST_FORMAT_AUDIO_MASK;
|
||||
|
||||
/* Find the first preferred codec in the format given */
|
||||
for (x=0; x < (sizeof(prefs) / sizeof(prefs[0]) ); x++)
|
||||
|
@ -2614,6 +2616,7 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
|
|||
int fmt;
|
||||
int res;
|
||||
int foo;
|
||||
int videoformat = format & AST_FORMAT_VIDEO_MASK;
|
||||
|
||||
if (!cause)
|
||||
cause = &foo;
|
||||
|
@ -2629,7 +2632,7 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
|
|||
continue;
|
||||
|
||||
capabilities = chan->tech->capabilities;
|
||||
fmt = format;
|
||||
fmt = format & AST_FORMAT_AUDIO_MASK;
|
||||
res = ast_translator_best_choice(&fmt, &capabilities);
|
||||
if (res < 0) {
|
||||
ast_log(LOG_WARNING, "No translator path exists for channel type %s (native %d) to %d\n", type, chan->tech->capabilities, format);
|
||||
|
@ -2640,7 +2643,7 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
|
|||
if (!chan->tech->requester)
|
||||
return NULL;
|
||||
|
||||
if (!(c = chan->tech->requester(type, capabilities, data, cause)))
|
||||
if (!(c = chan->tech->requester(type, capabilities | videoformat, data, cause)))
|
||||
return NULL;
|
||||
|
||||
if (c->_state == AST_STATE_DOWN) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
10
frame.c
10
frame.c
|
@ -1008,9 +1008,12 @@ int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(ret)
|
||||
if(ret & AST_FORMAT_AUDIO_MASK)
|
||||
return ret;
|
||||
|
||||
if (option_debug > 3)
|
||||
ast_log(LOG_DEBUG, "Could not find preferred codec - %s\n", find_best ? "Going for the best codec" : "Returning zero codec");
|
||||
|
||||
return find_best ? ast_best_codec(formats) : 0;
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1037,10 @@ void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char
|
|||
*mask &= ~format;
|
||||
}
|
||||
|
||||
if (pref) {
|
||||
/* Set up a preference list for audio. Do not include video in preferences
|
||||
since we can not transcode video and have to use whatever is offered
|
||||
*/
|
||||
if (pref && (format & AST_FORMAT_AUDIO_MASK)) {
|
||||
if (strcasecmp(this, "all")) {
|
||||
if (allowing)
|
||||
ast_codec_pref_append(pref, format);
|
||||
|
|
|
@ -40,13 +40,13 @@ extern "C" {
|
|||
|
||||
/* Codes for RTP-specific data - not defined by our AST_FORMAT codes */
|
||||
/*! DTMF (RFC2833) */
|
||||
#define AST_RTP_DTMF (1 << 0)
|
||||
#define AST_RTP_DTMF (1 << 0)
|
||||
/*! 'Comfort Noise' (RFC3389) */
|
||||
#define AST_RTP_CN (1 << 1)
|
||||
#define AST_RTP_CN (1 << 1)
|
||||
/*! DTMF (Cisco Proprietary) */
|
||||
#define AST_RTP_CISCO_DTMF (1 << 2)
|
||||
#define AST_RTP_CISCO_DTMF (1 << 2)
|
||||
/*! Maximum RTP-specific code */
|
||||
#define AST_RTP_MAX AST_RTP_CISCO_DTMF
|
||||
#define AST_RTP_MAX AST_RTP_CISCO_DTMF
|
||||
|
||||
#define MAX_RTP_PT 256
|
||||
|
||||
|
@ -62,6 +62,9 @@ struct ast_rtp_protocol {
|
|||
AST_LIST_ENTRY(ast_rtp_protocol) list;
|
||||
};
|
||||
|
||||
|
||||
#define FLAG_3389_WARNING (1 << 0)
|
||||
|
||||
typedef int (*ast_rtp_callback)(struct ast_rtp *rtp, struct ast_frame *f, void *data);
|
||||
|
||||
|
||||
|
@ -71,7 +74,6 @@ typedef int (*ast_rtp_callback)(struct ast_rtp *rtp, struct ast_frame *f, void *
|
|||
* RTP session is defined on page 9 of RFC 3550: "An association among a set of participants communicating with RTP. A participant may be involved in multiple RTP sessions at the same time [...]"
|
||||
*
|
||||
*/
|
||||
|
||||
/*! \brief The value of each payload format mapping: */
|
||||
struct rtpPayloadType {
|
||||
int isAstFormat; /*!< whether the following code is an AST_FORMAT */
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
#ifndef _ASTERISK_TRANSLATE_H
|
||||
#define _ASTERISK_TRANSLATE_H
|
||||
|
||||
#define MAX_FORMAT 32
|
||||
//#define MAX_FORMAT 15 /* Do not include video here */
|
||||
#define MAX_FORMAT 32 /* Do include video here */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
|
|
7
rtp.c
7
rtp.c
|
@ -1350,7 +1350,7 @@ int ast_rtp_make_compatible(struct ast_channel *dest, struct ast_channel *src, i
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*! \brief Make a note of a RTP paymoad type that was seen in a SDP "m=" line.
|
||||
/*! \brief Make a note of a RTP payload type that was seen in a SDP "m=" line.
|
||||
* By default, use the well-known value for this type (although it may
|
||||
* still be set to a different value by a subsequent "a=rtpmap:" line)
|
||||
*/
|
||||
|
@ -1359,9 +1359,8 @@ void ast_rtp_set_m_type(struct ast_rtp* rtp, int pt)
|
|||
if (pt < 0 || pt > MAX_RTP_PT)
|
||||
return; /* bogus payload type */
|
||||
|
||||
if (static_RTP_PT[pt].code != 0) {
|
||||
if (static_RTP_PT[pt].code != 0)
|
||||
rtp->current_RTP_PT[pt] = static_RTP_PT[pt];
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Make a note of a RTP payload type (with MIME type) that was seen in
|
||||
|
@ -2245,7 +2244,7 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f)
|
|||
|
||||
/* Make sure we have enough space for RTP header */
|
||||
if ((_f->frametype != AST_FRAME_VOICE) && (_f->frametype != AST_FRAME_VIDEO)) {
|
||||
ast_log(LOG_WARNING, "RTP can only send voice\n");
|
||||
ast_log(LOG_WARNING, "RTP can only send voice and video\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue