From: Matthew Waters Date: Thu, 31 Mar 2016 08:35:09 +0000 (+1100) Subject: glbasememory: rollback map state when subclass map fails X-Git-Tag: 1.16.2~955^2~380 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1737c8ad77e69dad667d593fb1b2dccb51f3344;p=platform%2Fupstream%2Fgst-plugins-base.git glbasememory: rollback map state when subclass map fails Otherwise our state doesn't reflect reality. --- diff --git a/gst-libs/gst/gl/gstglbasememory.c b/gst-libs/gst/gl/gstglbasememory.c index 062c19c..7fc1d00 100644 --- a/gst-libs/gst/gl/gstglbasememory.c +++ b/gst-libs/gst/gl/gstglbasememory.c @@ -226,6 +226,8 @@ _map_data_gl (GstGLContext * context, struct map_data *transfer) GstGLBaseMemoryAllocatorClass *alloc_class; GstGLBaseMemory *mem = transfer->mem; GstMapInfo *info = transfer->info; + guint prev_map_flags; + guint prev_gl_map_count; alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (transfer->mem->mem.allocator); @@ -234,6 +236,9 @@ _map_data_gl (GstGLContext * context, struct map_data *transfer) g_mutex_lock (&mem->lock); + prev_map_flags = mem->map_flags; + prev_gl_map_count = mem->gl_map_count; + GST_CAT_LOG (GST_CAT_GL_BASE_MEMORY, "mapping mem %p flags %04x", mem, info->flags); @@ -267,6 +272,11 @@ _map_data_gl (GstGLContext * context, struct map_data *transfer) GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD); GST_MEMORY_FLAG_UNSET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD); } + } else { + /* undo state tracking on error */ + mem->map_flags = prev_map_flags; + mem->gl_map_count = prev_gl_map_count; + mem->map_count--; } g_mutex_unlock (&mem->lock);