[asterisk-commits] rizzo: branch rizzo/video_console r125739 - /team/rizzo/video_console/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 27 07:12:31 CDT 2008


Author: rizzo
Date: Fri Jun 27 07:12:30 2008
New Revision: 125739

URL: http://svn.digium.com/view/asterisk?view=rev&rev=125739
Log:
print memory usage in various places of the program trying
to track down what happens.

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

Modified: team/rizzo/video_console/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_console/channels/console_video.c?view=diff&rev=125739&r1=125738&r2=125739
==============================================================================
--- team/rizzo/video_console/channels/console_video.c (original)
+++ team/rizzo/video_console/channels/console_video.c Fri Jun 27 07:12:30 2008
@@ -270,6 +270,18 @@
 	b->pix_fmt = x.pix_fmt;
 }
 
+static int
+used_mem(const char *msg)
+{
+	char in[128];
+
+	pid_t pid = getpid();
+	sprintf(in, "ps -o vsz= -o rss= %d", pid);
+	ast_log(LOG_WARNING, "used mem (vsize, rss) %s ", msg);
+	system(in);
+	return 0;
+}
+	
 #include "vcodecs.c"
 #include "console_gui.c"
 
@@ -386,6 +398,7 @@
 	struct video_out_desc *v = &env->out;
 	int i; /* integer variable used as iterator */
 	
+	used_mem("start of video_out_uninit");
 	/* XXX this should be a codec callback */
 	if (v->enc_ctx) {
 		AVCodecContext *enc_ctx = (AVCodecContext *)v->enc_ctx;
@@ -413,6 +426,7 @@
 		v->devices[i].status_index = 0;
 	}
 	v->picture_in_picture = 0;
+	used_mem("end of video_out_uninit");
 	return -1;
 }
 
@@ -839,12 +853,9 @@
 		}
 	}
 	sdl_setup(env);
+	used_mem("after sdl_setup");
 	if (!ast_strlen_zero(save_display))
 		setenv("DISPLAY", save_display, 1);
-
-        /* initialize grab coordinates  XXX do we need it ? */
-        env->out.loc_src_geometry.x = 0;
-        env->out.loc_src_geometry.y = 0;
 
 	ast_mutex_init(&env->dec_lock);	/* used to sync decoder and renderer */
 
@@ -874,6 +885,8 @@
 		int fd;
 		char *caption = NULL, buf[160];
 		/* determine if video format changed */
+		if (count % 20 == 0)
+			used_mem(__FUNCTION__);
 		if (count++ % 10 == 0) {
 			if (env->out.sendvideo && env->out.devices)
 			    sprintf(buf, "%s %s %dx%d @@ %dfps %dkbps",
@@ -1024,6 +1037,7 @@
 void console_video_start(struct video_desc *env, struct ast_channel *owner)
 {
 	ast_log(LOG_WARNING, "env %p chan %p\n", env, owner);
+	used_mem("start of console_video_start");
 	if (env == NULL)	/* video not initialized */
 		return;
 	env->owner = owner;	/* work even if no owner is specified */
@@ -1055,6 +1069,7 @@
 	if (env->owner == NULL)
 		env->stayopen = 1;	/* manually opened so don't close on hangup */
 	env->out.picture_in_picture = 0; /* PiP mode intially disabled */
+	used_mem("end of console_video_start");
 }
 
 /*




More information about the asterisk-commits mailing list