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

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


Author: rizzo
Date: Thu Oct 11 09:57:14 2007
New Revision: 85395

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85395
Log:
fix one case in fragmenting h261 blocks


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=85395&r1=85394&r2=85395
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Thu Oct 11 09:57:14 2007
@@ -964,12 +964,10 @@
 		i = len;	/* wrong... */
 #else
 		int found = 0, found_ebit = 0;	/* last GBSC position found */
-		for (; i < len ; i++) {
+		for (; i < len - 1 ; i++) {
 			uint8_t x, rpos, lpos;
 			if (d[i] != 0)		/* cannot be in a GBSC */
 				continue;
-			if (i > len - 1)
-				break;
 			x = d[i+1];
 			if (x == 0)	/* next is equally good */
 				continue;
@@ -1006,6 +1004,8 @@
 			ebit = found_ebit;
 		}
 #endif /* test */
+		if (i - start < 4)	/* XXX too short ? */
+			continue;
 		/* This frame is up to offset i (not inclusive).
 		 * We do not split it yet even if larger than MTU.
 		 */
@@ -1017,11 +1017,10 @@
 		/* recompute header with I=0, V=1 */
 		h[0] = ( (sbit & 7) << 5 ) | ( (ebit & 7) << 2 ) | 1;
 		bcopy(h, f->data, 4);	/* copy the h261 header */
-		if (ebit) {	/* not aligned, restart from previous byte */
-			sbit = 8 - ebit;
-			ebit = 0;
+		if (ebit)	/* not aligned, restart from previous byte */
 			i--;
-		}
+		sbit = (8 - ebit) & 7;
+		ebit = 0;
 		if (!cur)
 			first = f;
 		cur = f;




More information about the asterisk-commits mailing list