diff options
author | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2015-05-07 15:57:26 +0200 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com> | 2015-06-22 16:38:29 +0200 |
commit | 0df96e1c3be63770672b097e43fac119a8434316 (patch) | |
tree | 8b31a57943eca089c91bdeb588d8d651b6b96209 | |
parent | 34a4748d3d65fd4df5b2c9b09e066af752f9aeea (diff) |
vaapisink: error handling if rendering fails
This patch enhance the code path when an error is found when rendering a
buffer.
If the video meta doesn't contain a surface proxy or a surface, a warning
message is printed.
If the rendering backend fails, a error message is posted in the bus.
https://bugzilla.gnome.org/show_bug.cgi?id=749382
-rw-r--r-- | gst/vaapi/gstvaapisink.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index 8f4eb020..82769684 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -1356,19 +1356,19 @@ gst_vaapisink_show_frame_unlocked (GstVaapiSink * sink, GstBuffer * src_buffer) proxy = gst_vaapi_video_meta_get_surface_proxy (meta); if (!proxy) - goto error; + goto no_surface; surface = gst_vaapi_video_meta_get_surface (meta); if (!surface) - goto error; + goto no_surface; /* Validate view component to display */ view_id = GST_VAAPI_SURFACE_PROXY_VIEW_ID (proxy); if (G_UNLIKELY (sink->view_id == -1)) sink->view_id = view_id; else if (sink->view_id != view_id) { - gst_buffer_unref (buffer); - return GST_FLOW_OK; + ret = GST_FLOW_OK; + goto done; } gst_vaapisink_ensure_colorbalance (sink); @@ -1404,13 +1404,24 @@ gst_vaapisink_show_frame_unlocked (GstVaapiSink * sink, GstBuffer * src_buffer) /* Retain VA surface until the next one is displayed */ gst_buffer_replace (&sink->video_buffer, buffer); - gst_buffer_unref (buffer); - return GST_FLOW_OK; + ret = GST_FLOW_OK; -error: +done: gst_buffer_unref (buffer); - return GST_FLOW_EOS; + return ret; + +error: + GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, + ("Internal error: could not render surface"), (NULL)); + ret = GST_FLOW_ERROR; + goto done; + +no_surface: + /* No surface or surface proxy. That's very bad! */ + GST_WARNING_OBJECT (sink, "could not get surface"); + ret = GST_FLOW_ERROR; + goto done; } static GstFlowReturn |