diff options
author | Julien Moutte <julien@moutte.net> | 2007-01-07 18:50:13 +0000 |
---|---|---|
committer | Julien Moutte <julien@moutte.net> | 2007-01-07 18:50:13 +0000 |
commit | 50d428b9563fb89309d7606e8cc8eb9f984e9f09 (patch) | |
tree | 6250ab7af995f0c4c85f52dd9b2e873b0c0eb857 /tests/icles | |
parent | e69b94048d852d8a618ba2cf3fce864faec1b790 (diff) |
sys/: Use flow_lock much more to protect every access to xwindow.
Original commit message from CVS:
2007-01-07 Julien MOUTTE <julien@moutte.net>
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximagesink_handle_xerror), (gst_ximagesink_ximage_new),
(gst_ximagesink_ximage_destroy), (gst_ximagesink_ximage_put),
(gst_ximagesink_handle_xevents), (gst_ximagesink_setcaps),
(gst_ximagesink_change_state), (gst_ximagesink_set_xwindow_id),
(gst_ximagesink_expose), (gst_ximagesink_set_event_handling):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimagesink_handle_xerror),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_handle_xevents), (gst_xvimagesink_setcaps),
(gst_xvimagesink_change_state),
(gst_xvimagesink_set_xwindow_id),
(gst_xvimagesink_expose), (gst_xvimagesink_set_event_handling):
Use flow_lock much more to protect every access to xwindow.
Try to catch erros while creating images in case some drivers
are
just generating an XError when the requested image is too big.
Should fix : #354698, #384008, #384060.
* tests/icles/stress-xoverlay.c: (cycle_window),
(create_window):
Implement some stress testing of setting window xid.
Diffstat (limited to 'tests/icles')
-rw-r--r-- | tests/icles/stress-xoverlay.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/tests/icles/stress-xoverlay.c b/tests/icles/stress-xoverlay.c index 63d8bb06c..8dcaaef68 100644 --- a/tests/icles/stress-xoverlay.c +++ b/tests/icles/stress-xoverlay.c @@ -33,7 +33,7 @@ static GMainLoop *loop; static Display *disp; -static Window root, win; +static Window root, win = 0; static GC gc; static gint width = 320, height = 240, x = 0, y = 0; static gint disp_width, disp_height; @@ -111,10 +111,37 @@ toggle_events (GstXOverlay * ov) return TRUE; } +static gboolean +cycle_window (GstXOverlay * ov) +{ + XGCValues values; + Window old_win = win; + GC old_gc = gc; + + win = XCreateSimpleWindow (disp, root, 0, 0, width, height, 0, 0, 0); + + XSetWindowBackgroundPixmap (disp, win, None); + + gc = XCreateGC (disp, win, 0, &values); + + XMapRaised (disp, win); + + XSync (disp, FALSE); + + gst_x_overlay_set_xwindow_id (ov, win); + + if (old_win) { + XDestroyWindow (disp, old_win); + XFreeGC (disp, old_gc); + XSync (disp, FALSE); + } + + return TRUE; +} + static GstBusSyncReply create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) { - XGCValues values; const GstStructure *s; GstXOverlay *ov = NULL; @@ -127,20 +154,11 @@ create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) g_print ("Creating our own window\n"); - win = XCreateSimpleWindow (disp, root, 0, 0, width, height, 0, 0, 0); - - XSetWindowBackgroundPixmap (disp, win, None); - - gc = XCreateGC (disp, win, 0, &values); - - XMapRaised (disp, win); - - XSync (disp, FALSE); - - gst_x_overlay_set_xwindow_id (ov, win); + cycle_window (ov); g_timeout_add (50, (GSourceFunc) resize_window, pipeline); g_timeout_add (50, (GSourceFunc) move_window, pipeline); + g_timeout_add (100, (GSourceFunc) cycle_window, ov); g_timeout_add (2000, (GSourceFunc) toggle_events, ov); return GST_BUS_DROP; |