Commit graph

2770 commits

Author SHA1 Message Date
Mathieu Duponchelle
b6df564251 taskpool: expose new "shared" task pool implementation
While the default implementation will spawn a thread per new
pushed task, this new implementation instead spawns a maximum
number of threads, then queues new tasks on existing threads.

The thread that the new task will be queued on is picked in
a pretty naive fashion, by simply popping the first thread
from a queue and pushing it back to the tail, but this is
an implementation detail and can always be sophisticated
in the future if the need arises.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/692>
2020-11-05 18:18:28 +00:00
Jan Schmidt
f6ce1686f1 harness: Handle element not being set cleanly.
If a harness is created with gst_harness_new_empty(), there
might not be an internal element to unref on cleanup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/686>
2020-10-30 23:46:07 +11:00
Jan Schmidt
2a9267f2d4 bin: When removing a sink, check if the EOS status changed.
Removing a sink that hasn't posted EOS might change the bin itself
to EOS if it's the last remaining non-EOSed sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/683>
2020-10-30 03:56:02 +11:00
Philippe Normand
41677a526b devicemonitor: Stop only the already started providers
If a device provider fails to start (for instance the pulseaudio provider unable
to connect to the PulseAudio daemon) then the monitor should not keep track of
it in its `started` providers list. Otherwise a false positive critical warning
would be raised.

This patch also switches the started_count type from bool to int, for
consistency. This is a counter, after all.

API: gst_device_provider_is_started
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/679>
2020-10-22 11:48:05 +00:00
Stéphane Cerveau
c6c6ad2667 meson: update glib minimum version to 2.56
In order to support the symbol g_enum_to_string in various
project using GStreamer ( gst-validate etc.), the glib minimum
version should be 2.56.0.

Remove compat code as glib requirement
is now > 2.56

Version used by Ubuntu 18.04 LTS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/199>
2020-10-15 18:12:32 +02:00
Mathieu Duponchelle
acdb4ce03d gstvalue: expose gst_value_deserialize_with_pspec()
Typing hints can only be passed to gst_value_deserialize()
through the type of the passed-in value. This means deserialization
can only target the desired type for the top-level elements,
making it for example impossible to deserialize an array of
flags to the expected type.

This commit exposes a new function, gst_value_deserialize_full(),
that takes an optional pspec as the extra parameter, and updates
the deserialization code to pass around that pspec, or the
element_spec when recursively parsing the elements of a list-type
value.

This allows for example passing arrays of flags through the
command line or gst_util_set_object_arg, eg:

foo="<bar,bar+baz>"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/629>
2020-10-03 01:02:55 +02:00
Mathieu Duponchelle
bbca6b1ddf meta: expose API to register and create custom meta
Custom meta is backed by a GstStructure, and does not require
that users of the API expose their GstMeta implementation as
public API for other components to make use of it.

In addition, it provides a simpler interface by ignoring the
impl vs. api distinction that the regular API exposes.

This new API is meant to be the meta counterpart to custom events
and messages, and to be more convenient than the lower-level API
when the absolute best performance isn't a requirement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/609>
2020-09-27 11:08:03 +00:00
Matthew Waters
4f95dec74a baseparse: prefer upstream caps rather than overriding
e.g. h264parse ! video/x-h264,stream-format=avc receives the following:
- caps: video/x-raw,stream-format=byte-stream
- gap event: baseparse tries to choose some default caps but would
  override the downstream chosen caps field with upstreams value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/581>
