Commit graph

18938 commits

Author SHA1 Message Date
Roman Shpuntov fd280c0981 systemclock: Fix clock time conversion on Windows/xbox
The returned ratio can be bigger than GST_SECOND, in which case we would
forever return 0 for the system clock time. Even in other cases if it's
close to GST_SECOND it would result in accuracy loss.

Instead of doing the division by GST_CLOCK_TIME_NONE during
initialization once, do it every time the clock time is requested.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/575

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/534>
2020-06-18 17:41:25 +03:00
Edward Hervey 31e6d766ff gst: Delay creation of threadpools
Since glib 2.64, gthreadpool will start waiting on a GCond immediately upon
creation. This can cause issues if we fork *before* actually using the
threadpool since we will then be signalling that GCond ... from another process
and that will never work.

Instead, delay creationg of thread pools until the very first time we need
them. This introduces a minor (un-noticeable) delay when needing a new thread
but fixes the issues for all users of GSTreamer that will call gst_init, then
fork and actually start pipelines.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2131 for more context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/531>
2020-06-16 08:23:21 +02:00
Thibault Saunier 9d195da36c inputselector: Push event on selected pad only when one is selected
Calling `gst_input_selector_get_active_sinkpad` triggers sinkpad
selection but won't notify about it, leading  to breaking code that
relying on it. This new code added as part of
63ccf45395 was thought to be triggered only
when a pad was already selected and not change the behavior otherwise
so this commit makes sure it is actually the case.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/766

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/522>
2020-06-15 17:33:22 +00:00
Edward Hervey 33557f8db1 check: Fix datetime unit test for builds without assert
If built with assertions disabled, we need to ensure the variable is properly
reset before testing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/530>
2020-06-12 15:02:13 +02:00
sohwan.park 87504fe877 message: Add unit test for GST_MESSAGE_RATE_CHANGE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/528>
2020-06-11 23:16:33 +09:00
sohwan.park 4ce161258e event: Add unit test for INSTANT_RATE_CHANGE and INSTANT_RATE_SYNC_TIME
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/528>
2020-06-11 23:16:30 +09:00
sohwan.park 6dea5d2c7b segment: Add unit test for GST_SEEK_FLAG_INSTANT_RATE_CHANGE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/528>
2020-06-11 10:53:59 +09:00
Thibault Saunier f63b5cbade docs: Update plugins cache 2020-06-10 13:37:08 +00:00
Thibault Saunier 34db244d46 docs: Fix the way we mark properties mutability
When nothing is specified, we should default to NULL, not PLAYING
2020-06-10 13:37:08 +00:00
Sebastian Dröge 44d73efc49 aggregator: Fix StartTimeSelection enum type registration
Make it thread-safe and use the actual C identifiers for the "name"
field, as otherwise gobject-introspection will fall apart.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/527>
2020-06-10 11:23:42 +03:00
Thibault Saunier 3db985548c docs: Update plugins cache 2020-06-09 11:45:07 -04:00
Matthew Waters 15761c93c2 tracers/leaks: fix reentrancy issues with the custom signal handlers
The signal handlers were performing mutex operations in the signal handlers
which is bad idea that may lead to deadlocks.

1. Implement a separate signal thread to handle the signals.
2. Use the glib provided signal GSource to avoid performing operations in
   the signal handler.

Fix #186

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/487>
2020-06-09 12:36:18 +00:00
Havard Graff 0b0a120a37 gst_private.h: increse padding in struct _GstClockEntryImpl
When compiling for 32bit ios arm, the static assert that the
GstClockEntryImpl smaller or equal to the struct _GstClockEntryImpl
triggered. (they were 12bytes off).

To fix this, the padding is increased by 12 bytes (on 32bit).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/525>
2020-06-08 22:48:55 +02:00
Tim-Philipp Müller d1cd07b72b paramspecs: add 'Since: 1.18' markers for new param spec flags
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/524>
2020-06-08 16:04:51 +01:00
Seungha Yang c092dd40ca doc: Add GstObject specific GParamFlags
Document "controllable", "mutable-{ready, paused, playing}" and
"conditonally-available" GParamFlags

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/283>
2020-06-08 14:18:09 +00:00
Seungha Yang 1769187328 paramspecs: Add a GParamSpecFlag to indicate the property might not always exists
Add new flag for users to notice that the property is not guaranteed
to exist depending on environment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/283>
2020-06-08 14:18:09 +00:00
Edward Hervey 58859c8ee9 check: Avoid race with leaks test
The problem is that the taskpool might not have completely drained by the time
we check for leaks.

