decoder: fix crash on invalid pointer for GST_DEBUG().
authorWind Yuan <feng.yuan@intel.com>
Fri, 17 Jan 2014 08:56:53 +0000 (16:56 +0800)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 22 Jan 2014 17:30:26 +0000 (18:30 +0100)
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>
gst-libs/gst/vaapi/gstvaapidecoder.c
gst-libs/gst/vaapi/gstvaapisurfaceproxy.c

index 8a8fa4c..8b05f7b 100644 (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;
 }
index 82432f0..516cb13 100644 (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);
 }