[asterisk-commits] rizzo: branch rizzo/video_v2 r85392 - /team/rizzo/video_v2/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 11 07:36:09 CDT 2007


Author: rizzo
Date: Thu Oct 11 07:36:09 2007
New Revision: 85392

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85392
Log:
more debugging h261


Modified:
    team/rizzo/video_v2/channels/console_video.c

Modified: team/rizzo/video_v2/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/channels/console_video.c?view=diff&rev=85392&r1=85391&r2=85392
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Thu Oct 11 07:36:09 2007
@@ -433,19 +433,24 @@
 	return a;
 }
 
+static int bitbuf_left(struct bitbuf *b)
+{
+	return b->bitsize - b->ofs;
+}
+
 static uint32_t getbits(struct bitbuf *b, int n)
 {
 	int i, ofs;
 	const uint8_t *d;
 	uint8_t mask;
 	uint32_t retval = 0;
-	if (n + b->ofs > b->bitsize) {
-		ast_log(LOG_WARNING, "bitbuf overflow %d of %d\n", n + b->ofs, b->bitsize);
-		return 0;
-	}
 	if (n> 31) {
 		ast_log(LOG_WARNING, "too many bits %d, max 32\n", n);
 		return 0;
+	}
+	if (n + b->ofs > b->bitsize) {
+		ast_log(LOG_WARNING, "bitbuf overflow %d of %d\n", n + b->ofs, b->bitsize);
+		n = b->bitsize - b->ofs;
 	}
 	ofs = 7 - b->ofs % 8;	/* start from msb */
 	mask = 1 << ofs;
@@ -468,11 +473,15 @@
 	uint32_t x, y;
 	
 	x = getbits(&a, 20);	/* PSC, 0000 0000 0000 0001 0000 */
-	if (x != 0x10)
+	if (x != 0x10) {
 		ast_log(LOG_WARNING, "bad PSC 0x%x\n", x);
+		return;
+	}
 	x = getbits(&a, 5);	/* temporal reference */
 	y = getbits(&a, 6);	/* ptype */
-	ast_log(LOG_WARNING, "TR %d PTY spl %d doc %d freeze %d %sCIF hi %d\n",
+	if (0)
+	ast_log(LOG_WARNING, "size %d TR %d PTY spl %d doc %d freeze %d %sCIF hi %d\n",
+		b->used,
 		x,
 		(y & 0x20) ? 1 : 0,
 		(y & 0x10) ? 1 : 0,
@@ -481,7 +490,26 @@
 		(y & 0x2) ? 1:0);
 	while ( (x = getbits(&a, 1)) == 1)
 		ast_log(LOG_WARNING, "PSPARE 0x%x\n", getbits(&a, 8));
-	ast_log(LOG_WARNING, "PSPARE 0 - start GOB\n");
+	// ast_log(LOG_WARNING, "PSPARE 0 - start GOB LAYER\n");
+	while ( (x = bitbuf_left(&a)) > 0) {
+		// ast_log(LOG_WARNING, "GBSC %d bits left\n", x);
+		x = getbits(&a, 16); /* GBSC 0000 0000 0000 0001 */
+		if (x != 0x1) {
+			ast_log(LOG_WARNING, "bad GBSC 0x%x\n", x);
+			break;
+		}
+		x = getbits(&a, 4);	/* group number */
+		y = getbits(&a, 5);	/* gquant */
+		if (x == 0) {
+			ast_log(LOG_WARNING, "  bad GN %d\n", x);
+			break;
+		}
+		while ( (x = getbits(&a, 1)) == 1)
+			ast_log(LOG_WARNING, "GSPARE 0x%x\n", getbits(&a, 8));
+		while ( (x = bitbuf_left(&a)) > 0) { /* MB layer */
+			break;
+		}
+	}
 }
 
 void dump_buf(struct fbuf_t *b);
@@ -675,7 +703,8 @@
 
 	if (!srclen)
 		return 0;
-	check_h261(b);
+	if (0)
+		check_h261(b);
 	while (srclen) {
 		uint8_t *data;
 		int datalen, ret, dummy = 0;




More information about the asterisk-commits mailing list