mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
glmemorypbo: unmap pbo memory on pbo read error
Otherwise we are returning failure with a dangling map! Also only unset the NEED_DOWNLOAD flag in download_transfer() if the read actually succeeds.
This commit is contained in:
parent
ccbf43987f
commit
99dfbf8ed9
1 changed files with 6 additions and 3 deletions
|
@ -305,8 +305,10 @@ _pbo_download_transfer (GstGLMemoryPBO * gl_mem, GstMapInfo * info, gsize size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!_read_pixels_to_pbo (gl_mem))
|
||||
if (!_read_pixels_to_pbo (gl_mem)) {
|
||||
gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gst_memory_unmap (GST_MEMORY_CAST (gl_mem->pbo), &info);
|
||||
}
|
||||
|
@ -785,10 +787,11 @@ _download_transfer (GstGLContext * context, GstGLMemoryPBO * gl_mem)
|
|||
GstGLBaseMemory *mem = (GstGLBaseMemory *) gl_mem;
|
||||
|
||||
g_mutex_lock (&mem->lock);
|
||||
if (_read_pixels_to_pbo (gl_mem))
|
||||
if (_read_pixels_to_pbo (gl_mem)) {
|
||||
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "optimistic download of texture %u "
|
||||
"using pbo %u", gl_mem->mem.tex_id, gl_mem->pbo->id);
|
||||
GST_MEMORY_FLAG_UNSET (gl_mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
|
||||
GST_MEMORY_FLAG_UNSET (gl_mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
|
||||
}
|
||||
g_mutex_unlock (&mem->lock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue