xvimagesink: don't recreate xvcontext
authorHolger Kaelberer <hk@getslash.de>
Tue, 14 Jan 2014 22:07:34 +0000 (23:07 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 15 Jan 2014 10:06:09 +0000 (11:06 +0100)
A xvcontext can be created early in gst_xvimagesink_set_window_handle().
In this case don't recreate, i.e. overwrite it in gst_xvimagesink_open().
Otherwise XEvents won't be handled in the xevent listener thread.

Fixes a regression when setting the window handle on the sink in
the very beginning before changing its state.

https://bugzilla.gnome.org/show_bug.cgi?id=715138

sys/xvimage/xvimagesink.c

index eddd757..30e7538 100644 (file)
@@ -1728,17 +1728,20 @@ gst_xvimagesink_get_property (GObject * object, guint prop_id,
 static gboolean
 gst_xvimagesink_open (GstXvImageSink * xvimagesink)
 {
-  GstXvContext *context;
   GError *error = NULL;
 
-  /* Initializing the XvContext */
-  if (!(context = gst_xvcontext_new (&xvimagesink->config, &error)))
-    goto no_context;
+  /* Initializing the XvContext unless already done through GstVideoOverlay */
+  if (!xvimagesink->context) {
+    GstXvContext *context;
+    if (!(context = gst_xvcontext_new (&xvimagesink->config, &error)))
+      goto no_context;
 
-  GST_OBJECT_LOCK (xvimagesink);
-  xvimagesink->context = context;
+    GST_OBJECT_LOCK (xvimagesink);
+    xvimagesink->context = context;
+  } else
+    GST_OBJECT_LOCK (xvimagesink);
   /* make an allocator for this context */
-  xvimagesink->allocator = gst_xvimage_allocator_new (context);
+  xvimagesink->allocator = gst_xvimage_allocator_new (xvimagesink->context);
   GST_OBJECT_UNLOCK (xvimagesink);
 
   /* update object's par with calculated one if not set yet */