Commit graph

105 commits

Author SHA1 Message Date
Thibault Saunier
41be342ba8 nle: Delay marking object as not in composition
Instead of doing it at the time of resetting `object->in_composition`
when user calls `gst_bin_remove` do it after we actually removed
it from the object thread, and do it in the `nle_object_reset`
method where it belongs

Fixes https://gitlab.freedesktop.org/gstreamer/gst-editing-services/issues/96
2020-03-11 22:44:52 +00:00
Thibault Saunier
b7c4171f31 nlesource: When standalone consider object.duration==0 as not set
nleobject.duration defaults to 0, but this is pretty unintuitive for
end user in the case nlesource is use standalone, just consider
duration=0 equivalent to duration=GST_CLOCK_TIME_NONE as it makes
the element much simpler to use, we could actually forbid 0 as a value
in the future.

Also take into account potential CLOCK_TIME_NONE
2020-02-18 23:08:53 -03:00
Thibault Saunier
f30b7f05b5 plugins:ges: Fix pushing tags after e8c782d119
Basically the tags we send before STREAM_START are now ignored, meaning
that we could not detect nested timelines anymore, this commits makes
sure that we send our tag event after getting pushing STREAM_START.
2020-02-12 17:50:37 -03:00
Thibault Saunier
3c3176516e nlecomposition: Optimize prerolling when using nested compositions
When a composition is nested into anotherone, we *know* that the
toplevel composition is going to send a stack initializing seek,
we can thus avoid sending it on the subcomposition itself when
prerolling. This avoid seeking roundtrips and we now have one and
only one seek travelling in the overall pipeline (after it has
prerolled).
2020-02-12 17:50:37 -03:00
Thibault Saunier
32de7d857d nlesource: Fix seeks when used standalone
The 'start' of nleobject is in the 'composition' scale, inpoint is in
the media scale, when outside a composition, a nleobject->start value
doesn't mean anything.
2020-02-12 17:50:37 -03:00
Thibault Saunier
c63586e0a7 nle: Seek the whole stack on initialization
Instead of seeking each nleobject separately to setup new stack, wait
for the whole stack to preroll and then seek that newly setup stack,
leading to the same code path and seek 'tweaking' as when processing
a seek on the composition (without stack changes).

