buffer ownership when pushing to appsrc

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

buffer ownership when pushing to appsrc

Слободенюк Александр Игоревич
Hi everybody! Happy new year!!
 
I guess I've found a little mismatch in the documentation, and can't understand, where's the truth.
It's about appsrc's push-buffer signal :
 
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-appsrc.html#gst-app-src-push-buffer
 
The documentation says:
"This function takes ownership of the buffer." .
 
It looks the same comparing to gst_pad_push function:
"In all cases, success or failure, the caller loses its reference to buffer after calling this function."
 
And what I can also see, is that gst-plugins-good's plugins don't unref the output buffer after pushing it downstream.
 
 
But when we take a look at tutorial 8 "Short-cutting the pipeline" :
 
we see next code:
 
  /* Push the buffer into the appsrc */
  g_signal_emit_by_name (data->app_source, "push-buffer", buffer, &ret);

  /* Free the buffer now that we are done with it */
  gst_buffer_unref (buffer);
 
 
So, thanks for your attention, hope to clear this moment.
 
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: +7-925-050-64-62
 

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: buffer ownership when pushing to appsrc

Nicolas Dufresne-5


Le 5 janv. 2018 7:05 AM, "Слободенюк Александр Игоревич" <[hidden email]> a écrit :
Hi everybody! Happy new year!!
 
I guess I've found a little mismatch in the documentation, and can't understand, where's the truth.
It's about appsrc's push-buffer signal :
 
 
The documentation says:
"This function takes ownership of the buffer." .
 
It looks the same comparing to gst_pad_push function:
"In all cases, success or failure, the caller loses its reference to buffer after calling this function."
 
And what I can also see, is that gst-plugins-good's plugins don't unref the output buffer after pushing it downstream.
 
 
But when we take a look at tutorial 8 "Short-cutting the pipeline" :
 
we see next code:
 
  /* Push the buffer into the appsrc */
  g_signal_emit_by_name (data->app_source, "push-buffer", buffer, &ret);

  /* Free the buffer now that we are done with it */
  gst_buffer_unref (buffer);
 
 
So, thanks for your attention, hope to clear this moment.

Unless I'm missing something, it looks like a bug in the tutorial. Can you file a bug at bugs.gnome.org ?


 
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: <a href="tel:+7%20925%20050-64-62" value="+79250506462" target="_blank">+7-925-050-64-62
 

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: buffer ownership when pushing to appsrc

Sebastian Dröge-3
On Fri, 2018-01-05 at 15:38 -0500, Nicolas Dufresne wrote:
> [...]
> >  
> >  
> > So, thanks for your attention, hope to clear this moment.
>
> Unless I'm missing something, it looks like a bug in the tutorial.
> Can you file a bug at bugs.gnome.org ?

No, this is actually correct. gst_app_src_push_buffer() the function
takes ownership of the buffer, the signal doesn't and can't. Signal
arguments are only borrowed by the signal handlers, ownership stays
with the signal emitter.

--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: buffer ownership when pushing to appsrc

Nicolas Dufresne-5


Le 5 janv. 2018 4:20 PM, "Sebastian Dröge" <[hidden email]> a écrit :
On Fri, 2018-01-05 at 15:38 -0500, Nicolas Dufresne wrote:
> [...]
> >
> >
> > So, thanks for your attention, hope to clear this moment.
>
> Unless I'm missing something, it looks like a bug in the tutorial.
> Can you file a bug at bugs.gnome.org ?

No, this is actually correct. gst_app_src_push_buffer() the function
takes ownership of the buffer, the signal doesn't and can't. Signal
arguments are only borrowed by the signal handlers, ownership stays
with the signal emitter.

Ok, still worth filing a bug, we could add a mention in the signal handler, even if slightly redundant, it would help.



--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: buffer ownership when pushing to appsrc

Слободенюк Александр Игоревич
Thanks a lot, now I see.
 
 
It was tricky, because I didn't find the documentation for signal in the web.
But in appsrc's code it exists:
 
/**
    * GstAppSrc::push-buffer:
    * @appsrc: the appsrc
    * @buffer: a buffer to push
    *
    * Adds a buffer to the queue of buffers that the appsrc element will
    * push to its source pad. This function does not take ownership of the
    * buffer so the buffer needs to be unreffed after calling this function.
    *
 
And the web-page only says:
----
The main way of handing data to the appsrc element is by calling the gst_app_src_push_buffer() method or by emitting the push-buffer action signal.
----
 
is not a signal handler for "push-buffer", that's what's tricky.
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: +7-925-050-64-62
 
 
 
06.01.2018, 05:01, "Nicolas Dufresne" <[hidden email]>:
 
 
Le 5 janv. 2018 4:20 PM, "Sebastian Dröge" <[hidden email]> a écrit :
On Fri, 2018-01-05 at 15:38 -0500, Nicolas Dufresne wrote:
> [...]
> >
> >
> > So, thanks for your attention, hope to clear this moment.
>
> Unless I'm missing something, it looks like a bug in the tutorial.
> Can you file a bug at bugs.gnome.org ?
 
No, this is actually correct. gst_app_src_push_buffer() the function
takes ownership of the buffer, the signal doesn't and can't. Signal
arguments are only borrowed by the signal handlers, ownership stays
with the signal emitter.
 
Ok, still worth filing a bug, we could add a mention in the signal handler, even if slightly redundant, it would help.
 
 
 
--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
 
,

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: buffer ownership when pushing to appsrc

Слободенюк Александр Игоревич
In reply to this post by Nicolas Dufresne-5
Created a minor bug: https://bugzilla.gnome.org/show_bug.cgi?id=792265
Once again, thanks for help.
 
-- 
С уважением,
Слободенюк Александр Игоревич
 
контактный телефон: +7-925-050-64-62
 
 
 
06.01.2018, 05:01, "Nicolas Dufresne" <[hidden email]>:
 
 
Le 5 janv. 2018 4:20 PM, "Sebastian Dröge" <[hidden email]> a écrit :
On Fri, 2018-01-05 at 15:38 -0500, Nicolas Dufresne wrote:
> [...]
> >
> >
> > So, thanks for your attention, hope to clear this moment.
>
> Unless I'm missing something, it looks like a bug in the tutorial.
> Can you file a bug at bugs.gnome.org ?
 
No, this is actually correct. gst_app_src_push_buffer() the function
takes ownership of the buffer, the signal doesn't and can't. Signal
arguments are only borrowed by the signal handlers, ownership stays
with the signal emitter.
 
Ok, still worth filing a bug, we could add a mention in the signal handler, even if slightly redundant, it would help.
 
 
 
--
Sebastian Dröge, Centricular Ltd · https://www.centricular.com


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
 
,

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel