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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 1 15:28:10 CDT 2007


Author: rizzo
Date: Mon Oct  1 15:28:10 2007
New Revision: 84240

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84240
Log:
set mtu earlier, so the encoder can split the payload;
better check for psc codes;
free the correct block of memory when needed.


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=84240&r1=84239&r2=84240
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Mon Oct  1 15:28:10 2007
@@ -619,6 +619,8 @@
 		return video_out_uninit(v);
 	}
 
+	v->mtu = 1400;	/* important to set it early so the encoder can use it */
+
 	/* allocate the input buffer for encoding.
 	 * Once again we assume the encoder works on some 411 format.
 	 */
@@ -668,7 +670,8 @@
 		v->enc_ctx->flags |=CODEC_FLAG_H263P_SLICE_STRUCT;
 	}
 	v->enc_ctx->bit_rate = v->bitrate;
-	v->enc_ctx->gop_size = (int) v->fps*5; // emit I frame every 5 seconds
+	v->enc_ctx->gop_size = v->fps*5; // emit I frame every 5 seconds
+	v->enc_ctx->qmin = 3;	/* should be configured */
  
 	ast_log(LOG_WARNING, "w: %d h: %d fps: %d\n", v->w, v->h, v->fps);
 	v->enc_ctx->time_base = (AVRational){1, v->fps};
@@ -688,7 +691,6 @@
 	v->enc_out.size = enc_in->size;
 	v->enc_out.used = 0;
 
-	v->mtu = 1400;
 
 	return 0;
 }
@@ -1091,10 +1093,10 @@
 		struct ast_frame *f;
 		int i;
 
-		if (len >= 2 && d[0] == 0 && d[1] == 0) {
+		if (len >= 3 && d[0] == 0 && d[1] == 0 && d[2] >= 0x80) {
 			/* we are starting a new block, so look for a PSC. */
-			for (i = 2; i < len - 2; i++) {
-				if (d[i] == 0 && d[i+1] == 0) {
+			for (i = 3; i < len - 3; i++) {
+				if (d[i] == 0 && d[i+1] == 0 && d[i+2] >= 0x80) {
 					l = i;
 					break;
 				}
@@ -1114,8 +1116,8 @@
 				f, d, l);
 			if (f)
 				ast_free(f);
-			if (d)
-				ast_free(d);
+			if (data)
+				ast_free(data);
 			break;
 		}
 		f->mallocd = AST_MALLOCD_DATA | AST_MALLOCD_HDR;




More information about the asterisk-commits mailing list