we can only send one 'a=ptime' attribute per media session, not one for each format

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@44971 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Kevin P. Fleming 19 years ago
parent 09f6a6a167
commit ec4bf13915

@ -1253,7 +1253,7 @@ static int find_sdp(struct sip_request *req);
static int process_sdp(struct sip_pvt *p, struct sip_request *req); static int process_sdp(struct sip_pvt *p, struct sip_request *req);
static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate, static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
char **m_buf, size_t *m_size, char **a_buf, size_t *a_size, char **m_buf, size_t *m_size, char **a_buf, size_t *a_size,
int debug); int debug, int *min_packet_size);
static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_rate, static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_rate,
char **m_buf, size_t *m_size, char **a_buf, size_t *a_size, char **m_buf, size_t *m_size, char **a_buf, size_t *a_size,
int debug); int debug);
@ -5678,7 +5678,7 @@ static int add_vidupdate(struct sip_request *req)
/*! \brief Add codec offer to SDP offer/answer body in INVITE or 200 OK */ /*! \brief Add codec offer to SDP offer/answer body in INVITE or 200 OK */
static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate, static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
char **m_buf, size_t *m_size, char **a_buf, size_t *a_size, char **m_buf, size_t *m_size, char **a_buf, size_t *a_size,
int debug) int debug, int *min_packet_size)
{ {
int rtp_code; int rtp_code;
struct ast_format_list fmt; struct ast_format_list fmt;
@ -5707,9 +5707,8 @@ static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate
ast_build_string(a_buf, a_size, "a=fmtp:%d mode=%d\r\n", rtp_code, fmt.cur_ms); ast_build_string(a_buf, a_size, "a=fmtp:%d mode=%d\r\n", rtp_code, fmt.cur_ms);
} }
if (codec != AST_FORMAT_ILBC) { if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size))
ast_build_string(a_buf, a_size, "a=ptime:%d\r\n", fmt.cur_ms); *min_packet_size = fmt.cur_ms;
}
} }
/*! \brief Get Max T.38 Transmission rate from T38 capabilities */ /*! \brief Get Max T.38 Transmission rate from T38 capabilities */
@ -5903,6 +5902,8 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
int capability; int capability;
int needvideo = FALSE; int needvideo = FALSE;
int debug = sip_debug_test_pvt(p); int debug = sip_debug_test_pvt(p);
int min_audio_packet_size = 0;
int min_video_packet_size = 0;
m_video[0] = '\0'; /* Reset the video media string if it's not needed */ m_video[0] = '\0'; /* Reset the video media string if it's not needed */
@ -6035,11 +6036,10 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
add_codec_to_sdp(p, p->prefcodec & AST_FORMAT_AUDIO_MASK, 8000, add_codec_to_sdp(p, p->prefcodec & AST_FORMAT_AUDIO_MASK, 8000,
&m_audio_next, &m_audio_left, &m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left, &a_audio_next, &a_audio_left,
debug); debug, &min_audio_packet_size);
alreadysent |= p->prefcodec & AST_FORMAT_AUDIO_MASK; alreadysent |= p->prefcodec & AST_FORMAT_AUDIO_MASK;
} }
/* Start by sending our preferred audio codecs */ /* Start by sending our preferred audio codecs */
for (x = 0; x < 32; x++) { for (x = 0; x < 32; x++) {
int pref_codec; int pref_codec;
@ -6056,7 +6056,7 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
add_codec_to_sdp(p, pref_codec, 8000, add_codec_to_sdp(p, pref_codec, 8000,
&m_audio_next, &m_audio_left, &m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left, &a_audio_next, &a_audio_left,
debug); debug, &min_audio_packet_size);
alreadysent |= pref_codec; alreadysent |= pref_codec;
} }
@ -6072,12 +6072,12 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
add_codec_to_sdp(p, x, 8000, add_codec_to_sdp(p, x, 8000,
&m_audio_next, &m_audio_left, &m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left, &a_audio_next, &a_audio_left,
debug); debug, &min_audio_packet_size);
else else
add_codec_to_sdp(p, x, 90000, add_codec_to_sdp(p, x, 90000,
&m_video_next, &m_video_left, &m_video_next, &m_video_left,
&a_video_next, &a_video_left, &a_video_next, &a_video_left,
debug); debug, &min_video_packet_size);
} }
/* Now add DTMF RFC2833 telephony-event as a codec */ /* Now add DTMF RFC2833 telephony-event as a codec */
@ -6094,9 +6094,15 @@ static int add_sdp(struct sip_request *resp, struct sip_pvt *p)
if (option_debug > 2) if (option_debug > 2)
ast_log(LOG_DEBUG, "-- Done with adding codecs to SDP\n"); ast_log(LOG_DEBUG, "-- Done with adding codecs to SDP\n");
if(!p->owner || !ast_internal_timing_enabled(p->owner)) if (!p->owner || !ast_internal_timing_enabled(p->owner))
ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n"); ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - -\r\n");
if (min_audio_packet_size)
ast_build_string(&a_audio_next, &a_audio_left, "a=ptime:%d\r\n", min_audio_packet_size);
if (min_video_packet_size)
ast_build_string(&a_video_next, &a_video_left, "a=ptime:%d\r\n", min_video_packet_size);
if ((m_audio_left < 2) || (m_video_left < 2) || (a_audio_left == 0) || (a_video_left == 0)) if ((m_audio_left < 2) || (m_video_left < 2) || (a_audio_left == 0) || (a_video_left == 0))
ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n"); ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");

Loading…
Cancel
Save