Commit graph

67 commits

Author SHA1 Message Date
Thibault Saunier
91ff8a8110 nlecomposition: Drop all group-done but the last one 2019-07-05 18:30:41 -04:00
Thibault Saunier
e5045b33d5 nlesource: Wait for the seek to actualy happen before removing the probe
Make sure that an event resulting from the seek happens before removing
the pad probe, dropping anything while it is not the case.

This guarantees that the seek happens before `nlesource` outputs
anything. This was not necessary as with decodebin or usual source
flushing seeks lead to synchronous flush_start/flush_stop and we could
safely assume that once the seek is sent, it was happenning.
With nested `nlecomposition` this assumption is simply not true as
in the composition seeks are basically cached and happen later in
the composition updating thread.

This fixes races where we ended up removing the blocking probe before
the seek actually started to be executed in the nlecomposition
nested inside an nlesource which leaded to data from *before* the seek
to be outputed which means we could display wrong frames,
and it was leading to interesting deadlocks.
2019-07-05 18:30:41 -04:00
Thibault Saunier
e97c90fa40 nlecomposition: Minor debugging enhancements 2019-07-05 18:11:04 -04:00
Thibault Saunier
1eb05b0b71 nlecomposition: Ensure flushes after seek have the right seqnum
Seeks that lead to a stack change lead to deactivating the current
stack. At that point we explicitely flush downstream as a reaction to
the flushing seek. Until now those flushes had a random seqnum, this
fails if we are a nested compostion as the parent composition will end
up dropping that flush which in turns might lead to deadlocks. For
example, the flush goes through a `compositor` which wants to flush
downstream to stop its srcpad task, but that flush wouldn't have
"released" its srcpad thread if the composition srcpad drops it, meaning
it won't be able to stop the task ever.
2019-07-05 18:11:04 -04:00
Thibault Saunier
e903f15380 nlecomposition: Shutdown children when setting state to NULL
Otherwise if we shutdown a composition whith an nested composition
(inside a source in the test) and leak it, we end up with the nested
composition task still running (in READY) which is bad.

Add a test for that which leaks the pipeline on purpose.
2019-07-05 18:01:51 -04:00
Thibault Saunier
351182ba2a nle: Parent the GstTask to ourself
This allows accessing the nlecomposition in gdb when a task is
'dangling' making debugging easier.
2019-07-05 18:01:07 -04:00
Thibault Saunier
c1206df0bb nlecomposition: Properly set seqnum on flush events 2019-07-05 18:00:09 -04:00
Thibault Saunier
5ea4667be6 Implement and use the GstStream API 2019-07-05 17:53:15 -04:00
Thibault Saunier
5be359cf7f timeline: Create stable stream IDs 2019-07-05 17:52:55 -04:00
Thibault Saunier
63a49edf1f docs: Generate ges plugin doc 2019-07-05 17:52:50 -04:00
Thibault Saunier
d07fe11c5f nlecomposition: Respect seek seqnum in output EOS/SEGMENT
Allowing a proper seek EOS handling with nested compositions
2019-07-05 17:50:22 -04:00
Mathieu Duponchelle
4c77b04fa1 doc: remove xml from comments 2019-05-29 23:12:11 +02:00
Thibault Saunier
e7816eba1d doc: Build documentation with hotdoc 2019-05-13 10:30:35 -04:00
Thibault Saunier
f255ae72d9 nlesource: Use gst_element_call_async as appropriate 2019-03-15 18:31:30 -03:00
Thibault Saunier
dabcc3b459 nlesource: Protect seeks from tear down
Otherwise there is a race where we trigger the seek at the exact
same time the composition is being teared down potentially leading
to basesrc restarting its srcpad task which ends up being leaked.

