[svn-commits] branch oej/sdpcleanup r32112 - in /team/oej/sdpcleanup: ./ channels/ include/...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Jun 4 12:20:52 MST 2006


Author: oej
Date: Sun Jun  4 14:20:51 2006
New Revision: 32112

URL: http://svn.digium.com/view/asterisk?rev=32112&view=rev
Log:
Update

Modified:
    team/oej/sdpcleanup/   (props changed)
    team/oej/sdpcleanup/channels/chan_sip.c
    team/oej/sdpcleanup/frame.c
    team/oej/sdpcleanup/include/asterisk/frame.h

Propchange: team/oej/sdpcleanup/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Modified: team/oej/sdpcleanup/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/channels/chan_sip.c?rev=32112&r1=32111&r2=32112&view=diff
==============================================================================
--- team/oej/sdpcleanup/channels/chan_sip.c (original)
+++ team/oej/sdpcleanup/channels/chan_sip.c Sun Jun  4 14:20:51 2006
@@ -5122,18 +5122,18 @@
 		dest.sin_addr = p->ourip;
 		dest.sin_port = sin.sin_port;
 	}
-	if (option_debug) {
+	if (option_debug > 1) {
 		char codecbuf[BUFSIZ];
 		ast_log(LOG_DEBUG, "** Our capability: %s Video flag: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), capability), ast_test_flag(&p->flags[0], SIP_NOVIDEO) ? "True" : "False");
-	}
-
-	if( p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) {
-	// if((capability & AST_FORMAT_VIDEO_MASK) && !ast_test_flag(&p->flags[0], SIP_NOVIDEO)) {
+		ast_log(LOG_DEBUG, "** Our prefcodec: %s \n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), p->prefcodec));
+	}
+
+	if((capability & AST_FORMAT_VIDEO_MASK) && !ast_test_flag(&p->flags[0], SIP_NOVIDEO)) {
 		if (p->vrtp) {
 			needvideo = TRUE;
-			if (option_debug)
+			if (option_debug > 1)
 				ast_log(LOG_DEBUG, "This call needs video offers! \n");
-		} else if (option_debug)
+		} else if (option_debug > 1)
 			ast_log(LOG_DEBUG, "This call needs video offers, but there's no video suupport enabled ! \n");
 	}
 		
@@ -5148,7 +5148,8 @@
 			vdest.sin_port = vsin.sin_port;
 		}
 		/* Build max bitrate string */
-		snprintf(b, sizeof(b), "b=CT:%d\r\n", p->maxcallbitrate);
+		if (p->maxcallbitrate)
+			snprintf(b, sizeof(b), "b=CT:%d\r\n", p->maxcallbitrate);
 		if (debug) 
 			ast_verbose("Video is at %s port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ntohs(vsin.sin_port));	
 	}
@@ -5187,7 +5188,6 @@
 					 debug);
 		alreadysent |= p->prefcodec;
 	}
-	ast_log(LOG_DEBUG, "**** ONE ************* \n");
 
 	/* Start by sending our preferred codecs */
 	for (x = 0; x < 32; x++) {
@@ -5212,7 +5212,6 @@
 					 debug);
 		alreadysent |= pref_codec;
 	}
-	ast_log(LOG_DEBUG, "**** TWO ************* \n");
 
 	/* Now send any other common codecs, and non-codec formats: */
 	for (x = 1; x <= (needvideo ? AST_FORMAT_MAX_VIDEO : AST_FORMAT_MAX_AUDIO); x <<= 1) {
@@ -5233,7 +5232,6 @@
 					 &a_video_next, &a_video_left,
 					 debug);
 	}
-	ast_log(LOG_DEBUG, "**** THREE ************* \n");
 
 	for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
 		if (!(p->noncodeccapability & x))
@@ -5244,7 +5242,6 @@
 				    &a_audio_next, &a_audio_left,
 				    debug);
 	}