2020-09-18 08:12:30 +00:00
Seungha Yang
7d12aa07d4 tests: leaks: Allow null tracer string if there's no available stack trace
In case that no available stack tracer, leak tracer will set
null string value for `trace` field. I would likely happen
on Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/625>
2020-09-15 06:35:34 +09:00
Seungha Yang
f120ad0012 tests: element: Don't run too many loop
g_thread_yield() doesn't ensure thread switching actually.
It would result to adding so many pads. Depending on system,
timeout might happen then.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/625>
2020-09-15 04:41:19 +09:00
Seungha Yang
f44312ae5d tests: seek: Don't use too strict timeout for validation
Expected segment-done message might not be seen within expected
time if system is not powerful enough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/625>
2020-09-15 00:54:58 +09:00
Xℹ Ruoyao
1aa16e0b2b skip elements/leak.c if tracer is not available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/621>
2020-09-09 12:20:01 +00:00
Mathieu Duponchelle
52aa6a9dda aggregator: make peek() has() pop() drop() buffer API threadsafe
Enforce that the last buffer that was peeked (or had its existence
checked) on a pad is the one that gets popped / dropped, resetting
at the end of each aggregation cycle.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/608>
2020-09-09 01:39:27 +00:00
Xavier Claessens
9961398d25 Meson: Override gst-tester-1.0 program to find it in other modules
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/586>
2020-08-04 11:23:42 +00:00
Nirbheek Chauhan
5195ad9126 gsturi: Add new API for storing unmodified userinfo / fragment
New API: gst_uri_from_string_escaped()

Identical to gst_uri_from_string() except that the userinfo and
fragment components of the URI will not be unescaped while parsing.

This is needed for correctly parsing usernames or passwords with `:`
in them such as reported at:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/831

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/583>
2020-08-03 16:07:45 +00:00
Nirbheek Chauhan
5f4723d842 tests: Add more tests for gsturi
Add tests that exercise unescaping of userinfo and fragments.

