[asterisk-commits] tilghman: branch tilghman/codec_bits3 r227493 - /team/tilghman/codec_bits3/ch...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 3 16:53:16 CST 2009


Author: tilghman
Date: Tue Nov  3 16:53:12 2009
New Revision: 227493

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=227493
Log:
Compress subclass properly

Modified:
    team/tilghman/codec_bits3/channels/chan_iax2.c

Modified: team/tilghman/codec_bits3/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_iax2.c?view=diff&rev=227493&r1=227492&r2=227493
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_iax2.c (original)
+++ team/tilghman/codec_bits3/channels/chan_iax2.c Tue Nov  3 16:53:12 2009
@@ -1506,9 +1506,8 @@
 	return 0;
 }
 
-static unsigned char compress_subclass(int subclass)
-{
-	/* XXX FIXME XXX */
+static unsigned char compress_subclass(format_t subclass)
+{
 	int x;
 	int power=-1;
 	/* If it's 64 or smaller, just return it */
@@ -1518,7 +1517,7 @@
 	for (x = 0; x < IAX_MAX_SHIFT; x++) {
 		if (subclass & (1LL << x)) {
 			if (power > -1) {
-				ast_log(LOG_WARNING, "Can't compress subclass %d\n", subclass);
+				ast_log(LOG_WARNING, "Can't compress subclass %Ld\n", subclass);
 				return 0;
 			} else
 				power = x;
@@ -1527,7 +1526,7 @@
 	return power | IAX_FLAG_SC_LOG;
 }
 
-static int uncompress_subclass(unsigned char csub)
+static format_t uncompress_subclass(unsigned char csub)
 {
 	/* If the SC_LOG flag is set, return 2^csub otherwise csub */
 	if (csub & IAX_FLAG_SC_LOG) {
@@ -1535,7 +1534,7 @@
 		if (csub == 0xff)
 			return -1;
 		else
-			return 1 << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
+			return 1LL << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
 	}
 	else
 		return csub;
@@ -9646,6 +9645,10 @@
 			f.subclass.codec = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1);
 		} else {
 			f.subclass.codec = uncompress_subclass(fh->csub);
+		}
+
+		if (f.subclass.codec == 0) {
+			ast_log(LOG_WARNING, "WTF? csub of %d decoded as 0?!!\n", fh->csub);
 		}
 
 		/* Deal with POKE/PONG without allocating a callno */




More information about the asterisk-commits mailing list