Pipeline crashing when unrefing samples
Tim Müller
tim at centricular.com
Mon Feb 13 12:22:21 UTC 2017
On Mon, 2017-02-13 at 03:44 -0800, mizerb wrote:
Hi,
> Well, no. I'm pulling the buffer from the sample, and digging in, the
> call to
>
> gst_buffer_unref(buffer);
>
> causes the failure. Even while skipping out on the map and unmap
> calls. However, if i don't unref the sample, then unref on the buffer
> doesn't cause the issue to crop up. So it seems I can unref either
> the sample or the buffer, but not both.
The buffer "belongs" to the sample. You get a ref to the sample, and
you should unref the sample when you're done with it. When the sample
gets freed, it will free the buffer.
You must not unref the sample's buffer unless you explicitly took a ref
to it previously to acquire a ref of your own.
Similarly, you must also acquire a ref of your own before
gst_app_src_push-ing the buffer into appsrc, since appsrc takes
ownership of it (just in case that's what you plan on doing with it).
> Also, the unrefing the buffer causes the error:
> (snip)
That's just luck. It might also just crash or cause other weird
failures :)
Cheers
-Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel
mailing list