Commit graph

115 commits

Author SHA1 Message Date
Thibault Saunier
d0b4b87b1e docs: Add gstges plugin 2019-06-06 09:48:39 -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
Nirbheek Chauhan
63ee426207 meson: Generate a pkgconfig file for the GES plugin
This was missing due to a typo.
2019-04-20 01:36:10 +05:30
Thibault Saunier
7261f714fc Some copyright fixing 2019-03-15 23:51:55 +00: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
Tim-Philipp Müller
9c8357b0f8 gesdemux: don't use deprecated gst_uri_construct()
Fixes #64
2019-03-04 11:07:51 +00:00
Sebastian Dröge
f6efb87a78 ges: Link ges plugin to libgstpbutils
/usr/bin/ld: .libs/libgstges_la-gesdemux.o: in function `ges_timeline_new_from_uri_from_main_thread':
./plugins/ges/gesdemux.c:279: undefined reference to `gst_discoverer_new'
/usr/bin/ld: ./plugins/ges/gesdemux.c:288: undefined reference to `gst_discoverer_start'
2019-02-28 13:09:38 +02:00
Tim-Philipp Müller
87f99d34bc plugins: add autotools build for new ges plugin 2019-02-26 14:00:33 +00:00
Nirbheek Chauhan
50d58678e0 misc: Fix warnings on Cerbero's ancient MinGW
gesdemux.c:297:3: error: value computed is not used [-Werror=unused-value]
2019-02-06 00:31:44 +05:30
Thibault Saunier
62dba13ccf plugins: Add an a gesdemux element to 'demux' serialized timelines 2019-01-29 00:06:32 +00:00
Thibault Saunier
4b324da3f4 plugins: implement a gessrc element useable from playbin
This is a new simple GstBin that can handle the ges:// uris
and will directly expose the srcppads of the tracks present in the
timeline.
2019-01-29 00:06:32 +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
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