Instead, ensure all tasks have stopped before testing for valid results.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/523>
2020-06-08 09:47:03 +02:00
Camilo Celis Guzman 3ac3a01298 queue: protect against lost wakeups for iterm_del condition
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/513>
2020-06-06 17:41:20 +00:00
Sebastian Dröge 5e8e847687 docs: Prevent potential NULL pointer dereference when serializing plugin object types
CID 1464007

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/516>
2020-06-06 08:14:39 +00:00
Edward Hervey 221cb03664 padtemplate: Directly unreference the documentation caps
The public-facing API has a (valid) protection against NULL caps. We can just
directly remove it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/515>
2020-06-06 08:25:16 +02:00
Mathieu Duponchelle ba0ffeb36c utils: fix markdown link to #GstPluginAPIFlags 2020-06-06 01:10:09 +02:00
Mathieu Duponchelle 169abc86e9 padtemplate: expose getters and setters "documentation caps"
This can be used in elements where the caps of pad templates
are dynamically generated and dependent on the environment.

An example is x265enc.
2020-06-06 00:38:29 +02:00
Mathieu Duponchelle 0c1ce6e8c4 utils: expose GstPluginAPIFlags
These can be passed to gst_type_mark_as_plugin_api, to inform
plugin cache generation.

For now a single flag is specified, "IGNORE_ENUM_MEMBERS", it
can be used for dynamically generated enums to avoid documenting
environment-specific enumeration members. An example is
GstX265EncTune.
2020-06-06 00:38:29 +02:00
Mathieu Duponchelle d46e902273 identity, clocksync: implement provide_clock
Since those are using the clock for sync, they need to also
provide a clock for good measure. The reason is that even if
downstream elements provide a clock, we don't want to have
that clock selected because it might not be running yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/509>
2020-06-05 11:28:12 +00:00
Thibault Saunier 2cd23d67d3 structure: Quickly document serialization format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/510>
2020-06-05 11:01:43 +00:00
Thibault Saunier bd0abb3857 structure: Reflow the SECTION comment
Removing trailing whitespaces and avoiding to exceed 80chars

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/510>
2020-06-05 11:01:43 +00:00
Jan Schmidt 8e670a23b0 queue2: Defer downstream bitrate query to the streaming thread.
When we want to perform a downstream bitrate query, just
set the reconfigure flag on the srcpad and get the streaming
thread to do it. That avoids emitting a downstream query
when receiving the upstream RECONFIGURE event - which can
lead to deadlocks if downstream is sending the event from
within a lock - e.g. input-selector.

If querying the downstream bitrate changes the cached
value, then make sure to update our buffering state
and potentially post a BUFFERING message to the application.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/566
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/501>
2020-06-05 10:29:19 +00:00
Edward Hervey f2478618b5 inputselector: Avoid deadlock when requesting pads
The deadlock was the following:
* One thread requests a new pad, the internal lock is kept while adding the pad
* Another thread (or the same one) requests the internal links of a pad (could
be that pad)... which also requires that lock.

That internal lock is not required when adding the pad to the element (which is
the last action when requesting a new pad). The fact it will be actually used
will be *after* the request pad function is released.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/512>
2020-06-05 09:59:15 +00:00
Mathieu Duponchelle cc87357105 doc: document fundamental types 2020-06-04 15:49:25 -04:00
Thibault Saunier 31e68eb26a doc: Require hotdoc >= 0.11.0 2020-06-04 15:49:24 -04:00
Sebastian Dröge 6e50c6c6fb docs: Don't include GObject and GstPipeline signals
They're already documented from elsewhere.
2020-06-04 15:49:24 -04:00
Sebastian Dröge ea32d1741c aggregator: Export GstAggregatorStartTimeSelection in the header and document it
It is used by one of the aggregator properties and was private in the
source file before.
2020-06-04 15:49:24 -04:00
Sebastian Dröge 3e37b0ab82 docs: Update gst_plugins_cache.json 2020-06-04 15:49:24 -04:00
Sebastian Dröge 5bdbde32da plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 15:49:24 -04:00
Sebastian Dröge 65e266fe6e docs: Store all non-element types in a separate other-types array
And also make sure to not duplicate them.
2020-06-04 15:49:24 -04:00
Sebastian Dröge 994d74faf4 docs: Use gst_type_is_plugin_api() for deciding whether a type should be included in the docs 2020-06-04 15:49:24 -04:00
Sebastian Dröge 3de23c30e1 utils: Add helper function for marking types as plugin API
This can be used to mark additional types exposed by plugins (i.e.
enums, flags and GObjects) via properties, signals or pad templates as
plugin API. They can then be picked up by the documentation for the
plugin.

