diff options
author | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2016-07-12 17:54:26 +0200 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2016-07-22 17:23:23 +0200 |
commit | cc6c2d23ce1adf2235412b26f2f8637b3630f697 (patch) | |
tree | da64beeba1078a3442c399bddd590a3577aa7b6d | |
parent | 0faff37e73ccb5f513b337ae0eae640fcf655295 (diff) |
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
-rw-r--r-- | gst/vaapi/gstvaapidecode.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index af2a97c1..5ed1c38f 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -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 @@ -984,6 +972,27 @@ gst_vaapidecode_close (GstVideoDecoder * vdec) } 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) { GstVaapiDecode *const decode = GST_VAAPIDECODE (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); |