Mapping appsink buffer as READWRITE always copies data

Michael Gruner michael.gruner at ridgerun.com
Mon Sep 21 20:45:25 UTC 2020


Thanks for the quick response Sebastian. Here’s the issue:

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/824



> On Sep 19, 2020, at 01:06, Sebastian Dröge <sebastian at centricular.com> wrote:
> 
> On Fri, 2020-09-18 at 19:22 -0600, Michael Gruner wrote:
>> Here’s my log from the minimal example:
>> Sample refcount: 2
>> Buffer 1 refcount: 1
>> Buffer 1 is writable: 0
>> Buffer 2 refcount: 1. <———— Made the buffer writable
>> Buffer 2 is writable: 1
>> Memcpy below
> 
> The buffer is not writable because its parent (the sample) is not
> writable (has a reference count > 1). This happens because appsink
> caches the sample to not have to re-create it for every buffer.
> 
> This changed relatively recently, both the caching of the sample inside
> appsink and the considering of the parent reference count for
> determining writability. The latter is needed to fix memory corruption
> that can otherwise happen.
> 
> 
> Best to create an issue in GitLab about this so it can be discussed. It
> seems rather unfortunate and probably means that something should be
> fixed there.
> 
> -- 
> Sebastian Dröge, Centricular Ltd · https://www.centricular.com
> 
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list