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 752214 - ipc: new elements for multi-process pipelines
ipc: new elements for multi-process pipelines
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 784551
Blocks:
 
 
Reported: 2015-07-10 09:04 UTC by Vincent Penquerc'h
Modified: 2017-08-01 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
inter: new elements for multi-process pipelines (638.30 KB, patch)
2015-07-10 09:04 UTC, Vincent Penquerc'h
none Details | Review
add a virtual method for pushing buffers (3.13 KB, patch)
2015-07-10 09:16 UTC, Vincent Penquerc'h
none Details | Review
basesrc: forward message events (1.09 KB, patch)
2015-07-10 09:17 UTC, Vincent Penquerc'h
none Details | Review
basesink: expose _commit_state (1.45 KB, patch)
2015-07-10 09:17 UTC, Vincent Penquerc'h
none Details | Review
new elements (638.50 KB, patch)
2015-07-10 09:19 UTC, Vincent Penquerc'h
none Details | Review
new elements (639.03 KB, patch)
2015-07-10 12:29 UTC, Vincent Penquerc'h
none Details | Review
new elements (639.55 KB, patch)
2015-07-13 09:12 UTC, Vincent Penquerc'h
none Details | Review
new elements (640.14 KB, patch)
2015-07-13 16:17 UTC, Vincent Penquerc'h
none Details | Review
new elements (640.47 KB, patch)
2015-07-14 16:27 UTC, Vincent Penquerc'h
none Details | Review
basesink: expose _commit_state (1.88 KB, patch)
2015-07-16 12:49 UTC, Vincent Penquerc'h
none Details | Review
new elements (640.65 KB, patch)
2015-07-16 15:58 UTC, Vincent Penquerc'h
none Details | Review
new elements (651.70 KB, patch)
2015-07-22 15:06 UTC, Vincent Penquerc'h
none Details | Review
new elements (655.23 KB, patch)
2015-07-23 14:33 UTC, Vincent Penquerc'h
none Details | Review
new elements (655.29 KB, patch)
2015-07-31 12:27 UTC, Vincent Penquerc'h
none Details | Review
new elements (236.13 KB, patch)
2015-10-05 15:16 UTC, Vincent Penquerc'h
none Details | Review
fix reader thread leak (1.43 KB, patch)
2016-01-27 16:20 UTC, Vincent Penquerc'h
none Details | Review
performance and leak fixes (14.35 KB, patch)
2016-01-27 16:22 UTC, Vincent Penquerc'h
none Details | Review
fix racy behvior when flushing (3.94 KB, patch)
2016-04-01 13:43 UTC, Vincent Penquerc'h
none Details | Review
fix leak false positive in tests (1.51 KB, patch)
2016-04-01 13:43 UTC, Vincent Penquerc'h
none Details | Review
move thread shutdown from finalize to dispose (3.51 KB, patch)
2016-04-01 13:44 UTC, Vincent Penquerc'h
none Details | Review
fix messages being sent as inter elements are shutting down (1.25 KB, patch)
2016-04-01 13:45 UTC, Vincent Penquerc'h
none Details | Review
Add HLS support to the inter3 example (3.60 KB, patch)
2016-04-01 13:45 UTC, Vincent Penquerc'h
none Details | Review
clearer error message (1.12 KB, patch)
2016-04-01 13:46 UTC, Vincent Penquerc'h
none Details | Review
do not timeout on serualized objects (2.88 KB, patch)
2016-04-01 13:47 UTC, Vincent Penquerc'h
none Details | Review
inter: introduce new elements for multi-process pipelines (137.42 KB, patch)
2017-07-05 14:48 UTC, George Kiagiadakis
none Details | Review
tests/check: add automatic unit test suite for intersink & intersrc (612.34 KB, patch)
2017-07-05 14:49 UTC, George Kiagiadakis
none Details | Review
tests/examples: add manual tests/examples for intersink & intersrc (36.89 KB, patch)
2017-07-05 14:49 UTC, George Kiagiadakis
none Details | Review
ipcpipeline: introduce new plugin for inter-process pipelines (149.75 KB, patch)
2017-07-12 12:59 UTC, George Kiagiadakis
none Details | Review
tests/check: add automatic unit test suite for the ipcpipeline elements (613.07 KB, patch)
2017-07-12 12:59 UTC, George Kiagiadakis
none Details | Review
tests/examples: add manual tests/examples for the ipcpipeline elements (37.87 KB, patch)
2017-07-12 13:00 UTC, George Kiagiadakis
committed Details | Review
ipcpipeline: introduce new plugin for inter-process pipelines (150.75 KB, patch)
2017-07-24 11:08 UTC, George Kiagiadakis
committed Details | Review
tests/check: add automatic unit test suite for the ipcpipeline elements (603.84 KB, patch)
2017-07-24 11:09 UTC, George Kiagiadakis
committed Details | Review

