vaapidecode: delay the GstVaapiDisplay instantiating

Delay the GstVaapiDisplay instantiating until when changing the state from
READY to PAUSE. In this way the element has more chances to find an already
created GstVaapiDisplay, or a GL context, in the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=766206
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-07-12 17:54:26 +02:00
parent 0faff37e73
commit cc6c2d23ce

View file

@ -950,8 +950,6 @@ static gboolean
gst_vaapidecode_open (GstVideoDecoder * vdec)
{
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
GstVaapiDisplay *const old_display = GST_VAAPI_PLUGIN_BASE_DISPLAY (decode);
gboolean success;
if (!gst_vaapi_plugin_base_open (GST_VAAPI_PLUGIN_BASE (decode)))
return FALSE;
@ -960,17 +958,7 @@ gst_vaapidecode_open (GstVideoDecoder * vdec)
decode->display_height = 0;
gst_video_info_init (&decode->decoded_info);
/* Let GstVideoContext ask for a proper display to its neighbours */
/* Note: steal old display that may be allocated from get_caps()
so that to retain a reference to it, thus avoiding extra
initialization steps if we turn out to simply re-use the
existing (cached) VA display */
GST_VAAPI_PLUGIN_BASE_DISPLAY (decode) = NULL;
success = gst_vaapidecode_ensure_display (decode);
if (old_display)
gst_vaapi_display_unref (old_display);
return success;
return TRUE;
}
static gboolean
@ -983,6 +971,27 @@ gst_vaapidecode_close (GstVideoDecoder * vdec)
return TRUE;
}
static gboolean
gst_vaapidecode_start (GstVideoDecoder * vdec)
{
GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec);
GstVaapiDisplay *const old_display = GST_VAAPI_PLUGIN_BASE_DISPLAY (decode);
gboolean success;
/* Let GstVideoContext ask for a proper display to its neighbours */
/* Note: steal old display that may be allocated from get_caps()
so that to retain a reference to it, thus avoiding extra
initialization steps if we turn out to simply re-use the
existing (cached) VA display */
GST_VAAPI_PLUGIN_BASE_DISPLAY (decode) = NULL;
success =
gst_vaapi_plugin_base_ensure_display (GST_VAAPI_PLUGIN_BASE (decode));
if (old_display)
gst_vaapi_display_unref (old_display);
return success;
}
static gboolean
gst_vaapidecode_stop (GstVideoDecoder * vdec)
{
@ -1280,6 +1289,7 @@ gst_vaapidecode_class_init (GstVaapiDecodeClass * klass)
vdec_class->open = GST_DEBUG_FUNCPTR (gst_vaapidecode_open);
vdec_class->close = GST_DEBUG_FUNCPTR (gst_vaapidecode_close);
vdec_class->start = GST_DEBUG_FUNCPTR (gst_vaapidecode_start);
vdec_class->stop = GST_DEBUG_FUNCPTR (gst_vaapidecode_stop);
vdec_class->set_format = GST_DEBUG_FUNCPTR (gst_vaapidecode_set_format);
vdec_class->flush = GST_DEBUG_FUNCPTR (gst_vaapidecode_flush);