vaapisink: fix display initialization in GstVideoOverlay implementation.

When gst_vaapisink_video_overlay_set_window_handle() is called early,
before the pipeline has been set to PLAYING, the display has not yet
been initialized and _PLUGIN_BASE_DISPLAY_TYPE() is not yet
up-to-date. For this reason the foreign XID is not attached.

Now _ensure_display() is called earlier.

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

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Holger Kaelberer 2014-01-15 10:05:45 +01:00 committed by Gwenole Beauchesne
parent dd6751ed47
commit f8666e2cae

View file

@ -139,6 +139,9 @@ enum {
#define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_ANY #define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_ANY
#define DEFAULT_ROTATION GST_VAAPI_ROTATION_0 #define DEFAULT_ROTATION GST_VAAPI_ROTATION_0
static inline gboolean
gst_vaapisink_ensure_display(GstVaapiSink *sink);
/* GstVideoOverlay interface */ /* GstVideoOverlay interface */
#if USE_X11 #if USE_X11
@ -154,7 +157,11 @@ gst_vaapisink_video_overlay_set_window_handle(GstVideoOverlay *overlay,
guintptr window) guintptr window)
{ {
GstVaapiSink * const sink = GST_VAAPISINK(overlay); GstVaapiSink * const sink = GST_VAAPISINK(overlay);
GstVaapiDisplayType display_type = GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE(sink); GstVaapiDisplayType display_type;
if (!gst_vaapisink_ensure_display(sink))
return;
display_type = GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE(sink);
/* Disable GLX rendering when vaapisink is using a foreign X /* Disable GLX rendering when vaapisink is using a foreign X
window. It's pretty much useless */ window. It's pretty much useless */