Fixes ges.playback.scrub_backward_seeking.test_title.audio_video.vorbis_theora_ogg
and probably all its friends timeouting with the following stack trace:

     (gdb) t a a bt

     Thread 4 (Thread 0x7f5962acd700 (LWP 19997)):
     #0  0x00007f5976713efd in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
     #1  0x00007f5976a9d3f3 in g_cond_wait (cond=cond@entry=0x7f5938125410, mutex=mutex@entry=0x7f59381253c8) at gthread-posix.c:1402
     #2  0x00007f5976c9e26b in gst_task_func (task=0x7f59381253b0 [GstTask]) at ../subprojects/gstreamer/gst/gsttask.c:313
     #3  0x00007f5976a7ecb3 in g_thread_pool_thread_proxy (data=<optimized out>) at gthreadpool.c:307
     #4  0x00007f5976a7e2aa in g_thread_proxy (data=0x7f5954071d40) at gthread.c:784
     #5  0x00007f59767ea58e in start_thread (arg=<optimized out>) at pthread_create.c:486
     #6  0x00007f59767196a3 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

     Thread 3 (Thread 0x7f5963fff700 (LWP 19995)):
     #0  0x00007f597670e421 in __GI___poll (fds=0xe32da0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
     #1  0x00007f5976a553a6 in g_main_context_poll (priority=<optimized out>, n_fds=2, fds=0xe32da0, timeout=<optimized out>, context=0xe31ff0) at gmain.c:4221
     #2  0x00007f5976a553a6 in g_main_context_iterate (context=0xe31ff0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3915
     #3  0x00007f5976a55762 in g_main_loop_run (loop=0xe32130) at gmain.c:4116
     #4  0x00007f59768db10a in gdbus_shared_thread_func (user_data=0xe31fc0) at gdbusprivate.c:275
     #5  0x00007f5976a7e2aa in g_thread_proxy (data=0xe1b8a0) at gthread.c:784
     #6  0x00007f59767ea58e in start_thread (arg=<optimized out>) at pthread_create.c:486
     #7  0x00007f59767196a3 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

     Thread 2 (Thread 0x7f5968dcc700 (LWP 19994)):
     #0  0x00007f597670e421 in __GI___poll (fds=0xe1bcc0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
     #1  0x00007f5976a553a6 in g_main_context_poll (priority=<optimized out>, n_fds=1, fds=0xe1bcc0, timeout=<optimized out>, context=0xe1b350) at gmain.c:4221
     #2  0x00007f5976a553a6 in g_main_context_iterate (context=context@entry=0xe1b350, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3915
     #3  0x00007f5976a554d0 in g_main_context_iteration (context=0xe1b350, may_block=may_block@entry=1) at gmain.c:3981
     #4  0x00007f5976a55521 in glib_worker_main (data=<optimized out>) at gmain.c:5861
     #5  0x00007f5976a7e2aa in g_thread_proxy (data=0xe1b800) at gthread.c:784
     #6  0x00007f59767ea58e in start_thread (arg=<optimized out>) at pthread_create.c:486
     #7  0x00007f59767196a3 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

     Thread 1 (Thread 0x7f5975df4fc0 (LWP 19993)):
     #0  0x00007f5976713efd in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
     #1  0x00007f5976a9d3f3 in g_cond_wait (cond=cond@entry=0xe34020, mutex=0xe39b80) at gthread-posix.c:1402
     #2  0x00007f5976a7f41c in g_thread_pool_free (pool=0xe34000, immediate=0, wait_=<optimized out>) at gthreadpool.c:776
     #3  0x00007f5976c9f1ca in default_cleanup (pool=0xe256b0 [GstTaskPool]) at ../subprojects/gstreamer/gst/gsttaskpool.c:89
     #4  0x00007f5976c9e32d in init_klass_pool (klass=<optimized out>) at ../subprojects/gstreamer/gst/gsttask.c:161
     #5  0x00007f5976c9e502 in gst_task_cleanup_all () at ../subprojects/gstreamer/gst/gsttask.c:381
     #6  0x00007f5976c214f4 in gst_deinit () at ../subprojects/gstreamer/gst/gst.c:1095
     #7  0x000000000040394f in main (argc=6, argv=<optimized out>) at ../subprojects/gst-editing-services/tools/ges-launch.c:94
2019-03-15 17:07:06 -03:00
Seungha Yang
50e40ba621 nlecomposition: Suppress error from child during sync state with parent
This commit is to ensure cleanup internal elements on state change failure.

