plugins: first validate the out caps

When calling _set_caps() first validate the out caps before doing
anything else.
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-11-21 18:27:00 +01:00
parent f09d9ff2ab
commit ec364858b1

View file

@ -740,19 +740,19 @@ gst_vaapi_plugin_base_set_caps (GstVaapiPluginBase * plugin, GstCaps * incaps,
GstCaps * outcaps) GstCaps * outcaps)
{ {
if (incaps && incaps != plugin->sinkpad_caps) { if (incaps && incaps != plugin->sinkpad_caps) {
g_clear_object (&plugin->sinkpad_allocator);
gst_caps_replace (&plugin->sinkpad_caps, incaps);
if (!gst_video_info_from_caps (&plugin->sinkpad_info, incaps)) if (!gst_video_info_from_caps (&plugin->sinkpad_info, incaps))
return FALSE; return FALSE;
g_clear_object (&plugin->sinkpad_allocator);
gst_caps_replace (&plugin->sinkpad_caps, incaps);
plugin->sinkpad_caps_is_raw = !gst_caps_has_vaapi_surface (incaps); plugin->sinkpad_caps_is_raw = !gst_caps_has_vaapi_surface (incaps);
} }
if (outcaps && outcaps != plugin->srcpad_caps) { if (outcaps && outcaps != plugin->srcpad_caps) {
if (!gst_video_info_from_caps (&plugin->srcpad_info, outcaps))
return FALSE;
g_clear_object (&plugin->srcpad_allocator); g_clear_object (&plugin->srcpad_allocator);
gst_caps_replace (&plugin->srcpad_caps, outcaps); gst_caps_replace (&plugin->srcpad_caps, outcaps);
plugin_reset_texture_map (plugin); plugin_reset_texture_map (plugin);
if (!gst_video_info_from_caps (&plugin->srcpad_info, outcaps))
return FALSE;
} }
if (!ensure_sinkpad_buffer_pool (plugin, plugin->sinkpad_caps)) if (!ensure_sinkpad_buffer_pool (plugin, plugin->sinkpad_caps))