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
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-11-21 18:25:18 +01:00
parent 7f1b632c56
commit 3285121181

View file

@ -458,20 +458,18 @@ set_display_res:
} }
static gboolean 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); 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)) if (!gst_vaapi_plugin_base_set_caps (plugin, decode->sinkpad_caps, NULL))
return FALSE; return FALSE;
if (!gst_vaapidecode_update_src_caps (decode)) if (!gst_vaapidecode_update_src_caps (decode))
return FALSE; return FALSE;
if (!gst_vaapi_plugin_base_set_caps (plugin, NULL, decode->srcpad_caps)) if (!gst_vaapi_plugin_base_set_caps (plugin, NULL, decode->srcpad_caps))
return FALSE; return FALSE;
if (!gst_video_decoder_negotiate (vdec)) if (!GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (vdec))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -509,8 +507,8 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec,
if (gst_pad_needs_reconfigure (GST_VIDEO_DECODER_SRC_PAD (vdec)) if (gst_pad_needs_reconfigure (GST_VIDEO_DECODER_SRC_PAD (vdec))
|| alloc_renegotiate || caps_renegotiate) { || alloc_renegotiate || caps_renegotiate) {
GST_INFO_OBJECT (decode, "input codec state changed: renegotiating");
if (!gst_vaapidecode_negotiate (decode)) if (!gst_video_decoder_negotiate (vdec))
return GST_FLOW_ERROR; 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->sink_query = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_query);
vdec_class->getcaps = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_getcaps); vdec_class->getcaps = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_getcaps);
vdec_class->sink_event = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_event); 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), map = (GstVaapiDecoderMap *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
GST_VAAPI_DECODE_PARAMS_QDATA); GST_VAAPI_DECODE_PARAMS_QDATA);