Also convert to a modular macro-based definition so that we can reuse
the list of tests in the next commit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/583>
2020-08-03 16:07:44 +00:00
Hosang Lee
411d255154 gsturi: unescape '=' in http query
Don't use percent-encoding for '=' in http queries.
'=' in the following kind of http query should be maintained.
example:
?token=exp=123~acl=/QualityLevels(*~hmac=0cb ...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/580>
2020-07-29 09:06:12 +00:00
Camilo Celis Guzman
edcbc7cc98 basetransform: handle invalid subclass implementation for fixate_caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/575>
2020-07-28 14:14:38 +00:00
Tim-Philipp Müller
e4f7cdb0df tracer: declare GstTracer API stable
It's been around for more than 4 years and people have built
lots of stuff on top of it, doesn't really make sense to keep
it marked as unstable. We're unlikely to change it now, and
we can always deprecate it and make a new one if needed.

This stabilises the following API:
- gst_tracer_register()
- gst_tracing_get_active_tracers()
- gst_tracing_register_hook()
- gst_tracer_record_new()
- gst_tracer_record_log()

Might also help a bit with #424

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/576>
2020-07-24 13:33:50 +01:00
Thibault Saunier
aaa95cfef7 directcontrolbinding: Properly initialize default last_value
It was zero and in some condition it means that the control binding
values where ignored (as shown in the test). Setting it to MAXDOUBLE
so that the first time we sync the values from a a timestamp in the
right range the proper value is computed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/564>
2020-07-18 20:47:29 +00:00
Mathieu Duponchelle
3df82624ea tests/elements/leaks.c: check get_tracer_by_name return value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/557>
2020-07-10 15:13:11 +00:00
Olivier Crête
44ef5a7c8c deviceprovider: Do static probe on start as fallback
For providers that don't support dynamic probing, just fall back to doing
a static one on start() to make the UI developers life easier.

This also means that the monitor doesn't need to call _can_monitor() before
calling start.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/353>
2020-07-06 15:08:27 -04:00
Michael Olbrich
1206a60bac bus: clear bus->priv->signal_watch immediately when the source is removed
There is a race-condition that can trigger the assertion in
gst_bus_add_signal_watch_full():

If gst_bus_add_signal_watch_full() is called immediately after
gst_bus_remove_signal_watch() then bus->priv->signal_watch may still be set
because gst_bus_source_dispose() or gst_bus_source_finalize() was not yet
called.
This happens if the corresponding GMainContext has the source queued for
dispatch. In this case, the following dispatch will only unref and delete
the signal_watch because it was already destroyed. Any pending messages
will remain until a new watch is installed.

So bus->priv->signal_watch can be cleared immediately when the watch is
removed. This avoid the race condition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/543>
2020-06-24 15:08:59 +02: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
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
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
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
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
Edward Hervey
79374b8d94 value: Fix comparison of int/int64 ranges
ranges are only equal if:
* Their bounds are equal
* And their step value are equal *IF* they contain more than one value

https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/253
2020-05-25 08:29:21 +02:00
Thibault Saunier
827c181447 tester: Stop using g_file_new_build_filename
It was introduced in GLib 2.56 only

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/495>
2020-05-19 14:17:34 -04:00
Thibault Saunier
34916e133d tests: Add a gst-tester utility
gst-tester is a tool to launch `.validatetest` files with
TAP[0] compatible output and supporting missing `gst-validate`
application which means that it can be cleanly integrated with meson
test harness.

It allows us to use `gst-validate` to write integration tests in any
GStreamer repository keeping them as close as possible to the code. It
can simplify a lot test writing and reading and not having to go into
another repository to implement or run tests makes it more convenient to
use.

This also implements a stupid simple test to show how that works

[0] https://testanything.org/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/461>
2020-05-19 13:14:46 +00:00
Xu Guangxin
8a58d67709 tests: bufferpool: add dead lock test for buffer discard
you will see a deadlock after you apply this patch, and run following commandline:

GST_STATE_IGNORE_ELEMENTS=1 tests/check/gst_gstbufferpool

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/470>
2020-05-14 07:04:02 +00:00
Nirbheek Chauhan
b63dd628d2 meson: Pass native: false to add_languages()
This is needed for cross-compiling without a build machine compiler
available. The option was added in 0.54, but we only need this in
Cerbero and it doesn't affect older versions so it should be ok.
Will just cause a spurious warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/477>
2020-05-13 08:19:10 +00:00
Edward Hervey
67df099241 check: uri: Check return value
CID #1455381

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:11:20 +02:00
Edward Hervey
9daf1ca44e check: gstvalue: Check return value
As is done everywhere else

CID #1455540

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:11:20 +02:00
Edward Hervey
f085dabebc check: testclock: Check return values
As done everywhere else.

CID #1455383
CID #1455524

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:11:20 +02:00
Edward Hervey
b6c9491c92 check: gst_promise_reply() takes ownership
Copy the structure temporarily to check it further down.

CID #1455392

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:10:38 +02:00
Edward Hervey
78b0baa7c9 check: Don't leak test string
Turns out the length returned by `__gst_vasprintf()` doesn't include the final
`\0`.

CID #1455430

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:10:38 +02:00
Matej Knopp
cab5b22f21 taglist: Fix crash when comparing two lists of the same length but with different items
Fixes #549

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/469>
2020-05-08 11:04:14 +03:00
Jan Schmidt
e329e1f769 tests/input selector: Fix a shutdown crash
Hold a ref to the pad we're planning on sending EOS too, so that
it doesn't disappear if things shut down before the thread gets
to actually send the EOS event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/467>
2020-05-07 03:30:43 +10:00
Sebastian Dröge
687c65994e clocksync: Remove handoff signals
They're not really useful on this element and were just a leftover from
identity.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/443>
2020-05-04 09:21:02 +03:00
Sebastian Dröge
ed1022fa81 Use gst_object_unref() / gst_object_clear() instead of the GObject ones
To allow the refcounting tracer to work better. In childproxy/iterator
these might be plain GObjects but gst_object_unref() also works on them.
In other places where it is never GstObject, g_object_unref() is kept.
2020-04-20 16:28:52 +00:00
Thibault Saunier
88f0312624 value: Fix segfault comparing empty GValueArrays
Adding a test
2020-04-12 20:33:43 -04:00