[asterisk-commits] kpfleming: trunk r44972 - in /trunk: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Oct 12 12:15:26 MST 2006


Author: kpfleming
Date: Thu Oct 12 14:15:25 2006
New Revision: 44972

URL: http://svn.digium.com/view/asterisk?rev=44972&view=rev
Log:
Merged revisions 44971 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44971 | kpfleming | 2006-10-12 14:14:24 -0500 (Thu, 12 Oct 2006) | 2 lines

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

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=44972&r1=44971&r2=44972&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Oct 12 14:15:25 2006
@@ -1247,7 +1247,7 @@
 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,
 			     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,
 				char **m_buf, size_t *m_size, char **a_buf, size_t *a_size,
 				int debug);
@@ -5638,7 +5638,7 @@
 /*! \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,
 			     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;
 	struct ast_format_list fmt;
@@ -5667,9 +5667,8 @@
 		ast_build_string(a_buf, a_size, "a=fmtp:%d mode=%d\r\n", rtp_code, fmt.cur_ms);
 	}
 
-	if (codec != AST_FORMAT_ILBC) {
-		ast_build_string(a_buf, a_size, "a=ptime:%d\r\n", fmt.cur_ms);
-	}
+	if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size))
+		*min_packet_size = fmt.cur_ms;
 }
 
 /*! \brief Get Max T.38 Transmission rate from T38 capabilities */
@@ -5863,6 +5862,8 @@
 	int capability;
 	int needvideo = FALSE;
 	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 */
 
@@ -5995,10 +5996,9 @@
 		add_codec_to_sdp(p, p->prefcodec & AST_FORMAT_AUDIO_MASK, 8000,
 				 &m_audio_next, &m_audio_left,
 				 &a_audio_next, &a_audio_left,
-				 debug);
+				 debug, &min_audio_packet_size);
 		alreadysent |= p->prefcodec & AST_FORMAT_AUDIO_MASK;
 	}
-
 
 	/* Start by sending our preferred audio codecs */
 	for (x = 0; x < 32; x++) {
@@ -6016,7 +6016,7 @@
 		add_codec_to_sdp(p, pref_codec, 8000,
 				 &m_audio_next, &m_audio_left,
 				 &a_audio_next, &a_audio_left,
-				 debug);
+				 debug, &min_audio_packet_size);
 		alreadysent |= pref_codec;
 	}
 
@@ -6032,12 +6032,12 @@
 			add_codec_to_sdp(p, x, 8000,
 					 &m_audio_next, &m_audio_left,
 					 &a_audio_next, &a_audio_left,
-					 debug);
+					 debug, &min_audio_packet_size);
 		else 
 			add_codec_to_sdp(p, x, 90000,
 					 &m_video_next, &m_video_left,
 					 &a_video_next, &a_video_left,
-					 debug);
+					 debug, &min_video_packet_size);
 	}
 
 	/* Now add DTMF RFC2833 telephony-event as a codec */
@@ -6054,8 +6054,14 @@
 	if (option_debug > 2)
 		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");
+
+	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))
 		ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");



More information about the asterisk-commits mailing list