Description Vincent Penquerc'h 2015-07-10 09:04:35 UTC
Created attachment 307208 [details] [review]
inter: new elements for multi-process pipelines

These elements allow splitting a pipeline across several processes,
with communication done by intersink and intersrc elements.
One pipeline is the master pipeline, and is the one that controls
state changes. Other pipelines are slave, and change states based
on orders from the master pipeline. Slave pipelines must use the
interslavepipeline pipeline subclass.

Comes with tests and example programs.
Comment 1 Vincent Penquerc'h 2015-07-10 09:16:10 UTC
Created attachment 307209 [details] [review]
add a virtual method for pushing buffers
Comment 2 Vincent Penquerc'h 2015-07-10 09:17:00 UTC
Created attachment 307210 [details] [review]
basesrc: forward message events
Comment 3 Vincent Penquerc'h 2015-07-10 09:17:37 UTC
Created attachment 307211 [details] [review]
basesink: expose _commit_state

This one might be a bit controversial :)
Comment 4 Vincent Penquerc'h 2015-07-10 09:19:03 UTC
Created attachment 307212 [details] [review]
new elements

Rebased to master as now now
Comment 5 Philippe Normand 2015-07-10 09:23:42 UTC
Should #743510 be closed now or it's not a duplicate?
Comment 6 Vincent Penquerc'h 2015-07-10 10:06:43 UTC
They seem to be aimed at different things. Arun's is much lighter too. It's not clear if it can talk between processes.
Comment 7 Vincent Penquerc'h 2015-07-10 11:22:30 UTC
It seems that I might have broken the case where preroll needs more than one buffer...
Comment 8 Vincent Penquerc'h 2015-07-10 12:29:12 UTC
Created attachment 307223 [details] [review]
new elements

inter3 example works again (issue with more than one async sink in slave processes)
Comment 9 Vincent Penquerc'h 2015-07-13 09:12:34 UTC
Created attachment 307332 [details] [review]
new elements

Now builds when gst-validate is not present, and some minor fixes.
Comment 10 Vincent Penquerc'h 2015-07-13 16:17:53 UTC
Created attachment 307356 [details] [review]
new elements

Fixes rare issue with libcheck bailing with "Bad message type argc [...]"
Comment 11 Vincent Penquerc'h 2015-07-14 16:27:00 UTC
Created attachment 307413 [details] [review]
new elements

A few leak fixes
Comment 12 Vincent Penquerc'h 2015-07-16 12:49:07 UTC
Created attachment 307553 [details] [review]
basesink: expose _commit_state

Add the pubic symbol to win32/common/libgstbase.def as per make check
Comment 13 Vincent Penquerc'h 2015-07-16 15:58:30 UTC
Created attachment 307569 [details] [review]
new elements

Add a videoconvert in the inter3 sample pipeline (fixes preroll when autovideosink picks ximagesink), and update copyrights to the preferred naming.
Comment 14 Vincent Penquerc'h 2015-07-22 15:06:30 UTC
Created attachment 307915 [details] [review]
new elements

