[asterisk-commits] rizzo: branch rizzo/video_console r126221 - /team/rizzo/video_console/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Jun 28 14:50:51 CDT 2008
Author: rizzo
Date: Sat Jun 28 14:50:51 2008
New Revision: 126221
URL: http://svn.digium.com/view/asterisk?view=rev&rev=126221
Log:
1. remove a memory leak when there is no connection by calling
ast_frfree() on all frames returned by get_video_frames()
(we need a loop - ast_frfree does not iterate on a list of frames).
2. as a further optimization, do not bother calling the encoder
when there is no communication going on.
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=126221&r1=126220&r2=126221
==============================================================================
--- team/rizzo/video_console/channels/console_video.c (original)
+++ team/rizzo/video_console/channels/console_video.c Sat Jun 28 14:50:51 2008
@@ -273,12 +273,14 @@
static int
used_mem(const char *msg)
{
+#if 0
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);
+#endif
return 0;
}
@@ -815,7 +817,8 @@
if (tail == NULL)
tail = &dummy;
*tail = NULL;
- if (!loc_src_primary || !v->sendvideo)
+ /* if no reason for encoding, do not encode */
+ if (!env->owner || !loc_src_primary || !v->sendvideo)
return NULL;
if (v->enc_out.data == NULL) {
static volatile int a = 0;
@@ -934,19 +937,18 @@
if (env->shutdown)
break;
f = get_video_frames(env, &p); /* read and display */
- if (count %20 == 0) {
- int nf;
- struct ast_frame *g = env->owner ? env->owner->readq.first : NULL;
- for (nf = 0; g; nf++)
- g = g->frame_list.next;
- ast_log(LOG_WARNING, "video queue has size %d f %p\n", nf, f);
- used_mem("after enqueueing");
- }
if (!f)
continue;
chan = env->owner;
- if (chan == NULL)
+ if (chan == NULL) {
+ /* drop the chain of frames, nobody uses them */
+ while (f) {
+ struct ast_frame *g = AST_LIST_NEXT(f, frame_list);
+ ast_frfree(f);
+ f = g;
+ }
continue;
+ }
fd = chan->alertpipe[1];
ast_channel_lock(chan);
More information about the asterisk-commits
mailing list