nlecomposition posts its own error message after cleanup child.
If we don't suppress child error, meanwhile, an application
triggered downward state change (resulting from child error message)
might be able to reach nlecomposition before internal cleaning child up.
That eventually results to downward state change failure.
2019-03-06 13:31:01 +00:00
Seungha Yang
4c94de3c38 nlesource: Don't leak pending seek event on dispose 2019-03-06 13:31:01 +00:00
Seungha Yang
08c70424c2 nlecomposition: Don't keep sync state of child on activation failure
This will result in downward state change failure eventually
when user is finalizing top level (i.g., gespipeline) bin.
2019-03-06 13:31:01 +00:00
Thibault Saunier
c596f80c63 nlecomposition: Get overall pipeline position by recursing up
And handle NLEComposition inside NLEComposition

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/39
2019-01-29 00:06:32 +00:00
Seungha Yang
b2c8b23c51 nleoperation: Fix GstPad leak
Returned GstPad by nle_object_remove_ghost_pad() has increased
refcount.
2019-01-18 20:32:02 +00:00
Seungha Yang
98b2d7754f nleghostpad: Fix GstEvent leak 2019-01-18 20:32:02 +00:00
Seungha Yang
783aba17f6 nlecomposition: Don't leak GNode
Clear the last node before update
2019-01-18 20:32:02 +00:00
Seungha Yang
0b4a604107 nlecomposition: Clear all members before chaining up to parent on finalize 2019-01-18 20:32:02 +00:00
Seungha Yang
8b3e304f15 nlecomposition: Don't try dump null stack
Fixes following assertion
Unexpected critical/warning: g_node_traverse: assertion 'root != NULL' failed
2019-01-17 23:21:34 +09:00
Seungha Yang
fd10d69bc5 nlecomposition: Handle state change failure
Whatever the reason for failure, try cleanup child elements
and internal thread.
2019-01-09 20:25:15 +09:00
Matthew Waters
21294f907e nle: install pkg-config file for plugin 2018-11-05 12:18:23 +00:00
Thibault Saunier
77f8107d64 nlecomposition: Add a function that prints stacks as debug info 2018-10-28 13:23:49 +00:00
Thibault Saunier
13b8c8554d Update for g_type_class_add_private() deprecation in recent GLib 2018-09-05 22:57:27 -03:00
Thibault Saunier
fbdf04c674 nlecomposition: Rename outside_segment to seek_segment
This segment is representing the last seek received
inside the composition. Or a simply initialized segment
if need seek occurred.
2018-07-21 12:03:14 -04:00
Nicolas Dufresne
5dd5b163ae nlecomposition: Always execute seeks
We have an optiominisation to avoid double seeks when a seek is passed
the end of the current stack. The problem, is that we no longer flush
the pipeline when this code is reached. This patch comments out this
optimization adding a FIXME. As mention, flushing the stack instead of
seeking would work, but does not seem trivial considering all the
mechanic inplace to forward or not the events.

https://bugzilla.gnome.org/show_bug.cgi?id=787405
2017-09-19 11:24:22 -03:00
Nicolas Dufresne
faf44ac0e2 nlecomposition: Also start task on allocation query
The allocation query may block on the sink when in pause. As a side effect, we
may never get a buffer now that tee does forward the allocation query.
This would often lead in a pipeline stall.

https://bugzilla.gnome.org/show_bug.cgi?id=787405
2017-09-19 11:24:22 -03:00
Thibault Saunier
a8b7180918 smartmixer: Give a unique name to each compositor instances 2017-08-10 21:40:37 -04:00
Thibault Saunier
623683b621 nlecomposition: Rename segment_start to current_stack_start
It is still not exactly precise, but gives a much better understanding
of what it is.
2017-07-29 19:47:27 -04:00
Thibault Saunier
03317e710d nlecomposition: Properly update segment->start/stop on commit
Otherwise they will just be the ones from the previous seek event/
stack setup and be meaningless.

Also document the priv->segment meaning.

Fixes https://phabricator.freedesktop.org/T7796
2017-07-29 19:47:27 -04:00
Nicolas Dufresne
4a906e412e Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:37:03 -04:00
Thibault Saunier
66e13d43b9 nlecomposition: Deactivate current stack in PAUSED_READY state
To avoid a race when tearing down the composition (PAUSED_TO_READY),
we should make sure to tear down the current stack and let the GstBin
class handle the remaining thing to do during the change state.

We should still ignore any error happening when tearing down the
bin state just in case.

https://bugzilla.gnome.org/show_bug.cgi?id=775051
2016-11-30 11:11:42 -03:00
Sebastian Dröge
5511124bc0 Revert "nlecomposition: Start task and initialize the stack after chaining up to parent's change state function"
This reverts commit 57d40bec1a.

Apparently it causes timeouts in the unit tests on Jenkins and
Thibault's machine, and in the gst-validate tests.

