decoder: fix crash on invalid pointer for GST_DEBUG().

When decoding failed, or that the frame was dropped, the associated
surface proxy is not guaranteed to be present. Thus, the GST_DEBUG()
message needs to check whether the proxy is actually present or not.

https://bugzilla.gnome.org/show_bug.cgi?id=722403

[fixed gst_vaapi_surface_proxy_get_surface_id() to return VA_INVALID_ID]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Wind Yuan 2014-01-17 16:56:53 +08:00 committed by Gwenole Beauchesne
parent deff9c775c
commit 0e8afe1c22
2 changed files with 3 additions and 3 deletions

View file

@ -394,7 +394,7 @@ pop_frame(GstVaapiDecoder *decoder, guint64 timeout)
proxy = frame->user_data;
GST_DEBUG("dequeue decoded surface %" GST_VAAPI_ID_FORMAT,
GST_VAAPI_ID_ARGS(GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy)));
GST_VAAPI_ID_ARGS(gst_vaapi_surface_proxy_get_surface_id(proxy)));
return frame;
}

View file

@ -239,8 +239,8 @@ gst_vaapi_surface_proxy_get_flags(GstVaapiSurfaceProxy *proxy)
GstVaapiID
gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy)
{
g_return_val_if_fail(proxy != NULL, 0);
g_return_val_if_fail(proxy->surface != NULL, 0);
g_return_val_if_fail(proxy != NULL, VA_INVALID_ID);
g_return_val_if_fail(proxy->surface != NULL, VA_INVALID_ID);
return GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy);
}