A successful gst_dmabuf_mem_map must always increment the mmap count.
Otherwise the first gst_dmabuf_mem_unmap will unmap the memory and all
other user will access unmapped memory.
https://bugzilla.gnome.org/show_bug.cgi?id=706680
if (mem->data) {
/* only return address if mapping flags are a subset
* of the previous flags */
- if ((mem->mmapping_flags & prot) && (mem->mmap_size >= maxsize))
+ if ((mem->mmapping_flags & prot) && (mem->mmap_size >= maxsize)) {
ret = mem->data;
+ mem->mmap_count++;
+ }
goto out;
}