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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 12 14:03:12 CST 2007


Author: rizzo
Date: Mon Nov 12 14:03:12 2007
New Revision: 89189

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89189
Log:
move shutdown code into the video thread

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=89189&r1=89188&r2=89189
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Mon Nov 12 14:03:12 2007
@@ -245,7 +245,7 @@
 	ast_mutex_t		dec_in_lock;
 	struct fbuf_t dec_in[N_DEC_IN];	/* incoming bitstream, allocated/extended in fbuf_append() */
 	struct fbuf_t dec_out;	/* decoded frame, no buffer (data is in AVFrame) */
-	struct fbuf_t rem_dpy;	/* display remote image, no buffer (managed by SDL in bmp[0]) */
+	struct fbuf_t rem_dpy;	/* display remote image, no buffer (it is in win[WIN_REMOTE].bmp) */
 };
 
 /*
@@ -1846,28 +1846,6 @@
 static void console_video_uninit(struct video_desc *env)
 {
 	env->shutdown = 1;
-	/*
-	 * XXX the locking here must be revised.
-	 * When asterisk calls shutdown, the channel is locked; however
-	 * the video thread might also need to acquire the lock on the channel
-	 * to enqueue the frames. So, we unlock the channel here to give
-	 * vthread a chance to exit the critical section and terminate.
-	 */
-	ast_channel_unlock(env->owner);
-	/* wait for video thread to finish */
-	pthread_join(env->vthread, NULL);
-	ast_channel_lock(env->owner);
-	env->shutdown = 0;
-	/* XXX should remove the vthread reference */
-
-	/* uninitialize the local and remote video environments */
-	video_in_uninit(&env->in);
-	video_out_uninit(&env->out);
-
-	if (env->sdl_ok)
-		cleanup_sdl(env);
-
-	env->owner = NULL;
 }
 
 
@@ -2266,6 +2244,15 @@
 		ast_channel_unlock(chan);
 	}
 	/* thread terminating, here could call the uninit */
+	/* uninitialize the local and remote video environments */
+	video_in_uninit(&env->in);
+	video_out_uninit(&env->out);
+
+	if (env->sdl_ok)
+		cleanup_sdl(env);
+
+	env->owner = NULL;
+	env->shutdown = 0;
 	return NULL;
 }
 




More information about the asterisk-commits mailing list