Caused by elements staying in PAUSED and waiting to be set to PLAYING.
Needs further investigation.
2016-11-17 09:41:31 +02:00
Sebastian Dröge
582bf15c35 Revert "nleobject: Start up in NULL->READY->PAUSED after the parent class did"
This reverts commit 5f7943c59d.
2016-11-17 09:40:33 +02:00
Sebastian Dröge
5f7943c59d nleobject: Start up in NULL->READY->PAUSED after the parent class did
This keeps everything in a more consistent order and makes sure that the
base class is already set up completely before we start doing anything.
It also prevents from doing any setup if the base class fails, and
possibly not shutting things down again then.

https://bugzilla.gnome.org/show_bug.cgi?id=774480
2016-11-16 18:11:00 +02:00
Sebastian Dröge
57d40bec1a nlecomposition: Start task and initialize the stack after chaining up to parent's change state function
Otherwise we could set the state of the children to PAUSED already (i.e.
start dataflow) from the composition's task, while the composition
itself is currently chaining up to the parent class' change state
function and did not activate the pads yet. This causes buffers and
events to be discarded, and everything to stop with a not-negotiated
error.

https://bugzilla.gnome.org/show_bug.cgi?id=774480
2016-11-16 14:00:58 +02:00
Sebastian Dröge
acfa0e9045 nlecomposition: Fix small remaining race in previous commit
The seek action might currently be handled (in which case it is not in
the actions list and the action lock is not locked), but not actually
handled completely yet (the seqnum is not stored yet).

To prevent this, we remember what the current action is that is being
handled, and also compare to that.

https://bugzilla.gnome.org/show_bug.cgi?id=774149
2016-11-11 07:44:28 +02:00
Sebastian Dröge
ff6dc38900 nlecomposition: De-duplicate seek events based on their sequence number
If there are e.g. multiple video sinks, we would get the same seek event
multiple times. But we only want to handle it once.

https://bugzilla.gnome.org/show_bug.cgi?id=774149
2016-11-09 18:09:22 +02:00
Thibault Saunier
b80e006caf nle: Drop tags getting out of the composition
Those tag are meaningless in for the new stream created by the composition

First step toward fixing T3070

Differential Revision: https://phabricator.freedesktop.org/D1327
2016-09-26 13:33:20 -03:00
Sebastian Dröge
a1b923c78a nlecomposition: Don't try to seek on an empty stack
We would seek on a NULL pad then, which gives ugly assertions.

https://bugzilla.gnome.org/show_bug.cgi?id=771843
2016-09-22 11:48:30 -04:00
Sebastian Dröge
7aa69d0ea0 nleurisource: Always provide a srcpad
By putting uridecodebin into a bin with a ghostpad. Without this,
nlesource tries to get a srcpad too early (before uridecodebin added
one) and everything fails miserably.

This has to be fixed properly in nlesource at some point, by properly
handling dynamically added pads. Currently they can only work if they
are added in states <= READY, which is not the usual case.

https://bugzilla.gnome.org/show_bug.cgi?id=771843
2016-09-22 11:30:58 -04:00
Sebastian Dröge
5a0731a0a5 nlesource: Fail prepare() if no valid source pad is found
https://bugzilla.gnome.org/show_bug.cgi?id=771792
2016-09-21 18:24:34 -04:00
Thibault Saunier
383c5d1f6d Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson
2016-08-24 16:44:32 -03:00
Sebastian Dröge
2ef72b7276 nlecomposition: Fix race condition in seek handling causing deadlocks
We might receive another seek from the application while the action task is
handling a previous seek (and thus setting seeking_itself to TRUE). To prevent
this seek to go through directly instead of being added as an action, also
check if the seek event was received from our action task thread or some other
thread.

https://bugzilla.gnome.org/show_bug.cgi?id=767053
2016-05-31 17:30:25 +03:00
Aurélien Zanelli
62456af2a2 nlecomposition: ensure elements pending to be added are not leaked
When nlecomposition is finalized with pending add action or io,
associated elements are not unreffed as they should since caller gives
us the reference when calling gst_bin_add causing them to be leaked.
So to make sure we don't leak a reference on element when adding one to
the bin, each stage (action and pending_io) hold a reference on element
and release it when stage is done.

https://bugzilla.gnome.org/show_bug.cgi?id=766455
2016-05-14 20:50:16 -03:00
Aurélien Zanelli
dd5bf558c2 nlecomposition: fix nle_composition_remove_object info message
We don't add internal bin, we remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=766455
2016-05-14 20:47:16 -03:00