[asterisk-commits] branch oej/codecnegotiation r34305 - in /team/oej/codecnegotiation: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jun 15 07:08:19 MST 2006


Author: oej
Date: Thu Jun 15 09:08:18 2006
New Revision: 34305

URL: http://svn.digium.com/view/asterisk?rev=34305&view=rev
Log:
Update from Denis Smirnov

Modified:
    team/oej/codecnegotiation/README.codecnegotiation-branch
    team/oej/codecnegotiation/apps/app_echo.c
    team/oej/codecnegotiation/channel.c
    team/oej/codecnegotiation/channels/chan_sip.c
    team/oej/codecnegotiation/file.c
    team/oej/codecnegotiation/include/asterisk/channel.h

Modified: team/oej/codecnegotiation/README.codecnegotiation-branch
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/README.codecnegotiation-branch?rev=34305&r1=34304&r2=34305&view=diff
==============================================================================
--- team/oej/codecnegotiation/README.codecnegotiation-branch (original)
+++ team/oej/codecnegotiation/README.codecnegotiation-branch Thu Jun 15 09:08:18 2006
@@ -30,7 +30,7 @@
 
 Added functions (all this functions static inline):
 
- - ast_chan_best_codec(chan) = ast_best_codec(chan->nativecodecs)
+ - ast_channel_best_codec(chan) = ast_best_codec(chan->nativecodecs)
    This need, because in future nativecodecs can be changed from int to struct
    type;
  - ast_get_read_format(chan) = chan->readformat
@@ -38,7 +38,7 @@
  - ast_request_inherit -- wrapper around ast_request, that can:
     - copy type from parent channel, if type not set;
     - copy formats from parent channel;
- - ast_chan_getformatname  = ast_getformatname(chan->nativeformats)
+ - ast_channel_getformatname  = ast_getformatname(chan->nativeformats)
  - ast_channel_format_reset =
  	ast_set_read_format(chan->readformat);
 	ast_set_write_format(chan->writeformat);

Modified: team/oej/codecnegotiation/apps/app_echo.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/apps/app_echo.c?rev=34305&r1=34304&r2=34305&view=diff
==============================================================================
--- team/oej/codecnegotiation/apps/app_echo.c (original)
+++ team/oej/codecnegotiation/apps/app_echo.c Thu Jun 15 09:08:18 2006
@@ -57,7 +57,6 @@
 static int echo_exec(struct ast_channel *chan, void *data)
 {
 	int res = -1;
-	int format;
 	struct localuser *u;
 
 	LOCAL_USER_ADD(u);

Modified: team/oej/codecnegotiation/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channel.c?rev=34305&r1=34304&r2=34305&view=diff
==============================================================================
--- team/oej/codecnegotiation/channel.c (original)
+++ team/oej/codecnegotiation/channel.c Thu Jun 15 09:08:18 2006
@@ -2026,7 +2026,7 @@
 				/* This frame can't be from the current native formats -- drop it on the
 				   floor */
 				ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n",
-					chan->name, ast_getformatname(f->subclass), ast_chan_getformatname(chan));
+					chan->name, ast_getformatname(f->subclass), ast_channel_getformatname(chan));
 				ast_frfree(f);
 				f = &ast_null_frame;
 			} else {

Modified: team/oej/codecnegotiation/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/channels/chan_sip.c?rev=34305&r1=34304&r2=34305&view=diff
==============================================================================
--- team/oej/codecnegotiation/channels/chan_sip.c (original)
+++ team/oej/codecnegotiation/channels/chan_sip.c Thu Jun 15 09:08:18 2006
@@ -3303,13 +3303,13 @@
 	switch (frame->frametype) {
 	case AST_FRAME_VOICE:
 		if (!(frame->subclass & ast->nativeformats)) {
-			ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
-			    ast_getformatname(frame->subclass),
-			    ast_getformatname(ast->nativeformats),
-			    ast_getformatname(ast_get_read_format(ast)),
-			    ast_getformatname(ast_get_write_format(ast)));
-			ast_frame_dump(ast->name, frame, "<<");
-			ast_backtrace();
+		    	const unsigned slen = 512;
+			char s1[slen], s2[slen], s3[slen];
+			ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %s (read/write = %s/%s)\n",
+				frame->subclass, 
+				ast_getformatname_multiple(s1, slen, ast->nativeformats & AST_FORMAT_VIDEO_MASK),
+				ast_getformatname_multiple(s2, slen, ast->readformat),
+				ast_getformatname_multiple(s3, slen, ast->writeformat));
 			return 0;
 		}
 		if (p) {

Modified: team/oej/codecnegotiation/file.c
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/file.c?rev=34305&r1=34304&r2=34305&view=diff
==============================================================================
--- team/oej/codecnegotiation/file.c (original)
+++ team/oej/codecnegotiation/file.c Thu Jun 15 09:08:18 2006
@@ -807,7 +807,7 @@
 #endif
 		return 0;
 	}
-	ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n", filename, ast_chan_getformatname_multiple(fmt, sizeof(fmt), chan), strerror(errno));
+	ast_log(LOG_WARNING, "Unable to open %s (format %s): %s\n", filename, ast_channel_getformatname_multiple(fmt, sizeof(fmt), chan), strerror(errno));
 	return -1;
 }
 

Modified: team/oej/codecnegotiation/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/codecnegotiation/include/asterisk/channel.h?rev=34305&r1=34304&r2=34305&view=diff
==============================================================================
--- team/oej/codecnegotiation/include/asterisk/channel.h (original)
+++ team/oej/codecnegotiation/include/asterisk/channel.h Thu Jun 15 09:08:18 2006
@@ -116,6 +116,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/options.h"
 
 
 #define AST_MAX_FDS		8
@@ -1055,31 +1056,34 @@
  * ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)"
  * \return The return value is buf.
  */
-inline static char * ast_chan_getformatname_multiple(char *buf, size_t size, struct ast_channel *chan)
+inline static char * ast_channel_getformatname_multiple(char *buf, size_t size, struct ast_channel *chan)
 {
 	return ast_getformatname_multiple(buf, size, chan->nativeformats);
 }
 
 
-static inline char * ast_chan_getformatname(struct ast_channel *chan)
+static inline char * ast_channel_getformatname(struct ast_channel *chan)
 {
 #ifndef BUG_4825 
-	return ast_getformatname(chan? chan->nativeformats: 0);
+	return chan ? ast_getformatname(chan->nativeformats) : "undefined";
 #else	
-	return ast_getformatname(chan? chan->nativeformats.audio_bits: 0);
+	return chan ? ast_getformatname(chan->nativeformats.audio_bits) : "undefined";
 #endif	
 }
 
 static inline void ast_channel_formats_reset(struct ast_channel *channel)
 {
 	int r, w;
-	ast_log(LOG_DEBUG, "Resetting read to %d and write to %d on channel %s\n", r, w, channel->name);
 	r = ast_get_read_format(channel);
-	if( r )
+	w = ast_get_write_format(channel);
+
+	if (option_debug)
+		ast_log(LOG_DEBUG, "Resetting read to %d and write to %d on channel %s\n", r, w, channel->name);
+
+	if (r)
 		ast_set_read_format(channel, r);
 
-	w = ast_get_read_format(channel);
-	if( w )
+	if (w)
 		ast_set_write_format(channel, w);
 }
 



More information about the asterisk-commits mailing list