Commit graph

41 commits

Author SHA1 Message Date
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
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
c247c911a0 nle: Set the NleOperation flags to NLE_OBJECT_OPERATION
Reviewed By: thiblahute

Differential Revision: https://phabricator.freedesktop.org/D770
2016-02-26 21:13:56 +01: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
Mathieu Duponchelle
1c1c9124b1 nleghostpad: use GST_SEGMENT_FORMAT
This isn't 2005 anymore.
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
d6b37d0f4d nleoperation: don't leak iterator
Summary: Once an iterator is created, it should be freed after usage.

Reviewers: thiblahute

Projects: #gstreamer_editing_services

Reviewed By: thiblahute

Differential Revision: https://phabricator.freedesktop.org/D318
2015-10-02 16:20:36 +02:00
Justin Kim
a854658404 nleoperation: don't leak srcpad
https://bugzilla.gnome.org/show_bug.cgi?id=755860
2015-09-30 12:09:17 +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
Thibault Saunier
c8e9cf962c nle: Avoid unsetting srcpad target after the srcpad is already freed
That leaded to segfaults
2015-09-15 12:17:29 +02:00
Thibault Saunier
69e9acc823 nle: Stop wrongly set operation segment base time
Inside the composition we actually do not need to have any notion
of what the timing outside the compositon as we already tweak the segment
base time outside the composition. This code was only there to work
around https://bugzilla.gnome.org/show_bug.cgi?id=753196

https://bugzilla.gnome.org/show_bug.cgi?id=754893
2015-09-15 12:08:00 +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
Justin Kim
937217021e nleobject: don't leak srcpad when disposing
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