summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-11-04 12:55:23 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-11-08 09:37:41 +0100
commit869ca5e88780a4dbaea0be18ef4167ca19c7a0dc (patch)
tree4a2fb8ead58fc6251f407855377b099d0cf4f37e
parentb60e2df63d8e1c214021dfb8a2bc302ce03eb97a (diff)
vaapivideomemory: increment map counter only if succeeded
Previously the frame map counter increased independently if the map succeeded or not. This leaded to critical messages and crashes if the frame was unable to be mapped, but the counter increased. This patch increases the map counter only if the map operation occurred. https://bugzilla.gnome.org/show_bug.cgi?id=773939
-rw-r--r--gst/vaapi/gstvaapivideomemory.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapivideomemory.c b/gst/vaapi/gstvaapivideomemory.c
index 00f6a85d..c4cf6232 100644
--- a/gst/vaapi/gstvaapivideomemory.c
+++ b/gst/vaapi/gstvaapivideomemory.c
@@ -201,7 +201,7 @@ gst_video_meta_map_vaapi_memory (GstVideoMeta * meta, guint plane,
goto error_incompatible_map;
/* Map for writing */
- if (++mem->map_count == 1) {
+ if (mem->map_count == 0) {
if (!ensure_surface (mem))
goto error_ensure_surface;
if (!ensure_image (mem))
@@ -220,6 +220,7 @@ gst_video_meta_map_vaapi_memory (GstVideoMeta * meta, guint plane,
GST_VAAPI_VIDEO_MEMORY_FLAG_UNSET (mem,
GST_VAAPI_VIDEO_MEMORY_FLAG_SURFACE_IS_CURRENT);
}
+ mem->map_count++;
*data = gst_vaapi_image_get_plane (mem->image, plane);
*stride = gst_vaapi_image_get_pitch (mem->image, plane);