Commit graph

49 commits

Author SHA1 Message Date
Thibault Saunier
17500f6836 nle: Minor typo fixes 2020-02-11 18:30:13 -03:00
Niels De Graef
35d140ad92 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-10-24 15:19:09 +02:00
Thibault Saunier
bea7bc33a1 nlecomposition: Enhance dumping stack output 2019-10-22 19:55:01 +02:00
Thibault Saunier
a55296314c nle: Handle nested timelines update when file changes
When we have nested timelines, we need to make sure the underlying
formatted file is reloaded when commiting the main composition to
take into account the new timeline.

In other to make the implementation as simple as possible we make
sure that whenever the toplevel composition is commited, the decodebin
holding the gesdemux is torn down so that a new demuxer is created
with the new content of the timeline.

To do that a we do a NleCompositionQueryNeedsTearDown query to which
gesdemux answers leading to a full nlecomposition stack
deactivation/activation cycle.
2019-07-26 13:48:51 -04:00
Thibault Saunier
91ff8a8110 nlecomposition: Drop all group-done but the last one 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
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
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
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
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
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
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
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
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
Thibault Saunier
53471db56e Minor fix 2016-04-09 18:14:00 -03:00
Vineeth TM
e660f47a1d editing-services: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763195
2016-03-24 14:52:58 +02:00
Sjors Gielen
84f7f04a64 Handle changing playback rate
Before this patch, NLE and GES did not support NleOperations (respectively
GESEffects) that changed the speed/tempo/rate at which the source plays. For
example, the 'pitch' element can make audio play faster or slower. In GES 1.5.90
and before, an NleOperation containing the pitch element to change the rate (or
tempo) would cause a pipeline state change to PAUSED after that stack; that has
been fixed in 1.5.91 (see #755012 [0]). But even then, in 1.5.91 and later,
NleComposition would send segment events to its NleSources assuming that one
source second is equal to one pipeline second. The resulting early EOS event
(in the case of a source rate higher than 1.0) would cause it to switch stacks
too early, causing confusion in the timeline and spectacularly messed up
output.

This patch fixes that by searching for rate-changing elements in
GESTrackElements such as GESEffects. If such rate-changing elements are found,
their final effect on the playing rate is stored in the corresponding NleObject
as the 'media duration factor', named like this because the 'media duration',
or source duration, of an NleObject can be computed by multiplying the duration
with the media duration factor of that object and its parents (this is called
the 'recursive media duration factor'). For example, a 4-second NleSource with
an NleOperation with a media duration factor of 2.0 will have an 8-second media
duration, which means that for playing 4 seconds in the pipeline, the seek
event sent to it must span 8 seconds of media. (So, the 'duration' of an
NleObject or GES object always refers to its duration in the timeline, not the
media duration.)

To summarize:

* Rate-changing elements are registered in the GESEffectClass (pitch::tempo and
  pitch::rate are registered by default);
* GESTimelineElement is responsible for detecting rate-changing elements and
  computing the media_duration_factor;
* GESTrackElement is responsible for storing the media_duration_factor in
  NleObject;
* NleComposition is responsible for the recursive_media_duration_factor;
* The latter property finally fixes media time computations in NleObject.

NLE and GES tests are included.

[0] https://bugzilla.gnome.org/show_bug.cgi?id=755012

Differential Revision: https://phabricator.freedesktop.org/D276
2016-02-26 19:54:40 +01:00
Thibault Saunier
38c4e415fd nle: Turn composition structural issue into ERROR on the bus
Those error are really critical and we are then enable to keep
working. Just post an ERROR message on the bus and let the
application deal with it.

Reviewed-by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Differential Revision: https://phabricator.freedesktop.org/D740
2016-02-04 15:23:30 +01:00
Mathieu Duponchelle
199b86684f nlecomposition: use correct type for flush_seqnum. 2016-01-09 05:17:23 +01:00
Justin Kim
93ce9c5e1d nlecomposition: free closure actions when disposing
Summary:
After invoking GClosure, the item of action list becomes
orphan so it lost a chance to be freed. In addition, even
when disposing, the list of actions has few items so we
have to check the list.

Reviewers: thiblahute

Projects: #gstreamer_editing_services

Reviewed By: thiblahute

Differential Revision: https://phabricator.freedesktop.org/D324
2015-10-02 16:51:56 +02:00
Justin Kim
b7c97d8e87 nlecomposition: fix wrong argument order of GClosureNotify
Summary:
_free_action should follow GClosureNotify type.

```
void
(*GClosureNotify) (gpointer data,
                   GClosure *closure);
```

Reviewers: thiblahute

Projects: #gstreamer_editing_services

Reviewed By: thiblahute

Differential Revision: https://phabricator.freedesktop.org/D323
2015-10-02 16:49:31 +02:00
Justin Kim
bd1d03202b nle{composition,object}: remove unused allocation & trivial leakages
nlecomposition allocates unused 'UpdateCompositionData' and it
causes leakages.

https://bugzilla.gnome.org/show_bug.cgi?id=755417
2015-09-24 13:05:55 +02:00
Justin Kim
ff388f1d9b nlecomposition: don't leak internal hashtable
https://bugzilla.gnome.org/show_bug.cgi?id=754867
2015-09-11 13:09:40 +02:00
Thibault Saunier
edc5c27ffb Move NLE to a dedicated GstPlugin
Summary: Allowing external user to directly use it

Reviewers: Mathieu_Du

Differential Revision: https://phabricator.freedesktop.org/D231
2015-08-20 13:49:20 +02:00
Renamed from ges/nle/nlecomposition.c (Browse further)