Not all types exposed by plugins are documented automatically because
they might come from an external library and should be documented from
there instead.
2020-06-04 15:49:23 -04:00
Sebastian Dröge b705ab4de6 docs: Don't try to print pad templates of non-GstElement types 2020-06-04 15:49:23 -04:00
Sebastian Dröge 8e28799303 docs: Print object/flag/enum type information in a more structured way and in more places
Custom types are printed now for signal parameters/return value and properties, and more consistently.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/59
2020-06-04 15:49:23 -04:00
Edward Hervey 08d2d3cfd7 queue2: Avoid races when posting buffering messages
When posting a buffering message succesfully:
* Remember the *actual* percentage value that was posted
* Make sure we only reset the percent_changed variable if the value we just
  posted is indeed different from the current value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/511>
2020-06-04 11:24:39 +02:00
Thibault Saunier c8cb342833 tests:validate: Whitelist validate plugins
This is required so we can use validateflow for example

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/506>
2020-05-28 14:56:26 -04:00
Thibault Saunier 95b26d1f89 tester: Fix exit code on bailout/skipping
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/506>
2020-05-28 12:39:32 -04:00
Matthew Waters 0cccf63fa0 promise: update documentation and annotations for NULL replies
The implementation and tests already handle NULL replies.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1300
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/502>
2020-05-28 10:23:51 +00:00
Tim-Philipp Müller e0bcf24d30 tests: leak tracer: disable stack traces for faster test execution
This test takes 39 seconds on my machine even though it just runs
a couple of fakesrc num-buffers=2 ! fakesink pipelines. Most of
the cpu seems to be spent in libz, related to stack trace management.

Use stack-traces-flags=none instead of stack-traces-flags=full
until a better solution can be found. Might warrant more
investigation in any case..

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/503>
2020-05-27 14:19:21 +00:00
Mathieu Duponchelle 07fcd4d1b5 queue2: don't post unnecessary buffering message, refine locking
This is a follow up to review comments in !297

+ The posting of the buffering message in READY_TO_PAUSED isn't
  needed, removing it made the test fail, but the correct fix
  was simply to link elements together

+ Move code to relock the queue and set last_posted_buffering_percent
  and percent_changed inside the buffering_post_lock in create_write().
  This makes locking consistent with post_buffering()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/297>
2020-05-27 13:07:03 +00:00
Carlos Rafael Giani 6d4ad80b82 queue2: Fix missing/dropped buffering messages at startup
This fixes a bug that occurs when an attempt is made to post a buffering
message before the queue2 was assigned a bus. One common situation where
this happens is when the use-buffering property is set to TRUE before the
queue2 was added to a bin.

If the result of gst_element_post_message() is not checked, and the
aforementioned situation occurs, then last_posted_buffering_percent and
percent_changed will still be updated, as if posting the message succeeded.
Later attempts to post again will not do anything because the code then
assumes that a message with the same percentage was previously posted
successfully and posting again is redundant.

Updating these variables only if posting succeed and explicitely
posting a buffering message in the READY->PAUSED state change ensure that
a buffering message is posted as early as possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/297>
2020-05-27 13:07:03 +00:00
Sebastian Dröge bf0672f00b systemclock: Only try initializing entries if they were not initialized before
And add assertions accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00
Sebastian Dröge d9bf0f1ec2 systemclock: Clarify comment that described a previous version of the code
Nowadays we are only waking up the head entry waiting if either the head
entry is unscheduled (which is handled some lines above already), or
when the head entry specifically is woken up because a new entry became
the new head entry.

We're not waking up *all* entries anymore whenever any entry in the last
was unscheduled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00
Sebastian Dröge c4a2d92718 systemclock: Get rid of atomic access to clock entry status and use the mutex instead
We already have a mutex in each clock entry anyway and need to make use
of that mutex in most cases when the status changes. Removal of the
atomic operations and usage of the mutex instead simplifies the code
considerably.

The only downside is that unscheduling a clock entry might block for the
time it needs for the waiting thread to go from checking the status of
the entry to actually waiting, which is not a lot of code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00
Sebastian Dröge 3e924f5df9 systemclock: Don't start waiting for a clock id if it was signalled before
Otherwise it can happen that unscheduling a clock id never takes place
and instead it is waiting until the normal timeout. This can happen if
the wait thread checks the status and sets it to busy, then the
unschedule thread sets it to unscheduled and signals the condition
variable, and then the waiting thread starts waiting. As condition
variables don't have a state (unlike Windows event objects), we have to
remember ourselves in a new boolean flag protected by the entry mutex
whether it is currently signalled, and reset this after waiting.

Previously this was not a problem because a file descriptor was written
to for waking up, and the token was left on the file descriptor until
the read from it for waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00