Optimizations (malloc/free, adapter use)
A documentation of the fd protocol
Misc tweaks/improvements
Ignore allocation query
Pass protection meta (the only meta we support, as meta aren't generically saveable/loadable as events and messages are, but new metas should be easier to add using the new code)
Comment 15 Vincent Penquerc'h 2015-07-23 14:33:52 UTC
Created attachment 307993 [details] [review]
new elements

Performance optimizations, and make ack time and read buffer size properties
Comment 16 Vincent Penquerc'h 2015-07-31 12:27:46 UTC
Created attachment 308529 [details] [review]
new elements

Fix for occasional hang when seeking
Comment 17 Vincent Penquerc'h 2015-08-17 09:35:22 UTC
Will anyone here want to review first, or should I push them ?
Given they're new elements, there's pretty much no breakage risk.
Comment 18 Tim-Philipp Müller 2015-08-17 09:45:10 UTC
Please wait until after 1.6.
Comment 19 Tim-Philipp Müller 2015-09-16 12:13:16 UTC
I'd like to review this first, so please hold off with merging once master is open again (but feel free to remind me frequently).

I noticed the test sample files are quite large (1MB together, note how the others are all a couple of kB at most) and you're adding a soft dependency on gst-validate, perhaps these tests should go into gst-validate instead then, or elsewhere anyway?
Comment 20 Vincent Penquerc'h 2015-09-16 13:19:16 UTC
(In reply to Tim-Philipp Müller from comment #19)
> I'd like to review this first, so please hold off with merging once master
> is open again (but feel free to remind me frequently).

OK.

> I noticed the test sample files are quite large (1MB together, note how the
> others are all a couple of kB at most) and you're adding a soft dependency

They can probably be thinned down without too much difficulty.

> on gst-validate, perhaps these tests should go into gst-validate instead
> then, or elsewhere anyway?

I'd rather they stay as unit tests. If gst-validate is unwanted, the changes to remove it are small anyway (gst-validate is optional there).
Comment 21 Vincent Penquerc'h 2015-10-05 15:16:05 UTC
Created attachment 312680 [details] [review]
new elements

With slimmed down test data files, and the gst-validate bits removed.
Comment 22 Vincent Penquerc'h 2015-11-03 11:57:28 UTC
ping(In reply to Tim-Philipp Müller from comment #19)
> I'd like to review this first, so please hold off with merging once master
> is open again (but feel free to remind me frequently).

ping
Comment 23 Vincent Penquerc'h 2016-01-27 16:20:42 UTC
Created attachment 319855 [details] [review]
fix reader thread leak
Comment 24 Vincent Penquerc'h 2016-01-27 16:22:59 UTC
Created attachment 319856 [details] [review]
performance and leak fixes

Couple patches with fixes. No behavioral change. They apply on top of the others.
Comment 25 Vincent Penquerc'h 2016-04-01 13:42:48 UTC
I've continued fixing things on top of this so it seem best to post those here instead of separate bugs as this is still not merged.
Comment 26 Vincent Penquerc'h 2016-04-01 13:43:27 UTC
Created attachment 325152 [details] [review]
fix racy behvior when flushing
Comment 27 Vincent Penquerc'h 2016-04-01 13:43:53 UTC
Created attachment 325153 [details] [review]
fix leak false positive in tests
Comment 28 Vincent Penquerc'h 2016-04-01 13:44:20 UTC
Created attachment 325154 [details] [review]
move thread shutdown from finalize to dispose
Comment 29 Vincent Penquerc'h 2016-04-01 13:45:12 UTC
Created attachment 325155 [details] [review]
fix messages being sent as inter elements are shutting down
Comment 30 Vincent Penquerc'h 2016-04-01 13:45:37 UTC
Created attachment 325156 [details] [review]
Add HLS support to the inter3 example
Comment 31 Vincent Penquerc'h 2016-04-01 13:46:03 UTC
Created attachment 325157 [details] [review]
clearer error message
Comment 32 Vincent Penquerc'h 2016-04-01 13:47:06 UTC
Created attachment 325158 [details] [review]
do not timeout on serualized objects
Comment 33 Vincent Penquerc'h 2016-04-05 09:27:23 UTC
(In reply to Tim-Philipp Müller from comment #19)
 (but feel free to remind me frequently).

*reminder* :)
Comment 34 Tim-Philipp Müller 2016-05-23 08:27:38 UTC
I understand Nicolas has reviewed this now, so I guess there's going to be updated patches?
Comment 35 Vincent Penquerc'h 2016-05-23 08:34:03 UTC
There was a race found in integration when changing states, and there are substantial changes in that area. I'll post the updates once it's confirmed to fix the problem. Also more minor fixes I found while doing so. I don't think there was an actual review done yet.
Comment 36 Vincent Penquerc'h 2016-05-27 10:20:03 UTC
There are a load of patches, so I'm going to point at a branch instead:

https://git.collabora.com/cgit/user/vincent/gst-plugins-bad/log/?h=inter-tests

The early history is not rebased/merged on that branch, you can ignore that. What counts are the newer patches after the last ones posted here.
Comment 37 Vincent Penquerc'h 2016-06-14 14:16:57 UTC
The branch is now updated with the latest patches.
Comment 38 Vincent Penquerc'h 2016-06-15 10:13:21 UTC
For the record, I'm unlikely to do more substantial work on this unless bugs are reported (and most recent patches are extra tests).
Comment 39 Vincent Penquerc'h 2016-07-22 18:24:58 UTC
h(In reply to Tim-Philipp Müller from comment #19)
> I'd like to review this first, so please hold off with merging once master
> is open again (but feel free to remind me frequently).

pingity ping.
Comment 40 George Kiagiadakis 2017-07-05 14:48:46 UTC
Created attachment 354921 [details] [review]
inter: introduce new elements for multi-process pipelines
Comment 41 George Kiagiadakis 2017-07-05 14:49:25 UTC
Created attachment 354922 [details] [review]
tests/check: add automatic unit test suite for intersink & intersrc
Comment 42 George Kiagiadakis 2017-07-05 14:49:43 UTC
Created attachment 354923 [details] [review]
tests/examples: add manual tests/examples for intersink & intersrc
Comment 43 George Kiagiadakis 2017-07-05 14:58:59 UTC
Here is a new iteration of these patches. There are a lot of cleanups and fixes since the 2015 version. The automatic unit test depends on bug 784551.
Comment 44 Tim-Philipp Müller 2017-07-05 15:25:47 UTC
Can we please find better names that express the ipc nature of these elements? I think intersrc/sink is too generic and it's confusing given the existing intervideosrc/sink which work in the same process.

Maybe this should even go in a separate plugin?

Could you please also flesh out the documentation to explain what the purpose of these elements is, and the big picture how-to-use-them, and some hints about how it's implemented. More than just two example pipelines.
Comment 45 George Kiagiadakis 2017-07-12 12:58:45 UTC
(In reply to Tim-Philipp Müller from comment #44)
> Can we please find better names that express the ipc nature of these
> elements? I think intersrc/sink is too generic and it's confusing given the
> existing intervideosrc/sink which work in the same process.

Agreed. I have now chosen ipcpipeline (short for inter-process pipeline) as an alternative. Let me know what you think.

> Maybe this should even go in a separate plugin?

Agreed.

> Could you please also flesh out the documentation to explain what the
> purpose of these elements is, and the big picture how-to-use-them, and some
> hints about how it's implemented. More than just two example pipelines.

Done.
Comment 46 George Kiagiadakis 2017-07-12 12:59:16 UTC
Created attachment 355419 [details] [review]
ipcpipeline: introduce new plugin for inter-process pipelines
Comment 47 George Kiagiadakis 2017-07-12 12:59:43 UTC
Created attachment 355420 [details] [review]
tests/check: add automatic unit test suite for the ipcpipeline elements
Comment 48 George Kiagiadakis 2017-07-12 13:00:07 UTC
Created attachment 355421 [details] [review]
tests/examples: add manual tests/examples for the ipcpipeline elements
Comment 49 Tim-Philipp Müller 2017-07-12 13:12:24 UTC
> I have now chosen ipcpipeline (short for inter-process pipeline) as
> an alternative. Let me know what you think.

Seems fine to me, thanks.

 
> > Could you please also flesh out the documentation [..]
> 
> Done.

Thanks.

To me it still looks like a lot of code with not a lot of comments or much implementation documentation apart from the protocol docs. I just hope it's all very obvious and self-explanatory :)

I had mentioned before that I wanted to review the implementation in detail, but realistically I don't see myself having time for that any time soon, so that shouldn't keep you from merging it.
Comment 50 George Kiagiadakis 2017-07-24 11:08:09 UTC
Created attachment 356288 [details] [review]
ipcpipeline: introduce new plugin for inter-process pipelines

Updated patch with some memory leak fixes
Comment 51 George Kiagiadakis 2017-07-24 11:09:38 UTC
Created attachment 356289 [details] [review]
tests/check: add automatic unit test suite for the ipcpipeline elements

Refactored this test suite to be more readable and also fixed a lot of race conditions that were noticeable when run in valgrind.
Comment 52 George Kiagiadakis 2017-07-26 08:08:37 UTC
Olivier gave me a review over chat and he brought up the question of why these functions are not in core (they are in ipcpipelinecomm.c in my patch):

gst_value_serialize_event (const GValue * value)
gst_value_deserialize_event (GValue * dest, const gchar * s)

These functions are necessary to serialize GstNavigationEvent messages, which are messages that contain an event in one of the structure fields. Because we use gst_structure_to_string to serialize messages, the event is lost unless the core knows how to serialize a GstEvent into a string.

I have not attempted to put them in the core because the serialization is not 100% accurate. It internally uses gst_structure_to_string() as well, which is not capable of serializing every possible field of the event (it will lose objects, for a start). Do you think it makes sense to put them in core anyway?
Comment 53 Tim-Philipp Müller 2017-07-31 09:23:50 UTC
It might make sense, but we usually only put things into core once there are multiple potential users for it. Can always be done later IMHO.
Comment 54 George Kiagiadakis 2017-08-01 08:55:48 UTC
Alright, I'm going to merge this today, unless there is an objection. Olivier has already ack'ed it.
Comment 55 George Kiagiadakis 2017-08-01 11:47:14 UTC
commit d3920aa2a902405a9d455d270445037e163135ab
Author: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date:   Tue Aug 1 13:26:38 2017 +0300

    meson: enable building the ipcpipeline plugin

commit e97877dc7e107f0ae514325a86c0cbac77653e9b
Author: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date:   Wed Jul 5 16:56:24 2017 +0300

    tests/examples: add manual tests/examples for the ipcpipeline elements
    
    ipcpipeline1 is a very simple test that shows a short videotestsrc fragment.
    
    ipc-play is a clone of gst-play that splits the pipeline in two
    processes, running the source & demuxer on the master process
    and the decoders & sinks on the slave.

commit 35a01f41ce312b53a2ad82ce8a65b3561c3abf81
Author: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date:   Wed Jul 5 16:53:48 2017 +0300

    tests/check: add automatic unit test suite for the ipcpipeline elements
    
    All tests run within a common framework for splitting processes
    and making them interract properly with the gst check system.

commit 3089d142b015d9c8fcf0c9b25ce0c6c705f4be7d
Author: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date:   Wed Jul 5 16:50:22 2017 +0300

    ipcpipeline: introduce new plugin for inter-process pipelines
    
    These elements allow splitting a pipeline across several processes,
    with communication done by the ipcpipelinesink and ipcpipelinesrc
    elements. The main use case is to split a playback pipeline into
    a process that runs networking, parser & demuxer and another process
    that runs the decoder & sink, for security reasons.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752214