After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752363 - appsrc: add support for pushing buffer lists
appsrc: add support for pushing buffer lists
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 750241
Blocks:
 
 
Reported: 2015-07-14 07:44 UTC by Nicola
Modified: 2017-12-09 11:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
appsrc: extract buffer for a buffer list in a sample (1.76 KB, patch)
2015-07-14 07:44 UTC, Nicola
none Details | Review
appsink: add support for buffer lists (15.12 KB, patch)
2016-08-30 11:26 UTC, Patricia Muscalu
committed Details | Review
appsrc: add support for pushing buffer lists (15.30 KB, patch)
2017-09-17 12:17 UTC, Tim-Philipp Müller
committed Details | Review

Description Nicola 2015-07-14 07:44:32 UTC
Created attachment 307395 [details] [review]
appsrc: extract buffer for a buffer list in a sample

This is the first patch, 

I'll try to do another patch to keep compatibility with existing applications (1.0->1.4) that does not expect a buffer list in a sample pulled from appsink
Comment 1 Nicola 2015-07-14 09:14:50 UTC
regarding appsink it does not support buffer lists so no change is needed, now that gst_sample can have bufferlist maybe we should document that the sample pulled from appsink will not contain buffer list but only buffers
Comment 2 Patricia Muscalu 2016-06-30 13:35:08 UTC
What is the reason of not having buffer list support in appsink?
Comment 3 Sebastian Dröge (slomo) 2016-06-30 20:37:11 UTC
The main problem is that this needs to be opt-in for appsink in one way or another, otherwise existing appsink users will suddenly stop working if there is a buffer list.

Apart from that it "just" has to be implemented.


For appsrc we only need API for bufferlists in basesrc, and then if the sample contains a buffer list we just use that to pass it downstream in one piece (the attached patch does not make sense as it will tear apart the buffer list). For appsrc there is no concern about backwards compatibility here.
basesrc support for buffer lists is here: https://bugzilla.gnome.org/show_bug.cgi?id=750241
Comment 4 Patricia Muscalu 2016-07-01 07:19:56 UTC
Maybe I'm missing something here but it's just a question of implementing render_buffer_list function in the appsink. It's a bug today that if a pipeline contains elements that generate and push buffer lists downstream to the appsink, this list is unfortunately split into single buffers again by the appsink.
The logic of handling buffer list is already implemented in basesink and adding an additional buffer-list property for appsink seems like a work-around to the existing problem.
Comment 5 Sebastian Dröge (slomo) 2016-07-01 07:39:17 UTC
It's not a bug, buffer lists would just be transparently converted to single buffers currently and it would all work without the application having to know.

If you add buffer list support, you need to ensure to only pass buffer lists to the application if it opted in (e.g. by a property) and otherwise split the buffer list into individual buffers again. Otherwise you break applications that work now (because buffer lists are transparently split now).
Comment 6 Patricia Muscalu 2016-07-01 08:10:09 UTC
But why is this case handled in a different way in for example multiudpsink or fdsink. There is no buffer-list property in these elements. They just implement render_buffer_list func.
Comment 7 Tim-Philipp Müller 2016-07-01 08:18:06 UTC
With those elements there's no external consumer who might expect different behaviour.
Comment 8 Patricia Muscalu 2016-07-01 09:59:53 UTC
Ok. I got your point. Thanks for your explanation but I still believe that the old behavior in 0.10 was less complicated and more clear - having pull_buffer() and pull_buffer_list() callback functions in appsink set by the external consumers: based on the value of the appsink-callback function if was possible to detect the current support/mode of the appsink: buffer mode or buffer-list mode. 

Would you accept a patch that introduces a new buffer-list property in appsink?
Comment 9 Sebastian Dröge (slomo) 2016-07-01 10:17:38 UTC
Yes, that seems like the way forward. It should be FALSE by default though
Comment 10 Patricia Muscalu 2016-08-30 11:26:05 UTC
Created attachment 334430 [details] [review]
appsink: add support for buffer lists
Comment 11 Patricia Muscalu 2016-09-21 13:16:13 UTC
Hi. Is the patch correct? Do you have time to review the code? Actually, this patch and the one solving https://bugzilla.gnome.org/show_bug.cgi?id=771525 improves performance while streaming RTP over RTSP.

Thank you in advance!
Comment 12 Tim-Philipp Müller 2016-09-22 11:09:16 UTC
This will have to wait until after 1.10 now, sorry :)
Comment 13 Patricia Muscalu 2016-11-15 09:09:35 UTC
Hi. I wonder if the suggested patch is ok. Do I need to change something?
Thanks.
Comment 14 Jan Schmidt 2016-11-15 14:48:02 UTC
Review of attachment 334430 [details] [review]:

Looks good to me. Backwards-compatibility is maintained in the default case - degenerating to extracting buffers from buffer lists.
Comment 15 Jan Schmidt 2016-11-15 15:00:10 UTC
Review of attachment 307395 [details] [review]:

As mentioned by Sebastian, we should finalise the API in bug #750241 to let basesrc create buffer lists and then just push them. The logic in core will take care of tearing them apart to buffers if downstream can't handle that.
Comment 16 Tim-Philipp Müller 2016-11-15 15:41:10 UTC
Don't know if the new API proposal in bug #750241 is a good fit for this particular problem, since we can't pass through the GstBufferList as-is with that but would have to steal buffers and then let basesrc create a new buffer list. One solution might be to come up with an API that doesn't pass a bufferlist to appsrc, but N buffers, but if the intention is to pass through stuff coming from appsink that doesn't help.
Comment 17 Jan Schmidt 2016-11-15 21:04:09 UTC
The intention is to handle the app pushing in a GstSample, which holds either a  GstBufferList. appsrc doesn't really have a lot of choice without an API to push that directly to basesrc.
Comment 18 Tim-Philipp Müller 2017-09-17 12:09:24 UTC
Retitling since the appsink part was fixed ages ago.
Comment 19 Tim-Philipp Müller 2017-09-17 12:17:24 UTC
Created attachment 359931 [details] [review]
appsrc: add support for pushing buffer lists

And samples that carry buffer lists.
Comment 20 Tim-Philipp Müller 2017-12-09 11:17:35 UTC
commit b60cc0274c7d16e62f2ab52e2e679d3ce3b6afea (HEAD -> master)
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Thu Aug 31 11:12:12 2017 +0100

    appsrc: add support for pushing buffer lists
    
    And samples that carry buffer lists.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752363