<div dir="ltr"><p>Hi,<br></p><p>I have a GStreamer pipeline with an appsink:</p>
<pre class="gmail-lang-py gmail-s-code-block gmail-hljs gmail-python"><code>filesrc location=test.mp4 ! decodebin ! video/x-raw ! queue max-size-bytes=<span class="gmail-hljs-number">0</span> max-size-time=<span class="gmail-hljs-number">100000000</span> ! appsink name=appSink sync=false max-buffers=<span class="gmail-hljs-number">1</span> drop=false
</code></pre>
<p>I pull a sample from the appsink then I get the buffer, map it read-only and store the map info (to access raw memory later):</p>
<pre class="gmail-lang-py gmail-s-code-block gmail-hljs gmail-python"><code>sample: Gst.Sample = self.__sink.pull_sample()
self.__buffer: Gst.Buffer = sample.get_buffer()
self.__buffer_map: Gst.MapInfo = self.__buffer.map(Gst.MapFlags.READ)
</code></pre>
<p>Then I would like to use the same data (without copying it) in an output pipeline for e.g.:</p>
<pre class="gmail-lang-py gmail-s-code-block gmail-hljs gmail-python"><code>appsrc name=appSrc block=true ! video/x-raw,format=(string)NV12,width=<span class="gmail-hljs-number">1920</span>,height=<span class="gmail-hljs-number">1080</span>,framerate=<span class="gmail-hljs-number">30</span>/<span class="gmail-hljs-number">1</span> ! videoconvert ! ximagesink
</code></pre>
<p>To do this it is the best I could come up with:</p>
<pre class="gmail-lang-py gmail-s-code-block gmail-hljs gmail-python"><code>shared_buffer_memory = self.__buffer.get_all_memory()
buf = Gst.Buffer.new()
buf.insert_memory(<span class="gmail-hljs-number">-1</span>, shared_buffer_memory)
self.__src.push_buffer(buf)
<span class="gmail-hljs-comment">#sleep(0.05) </span>
</code></pre>
<p>If I do this I see the first frame correctly but all the other frames
 are green. It is fine, because the underlying memory of buf goes out of
 scope and freed meanwhile. If I put sleep(0.05) after push_buffer it 
displays all of the frames, but I think the memory behind the buffer is 
double-freed:</p>
<pre class="gmail-lang-py gmail-s-code-block gmail-hljs gmail-python"><code>** (python3<span class="gmail-hljs-number">.9</span>:<span class="gmail-hljs-number">6745</span>): CRITICAL **: <span class="gmail-hljs-number">09</span>:<span class="gmail-hljs-number">23</span>:<span class="gmail-hljs-number">54.645</span>: gst_vaapi_image_unmap: assertion <span class="gmail-hljs-string">'image != NULL'</span> failed
</code></pre>
<p>I would like to get the frames from the appsink then push them into 
output pipelines without copy. What would be the best approach to do 
this? (a single pipeline is not suitable in my case)</p><p>Kind regards,<br>Adam<br></p></div>