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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Sep 30 16:28:14 CDT 2007


Author: rizzo
Date: Sun Sep 30 16:28:14 2007
New Revision: 84148

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84148
Log:
a bit of debugging while testing sws_scale

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=84148&r1=84147&r2=84148
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Sun Sep 30 16:28:14 2007
@@ -21,7 +21,7 @@
 #define HAVE_V4L	1
 #define HAVE_SDL	1
 #define HAVE_FFMPEG	1
-#define OLD_FFMPEG	1	/* set for old ffmpeg with no swscale */
+//#define OLD_FFMPEG	1	/* set for old ffmpeg with no swscale */
 
 
 #if !defined(HAVE_FFMPEG)
@@ -653,7 +653,7 @@
 	 */
 	v->enc_ctx->rtp_mode = 1;
 	v->enc_ctx->rtp_payload_size = v->mtu / 2; // mtu/2
-	v->enc_ctx->bit_rate_tolerance = v->enc_ctx->bit_rate/5;
+	v->enc_ctx->bit_rate_tolerance = v->enc_ctx->bit_rate/2;
 
 	/* now set codec-specific parameters, which differ for
 	 * the various video codecs in use.
@@ -672,7 +672,8 @@
 	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};
 	if (avcodec_open(v->enc_ctx, v->codec) < 0) {
-		ast_log(LOG_WARNING, "Unable to initialize the encoder parser\n");
+		ast_log(LOG_WARNING, "Unable to initialize the encoder %d\n",
+			codec);
 		av_free(v->enc_ctx);
 		v->enc_ctx = NULL;
 		return video_out_uninit(v);
@@ -858,8 +859,8 @@
 	p->data[0] = b->data;
 	p->linesize[0] = len;
 	/* these are only valid for component images */
-	p->data[1] = luv ? b->data + 4*l4 : b->data;
-	p->data[2] = luv ? b->data + 5*l4 : b->data;
+	p->data[1] = luv ? b->data + 4*l4 : b->data+len;
+	p->data[2] = luv ? b->data + 5*l4 : b->data+len;
 	p->linesize[1] = luv;
 	p->linesize[2] = luv;
 	return p;
@@ -894,7 +895,9 @@
 		ast_log(LOG_ERROR, "FFMPEG::convert_cmodel : swscale context initialization failed");
 		return;
 	}
-
+ast_log(LOG_WARNING, "in %d %dx%d out %d %dx%d\n",
+	in->pix_fmt, in->w, in->h,
+	out->pix_fmt, out->w, out->h);
 	sws_scale(convert_ctx,
 		p_in->data, p_in->linesize,
 		in->w, in->h, /* src slice */
@@ -942,6 +945,7 @@
 	bmp = env->bmp[out];
 	SDL_LockYUVOverlay(bmp);
 	/* output picture info - this is sdl, YUV420P */
+	bzero(&p_out, sizeof(p_out));
 	p_out.data[0] = bmp->pixels[0];
 	p_out.data[1] = bmp->pixels[1];
 	p_out.data[2] = bmp->pixels[2];
@@ -1164,7 +1168,9 @@
 	struct fbuf_t *b = &v->enc_out;
 
 	if (!v->loc_src.data) {
-		ast_log(LOG_WARNING, "fail, no loc_src buffer\n");
+		static volatile int a = 0;
+		if (a++ < 2)
+			ast_log(LOG_WARNING, "fail, no loc_src buffer\n");
 		return NULL;
 	}
 




More information about the asterisk-commits mailing list