From 3285121181295c544480fc6ba756845b16285d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 21 Nov 2016 18:25:18 +0100 Subject: [PATCH] vaapidecode: implement negotiate() vmethod Instead of decorating the negotiate() method, let us override it, so the stream is locked while called. https://bugzilla.gnome.org/show_bug.cgi?id=775040 --- gst/vaapi/gstvaapidecode.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index db490615de..6d9e21527a 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -458,20 +458,18 @@ set_display_res: } static gboolean -gst_vaapidecode_negotiate (GstVaapiDecode * decode) +gst_vaapidecode_negotiate (GstVideoDecoder * vdec) { - GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode); + GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec); GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (vdec); - GST_DEBUG_OBJECT (decode, "Input codec state changed, doing renegotiation"); - if (!gst_vaapi_plugin_base_set_caps (plugin, decode->sinkpad_caps, NULL)) return FALSE; if (!gst_vaapidecode_update_src_caps (decode)) return FALSE; if (!gst_vaapi_plugin_base_set_caps (plugin, NULL, decode->srcpad_caps)) return FALSE; - if (!gst_video_decoder_negotiate (vdec)) + if (!GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (vdec)) return FALSE; return TRUE; @@ -509,8 +507,8 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, if (gst_pad_needs_reconfigure (GST_VIDEO_DECODER_SRC_PAD (vdec)) || alloc_renegotiate || caps_renegotiate) { - - if (!gst_vaapidecode_negotiate (decode)) + GST_INFO_OBJECT (decode, "input codec state changed: renegotiating"); + if (!gst_video_decoder_negotiate (vdec)) return GST_FLOW_ERROR; } @@ -1310,6 +1308,7 @@ gst_vaapidecode_class_init (GstVaapiDecodeClass * klass) vdec_class->sink_query = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_query); vdec_class->getcaps = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_getcaps); vdec_class->sink_event = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_event); + vdec_class->negotiate = GST_DEBUG_FUNCPTR (gst_vaapidecode_negotiate); map = (GstVaapiDecoderMap *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), GST_VAAPI_DECODE_PARAMS_QDATA);