This is mandatory to properly handle filter that tweak segments to handle
time remapping for example.
2020-02-12 17:50:37 -03:00
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
Tim-Philipp Müller
0c96b9dd10 Remove autotools build system
Todo:
 - hook up data/completions/ges-launch-1.0 in Meson (#77)
2019-10-13 13:54:19 +01:00
Sebastian Dröge
eabfd98e6d gesdemux: Initialize debug category before first using it
Prevents critical warnings during class_init()
2019-10-01 18:01:21 +03:00
Matthew Waters
c2bba9e0e5 build: also suppress unused-function warnings about g_autoptr
../plugins/ges/gesdemux.c:50:1: error: unused function 'glib_autoptr_cleanup_GESDemux' [-Werror,-Wunused-function]
G_DECLARE_FINAL_TYPE (GESDemux, ges_demux, GES, DEMUX, GESBaseBin);
^
/home/matt/Projects/cerbero/build/dist/android_universal/x86_64/include/glib-2.0/gobject/gtype.h:1401:3: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
  _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
  ^
/home/matt/Projects/cerbero/build/dist/android_universal/x86_64/include/glib-2.0/glib/gmacros.h:451:22: note: expanded from macro '_GLIB_DEFINE_AUTOPTR_CHAINUP'
  static inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) {                     \
                     ^
/home/matt/Projects/cerbero/build/dist/android_universal/x86_64/include/glib-2.0/glib/gmacros.h:441:43: note: expanded from macro '_GLIB_AUTOPTR_FUNC_NAME'
#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName
                                          ^
<scratch space>:81:1: note: expanded from here
glib_autoptr_cleanup_GESDemux
^

../plugins/ges/gessrc.c:56:1: error: unused function 'glib_autoptr_cleanup_GESSrc' [-Werror,-Wunused-function]
G_DECLARE_FINAL_TYPE (GESSrc, ges_src, GES, SRC, GESBaseBin);
^
/home/matt/Projects/cerbero/build/dist/android_universal/x86_64/include/glib-2.0/gobject/gtype.h:1401:3: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
  _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
  ^
/home/matt/Projects/cerbero/build/dist/android_universal/x86_64/include/glib-2.0/glib/gmacros.h:451:22: note: expanded from macro '_GLIB_DEFINE_AUTOPTR_CHAINUP'
  static inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) {                     \
                     ^
/home/matt/Projects/cerbero/build/dist/android_universal/x86_64/include/glib-2.0/glib/gmacros.h:441:43: note: expanded from macro '_GLIB_AUTOPTR_FUNC_NAME'
#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName
                                          ^
<scratch space>:158:1: note: expanded from here
glib_autoptr_cleanup_GESSrc
^
2019-08-28 18:46:36 +10:00
Thibault Saunier
82a970f415 ges: fix G_DECLARE_FINAL_TYPE -Werror with clang
Also fix wrong casing the `G_DECLARE` for GESDemux.

../subprojects/gst-editing-services/plugins/ges/gessrc.c:56:1: warning: unused function 'GES_SRC' [-Wunused-function]
G_DECLARE_FINAL_TYPE (GESSrc, ges_src, GES, SRC, GESBaseBin);
^
/usr/include/glib-2.0/gobject/gtype.h:1405:33: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) {                                     \
                              ^
<scratch space>:39:1: note: expanded from here
GES_SRC
^
../subprojects/gst-editing-services/plugins/ges/gessrc.c:56:1: warning: unused function 'GES_IS_SRC' [-Wunused-function]
/usr/include/glib-2.0/gobject/gtype.h:1407:26: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                         \
                        ^
<scratch space>:42:1: note: expanded from here
GES_IS_SRC
^

../subprojects/gst-editing-services/plugins/ges/gesdemux.c:50:1: warning: unused function 'GES_Demux' [-Wunused-function]
G_DECLARE_FINAL_TYPE (GESDemux, ges_demux, GES, Demux, GESBaseBin);
^
/usr/include/glib-2.0/gobject/gtype.h:1405:33: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) {                                     \
                              ^
<scratch space>:72:1: note: expanded from here
GES_Demux
^
../subprojects/gst-editing-services/plugins/ges/gesdemux.c:50:1: warning: unused function 'GES_IS_Demux' [-Wunused-function]
/usr/include/glib-2.0/gobject/gtype.h:1407:26: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                         \
                        ^
<scratch space>:75:1: note: expanded from here
GES_IS_Demux
^
2019-08-27 10:43:11 -04:00
Thibault Saunier
19426863e9 gesdemux: Fix querying if we need stack reloading
We are probing upstream queries, not downstream ones

This was clearly a small test that slipt into previous commit
2019-08-20 15:29:57 -04:00
Thibault Saunier
91dd3e44a7 doc: Add some missing Since: 2019-08-12 10:10:22 -04:00
Thibault Saunier
f51f2f70de gesdemux: Compute sinkpad caps based on formatter mimetypes
Implement lazy loading asset cache so gesdemux use the formatters
assets while GES hasn't been initialized.

And set extensions to temporary files as some formatters require
the information (otio)
2019-07-26 13:48:51 -04:00
Thibault Saunier
abb4f005e3 Mark nested timeline assets as such
Adding a property to let the application know

Also make sure that the duration of nested timeline assets is reported
as CLOCK_TIME_NONE as those are extended as necessary.

And make a difference between asset duration and their max duration
As nested timelines can be extended 'infinitely' those max duration
is GST_CLOCK_TIME_NONE, but their duration is the real duration of
the timeline.
2019-07-26 13:48:51 -04:00
Thibault Saunier
6f9e6d3586 formatter: Enhance error reporting
And add a "loading-error" signal in GESProject so we can report
issue when loading async elements for the timeline.
2019-07-26 13:48:51 -04:00
Thibault Saunier
18eedb3c28 gesdemux: Add a testsrc to timelines if parent nleobject duration is too long 2019-07-26 13:48:51 -04: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
902b8ad98e gesdemux: Detect recursively loading the same project file
And error out when it is the case.
2019-07-05 18:30:41 -04:00
Thibault Saunier
e9e24a23ba gesdemux: Create proper stream-ids 2019-07-05 18:30:41 -04:00
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
6d895ea111 demux: Create timeline from the streaming thread
First marshilling it to the main thread is dangerous as it is a blocking
operation and it should never happen there.

The asset cache is MT safe now so it is possible to load the timeline
from that thread directly
2019-07-05 17:57:04 -04:00
Thibault Saunier
61c952c714 uri-asset: Implement multi threading support
Making sure to have 1 GstDiscoverer per thread.

Use that new feature in gesdemux by loading the timeline directly from
the streaming thread. Modifying the timeline is not supported allowed
anyway.
2019-07-05 17:56:03 -04:00
Thibault Saunier
cb96d0287e Use the new GstDiscoverer caching feature 2019-07-05 17:54:29 -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
aca18a29b5 plugins:ges: Factor out a GESBaseBin class
And use it in both gesdemux and gessrc
2019-07-05 17:50:57 -04:00
Thibault Saunier
db97b2c921 gesdemux: Emit no-more-pad as required 2019-07-05 17:50:52 -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
Thibault Saunier
93289ac406 gesdemux: Properly combine flows 2019-07-05 17:49:07 -04:00
Thibault Saunier
cf43d9b6d4 plugin: Make use of G_DECLARE
And remove useless .h files
2019-07-05 17:48:23 -04:00
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