mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
buffer: fix the _get_mapped function
Fix the internal _get_mapped function. gst_memory_make_mapped() takes ownership of the memory so we need to keep an additional ref until we are done.
This commit is contained in:
parent
2c88afb992
commit
db65bfa129
1 changed files with 6 additions and 7 deletions
|
@ -785,18 +785,17 @@ _get_mapped (GstBuffer * buffer, guint idx, GstMapInfo * info,
|
|||
{
|
||||
GstMemory *mem, *mapped;
|
||||
|
||||
mem = GST_BUFFER_MEM_PTR (buffer, idx);
|
||||
mem = gst_memory_ref (GST_BUFFER_MEM_PTR (buffer, idx));
|
||||
|
||||
mapped = gst_memory_make_mapped (mem, info, flags);
|
||||
if (!mapped)
|
||||
return NULL;
|
||||
|
||||
if (mapped != mem) {
|
||||
if (mapped && mapped != mem) {
|
||||
/* new memory, replace old memory */
|
||||
GST_BUFFER_MEM_PTR (buffer, idx) = mapped;
|
||||
gst_memory_unref (mem);
|
||||
mem = mapped;
|
||||
}
|
||||
return mem;
|
||||
gst_memory_unref (mem);
|
||||
|
||||
return mapped;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue