[asterisk-commits] rizzo: branch rizzo/video_v2 r89197 - /team/rizzo/video_v2/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 12 15:47:27 CST 2007
Author: rizzo
Date: Mon Nov 12 15:47:27 2007
New Revision: 89197
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89197
Log:
more comments on the handling of buffers for incoming video,
and on the handling of SDL events.
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=89197&r1=89196&r2=89197
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Mon Nov 12 15:47:27 2007
@@ -227,9 +227,12 @@
* codec, no memory, etc.) and we must drop all incoming frames.
*
* Incoming payload is stored in one of the dec_in[] buffers, which are
- * emptied by the video thread. dec_in_cur is the buffer in use by the
- * incoming frame, dec_in_dpy is the one being displayed.
- * We synchronize on dec_in_lock;
+ * emptied by the video thread. These buffers are organized in a circular
+ * queue, with dec_in_cur being the buffer in use by the incoming stream,
+ * and dec_in_dpy is the one being displayed. When the pointers need to
+ * be changed, we synchronize the access to them with dec_in_lock.
+ * When the list is full dec_in_cur = NULL (we cannot store new data),
+ * when the list is empty dec_in_dpy is NULL (we cannot display frames).
*/
struct video_in_desc {
struct video_codec_desc *dec; /* decoder */
@@ -2067,7 +2070,6 @@
/* prepare to decode: advance the buffer so the video thread knows. */
struct fbuf_t *tmp = v->dec_in_cur; /* store current pointer */
ast_mutex_lock(&v->dec_in_lock);
- fprintf(stderr, "using buffer %d\n", v->dec_in_cur - v->dec_in);
if (++v->dec_in_cur == &v->dec_in[N_DEC_IN]) /* advance to next, circular */
v->dec_in_cur = &v->dec_in[0];
if (v->dec_in_dpy == NULL) { /* were not displaying anything, so set it */
@@ -2121,6 +2123,13 @@
return v->enc->enc_encap(v, tail);
}
+/*
+ * I am seeing some kind of deadlock or stall around
+ * SDL_PumpEvents() while moving the window on a remote X server
+ * (Xfree86-4.4.0), but it is unclear what causes it.
+ * Could well be a problem on the X server I am using.
+ */
+
/* grab a bunch of events */
static void eventhandler(struct video_desc *env)
{
@@ -2128,16 +2137,24 @@
int i, n;
SDL_Event ev[N_EVENTS];
- return;
-
- while ( (n = SDL_PeepEvents(ev, N_EVENTS, SDL_GETEVENT, SDL_ALLEVENTS)) > 0) {
+#define MY_EV (SDL_MOUSEBUTTONDOWN|SDL_KEYDOWN)
+ while ( (n = SDL_PeepEvents(ev, N_EVENTS, SDL_GETEVENT, MY_EV)) > 0) {
for (i = 0; i < n; i++) {
ast_log(LOG_WARNING, "-- event %d at %d %d\n",
ev[i].type, ev[i].button.x, ev[i].button.y);
}
}
ast_log(LOG_WARNING, "-- no event, n %d\n", n);
- SDL_PumpEvents();
+ if (0) {
+ struct timeval a = ast_tvnow();
+ //SDL_Lock_EventThread();
+ a = ast_tvnow();
+ fprintf(stderr, "before Pump at %ld.%06lu\n", a.tv_sec, a.tv_usec);
+ SDL_PumpEvents();
+ a = ast_tvnow();
+ fprintf(stderr, "after Pump at %ld.%06lu\n", a.tv_sec, a.tv_usec);
+ //SDL_Unlock_EventThread();
+ }
}
static void sdl_setup(struct video_desc *env);
@@ -2188,8 +2205,12 @@
sprintf(buf, "hold");
SDL_WM_SetCaption(buf, NULL);
}
+ eventhandler(env);
/* sleep for a while */
- ast_select(0, NULL, NULL, NULL, &t);
+ if (1)
+ SDL_Delay(50);
+ else
+ ast_select(0, NULL, NULL, NULL, &t);
SDL_UpdateRects(env->screen, 1, &env->win[WIN_KEYPAD].rect);// XXX inefficient
/*
@@ -2214,7 +2235,6 @@
ast_mutex_unlock(&v->dec_in_lock);
}
- eventhandler(env);
f = get_video_frames(env, &p); /* read and display */
if (!f)
More information about the asterisk-commits
mailing list