-	ast_log(LOG_DEBUG, "**** FOUR ************* \n");
 	if (option_debug > 2)
 		ast_log(LOG_DEBUG, "Done with adding codecs to SDP\n");
 
@@ -5286,7 +5283,7 @@
 	/* Update lastrtprx when we send our SDP */
 	p->lastrtprx = p->lastrtptx = time(NULL); /* XXX why both ? */
 
-	if (option_debug) {
+	if (option_debug > 2) {
 		char buf[BUFSIZ];
 		ast_log(LOG_DEBUG, "We're settling with offering these formats: %s\n", ast_getformatname_multiple(buf, BUFSIZ, capability));
 	}

Modified: team/oej/sdpcleanup/frame.c
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/frame.c?rev=32112&r1=32111&r2=32112&view=diff
==============================================================================
--- team/oej/sdpcleanup/frame.c (original)
+++ team/oej/sdpcleanup/frame.c Sun Jun  4 14:20:51 2006
@@ -1037,7 +1037,10 @@
 				*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);

Modified: team/oej/sdpcleanup/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/oej/sdpcleanup/include/asterisk/frame.h?rev=32112&r1=32111&r2=32112&view=diff
==============================================================================
--- team/oej/sdpcleanup/include/asterisk/frame.h (original)
+++ team/oej/sdpcleanup/include/asterisk/frame.h Sun Jun  4 14:20:51 2006
@@ -456,30 +456,47 @@
 
 extern void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix);
 
-/*! \brief Initialize a codec preference to "no preference" */
+/*! \par AudioCodecPref Audio Codec Preferences
+	In order to negotiate audio codecs in the order they are configured
+	in <channel>.conf for a device, we set up codec preference lists
+	in addition to the codec capabilities setting. The capabilities
+	setting is a bitmask of audio and video codecs with no internal
+	order. This will reflect the offer given to the other side, where
+	the prefered codecs will be added to the top of the list in the
+	order indicated by the "allow" lines in the device configuration.
+	
+	Video codecs are not included in the preference lists since they
+	can't be transcoded and we just have to pick whatever is supported
+*/
+
+/*! \brief Initialize an audio codec preference to "no preference" See \ref AudioCodecPref */
 extern void ast_codec_pref_init(struct ast_codec_pref *pref);
 
-/*! \brief Codec located at  a particular place in the preference index */
+/*! \brief Codec located at a particular place in the preference index See \ref AudioCodecPref */
 extern int ast_codec_pref_index(struct ast_codec_pref *pref, int index);
 
-/*! \brief Remove a codec from a preference list */
+/*! \brief Remove audio a codec from a preference list */
 extern void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);
 
-/*! \brief Append a codec to a preference list, removing it first if it was already there */
+/*! \brief Append a audio codec to a preference list, removing it first if it was already there 
+*/
 extern int ast_codec_pref_append(struct ast_codec_pref *pref, int format);
 
-/*! \brief Select the best format according to preference list from supplied options. 
+/*! \brief Select the best audio format according to preference list from supplied options. 
    If "find_best" is non-zero then if nothing is found, the "Best" format of 
    the format list is selected, otherwise 0 is returned. */
 extern int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);
 
-/*! \brief Parse an "allow" or "deny" line and update the mask and pref if provided */
+/*! \brief Parse an "allow" or "deny" line in a channel or device configuration 
+        and update the capabilities mask and pref if provided.
+	Video codecs are not added to codec preference lists, since we can not transcode
+ */
 extern void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing);
 
-/*! \brief Dump codec preference list into a string */
+/*! \brief Dump audio codec preference list into a string */
 extern int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
 
-/*! \brief Shift a codec preference list up or down 65 bytes so that it becomes an ASCII string */
+/*! \brief Shift an audio codec preference list up or down 65 bytes so that it becomes an ASCII string */
 extern void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size, int right);
 
 /*! \brief Returns the number of samples contained in the frame */



More information about the svn-commits mailing list