Commit graph

8744 commits

Author SHA1 Message Date
Tim-Philipp Müller
7c0dcb91fc taskpool: fix docs warnings
gsttaskpool.c:507: Warning: Gst: gst_shared_task_pool_get_max_threads: unknown parameter 'max_threads' in documentation comment

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/703>
2020-11-20 14:57:55 +00:00
Edward Hervey
17feeb1bd6 systemclock: Use clock_nanosleep for higher accuracy
The various wait implementation have a latency ranging from 50 to 500+
microseconds. While this is not a major issue when dealing with a low number of
waits per second (for ex: video), it does introduce a non-negligeable jitter for
synchronization of higher packet rate systems.

The `clock_nanosleep` syscall does offer a lower-latency waiting system but is
unfortunately blocking, so we don't want to use it in all scenarios nor for too
long.

This patch makes GstSystemClock use clock_nanosleep (if available) as such:
* Any wait below 500us uses it
* Any wait below 2ms will first use the regular waiting system and then
  clock_nanosleep

  #	modified:   gst/gstsystemclock.c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/688>
2020-11-06 11:22:14 +01:00
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
Mathieu Duponchelle
b508287add taskpool: expose dispose_handle() API
This is useful when the subclass does return a non-NULL pointer
in push(), and the user doesn't want to call join()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/692>
2020-11-05 18:18:28 +00:00
Mathieu Duponchelle
c04034c50d taskpool: improve join() documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/692>
2020-11-05 18:18:28 +00:00
Mathieu Duponchelle
c884f4c124 taskpool: modify transfer annotations for push() and join()
While the default implementation passes NULL around as the
task handle, other implementations can only provide a safe
API by having that handle map to a refcounted opaque type.

While what's passed around is a gpointer, a valid transfer
type annotation has informative value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/692>
2020-11-05 18:18:28 +00:00
Sebastian Dröge
20f6a2ece4 Add some missing nullable annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/678>
2020-11-05 14:22:24 +02:00
Khem Raj
96ac9abb23 gst_private.h: increse padding in struct _GstClockEntryImpl
When compiling for 32bit architectures with 64bit time_t e.g. riscv32,
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 8 bytes (on 32bit).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/694>
2020-11-03 23:03:54 -08:00
Chris White
e74040b41e gstinfo: colorize PIDs in log messages
The PIDs on log lines were supposed to be colorized before, but the
escape sequence was incorrect.  With this change, the code uses the
correct sequence to colorize those PIDs.  E.g., instead of `\033[334m`
(incorrect), use `\033[34m` (correct).

This makes the log messages easier to read.  It also reduces the chance
that a buggy terminal will choke on the invalid escape sequence.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/624

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/689>
2020-10-31 15:10:23 -04: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
2e507d5a4b gstvalue: don't write to const char *
Our various deserializing functions require NULL terminators
to not over consume substrings (eg fields of an array). Instead
of writing a NULL terminator to the passed-in string, which may
result in segfaults, make a copy of the substring we're interested
in.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/672>
2020-10-13 01:19:47 +02:00
Xavier Claessens
4095a4b4c5 Meson: Use pkg-config generator
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4>
2020-10-12 13:39:17 +00:00
Tim-Philipp Müller
a2cbf75523 Remove unused valgrind detection
Having this just to log a debug message in case we're
running inside valgrind doesn't seem very useful, and
the code that used to use this no longer exists it seems.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/595>
2020-10-11 22:39:51 +00:00
Seungha Yang
271af223b7 info: Fix build on Windows ARM64 device
gstinfo.c(3086): error C2094: label 'done' was undefined

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/662>
2020-10-09 06:52:12 +00:00
Xavier Claessens
0ed165bf67 gst_init: Call gst_init_static_plugins() when available
When doing a static build, gstreamer-full-1.0 defines that symbol to
register static plugins. Cerbero's Android build will be updated to
implement that symbol too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/641>
2020-10-05 16:09:10 -04: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
Seungha Yang
220ce9c3fd info: Load DbgHelp.dll using g_module_open()
... and update meson file so that enable it only using required headers.

"dependency(...)" is unlikely successful for Windows SDK libraries
since it doesn't ship pkg-config file. So it needs to be changed
to "find_library()" to link corresponding .lib file. That would
result to most MSVC build system will link dbghelp.dll. However,
one drawback of the change is that gstreamer-1.0.dll will mandate
dbghelp.dll although it should be optional. So g_module_open() way
can be the most safe way in this case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/626>
2020-09-30 18:51:40 +00:00
Matthew Waters
19fb999e09 padtemplate: mark documentation caps as may be leaked
The template itself is already marked as such and the caps, the
documentation caps are a logical extension of those two.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/650>
2020-09-30 11:59:04 +10:00
Víctor Manuel Jáquez Leal
a854a1feda padtemplate: add missing annotation
Adds missing "transfer full" annotation for caps parameter in
gst_pad_template_set_documentation_caps()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/648>
2020-09-28 11:43:19 +00:00
Víctor Manuel Jáquez Leal
b81808de0e memory: fix documentation to display in html
Commit e9c99c05 added a deprecation message, but this message is not
displayed in the html page since the format was not correct.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/648>
2020-09-28 11:43:19 +00: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
Olivier Crête
e9c99c05ae memory: Deprecate GST_MEMORY_FLAG_NO_SHARE
This flag always causes problems as it prevents subbuffering,
instead one should create a custom GstAllocator to pool the GstMemory objects
and not rely on the lifetime of the GstBuffer object they were originally
attached to.

https://bugzilla.gnome.org/show_bug.cgi?id=757254

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/614>
2020-09-18 22:37:28 +00:00
Mathieu Duponchelle
3393b456e4 gstmeta: intern registered impl string
Subsequent lookups in the hashtable are probably better done
on memory we're confident is allocated to us :)

It was easy to trigger invalid reads by calling gst_meta_register
with dynamically allocated memory, freeing that memory, then
calling gst_meta_get_info()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/628>
2020-09-18 17:31:22 +00:00
Olivier Crête
f26a9ebafb deviceprovider: Returns non-floating devices from gst_device_provider_probe
This should make the API usage more consistent. Also document that the subclasses
should just return the devices as floating.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/558>
2020-09-18 14:52:12 +00:00
Sebastian Dröge
8d0055e185 event: Add optional flags to the GAP event
This allows to signal the reason for the gap, for example missing data
like packet loss.

Based on a patch by Mikhail Fludkov <misha@pexip.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/551>
2020-09-10 16:01:19 +00:00
Jordan Petridis
c12c7afd06 fix clang 10 warnings
the typesystem checks in g_atomic_pointer_compare_and_exchange
seem to trigger some false positives with clang 10

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/584>
2020-08-04 10:44:16 +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
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
Tim-Philipp Müller
31ed9cf284 utils: silence g-ir-scanner warnings about float conversion macros
663: Warning: Gst: symbol='GFLOAT_TO_LE': Unknown namespace for symbol 'GFLOAT_TO_LE'
664: Warning: Gst: symbol='GFLOAT_TO_BE': Unknown namespace for symbol 'GFLOAT_TO_BE'
665: Warning: Gst: symbol='GDOUBLE_TO_LE': Unknown namespace for symbol 'GDOUBLE_TO_LE'
666: Warning: Gst: symbol='GDOUBLE_TO_BE': Unknown namespace for symbol 'GDOUBLE_TO_BE'
669: Warning: Gst: symbol='GFLOAT_TO_LE': Unknown namespace for symbol 'GFLOAT_TO_LE'
670: Warning: Gst: symbol='GFLOAT_TO_BE': Unknown namespace for symbol 'GFLOAT_TO_BE'
671: Warning: Gst: symbol='GDOUBLE_TO_LE': Unknown namespace for symbol 'GDOUBLE_TO_LE'
672: Warning: Gst: symbol='GDOUBLE_TO_BE': Unknown namespace for symbol 'GDOUBLE_TO_BE'
678: Warning: Gst: symbol='GFLOAT_FROM_LE': Unknown namespace for symbol 'GFLOAT_FROM_LE'
679: Warning: Gst: symbol='GFLOAT_FROM_BE': Unknown namespace for symbol 'GFLOAT_FROM_BE'
680: Warning: Gst: symbol='GDOUBLE_FROM_LE': Unknown namespace for symbol 'GDOUBLE_FROM_LE'
681: Warning: Gst: symbol='GDOUBLE_FROM_BE': Unknown namespace for symbol 'GDOUBLE_FROM_BE'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/579>
2020-07-26 15:34:54 +01:00
Tim-Philipp Müller
6e7f4491ce math-compat.h: silence g-ir-scanner warnings
Easier to just make g-ir-scanner skip this header via #ifndef __GI_SCANNER__
than maintain different sets of headers in the meson.build file.

Warning: Gst: symbol="rint": Unknown namespace for symbol "rint"
Warning: Gst: symbol="rintf": Unknown namespace for symbol "rintf"
Warning: Gst: symbol="isnan": Unknown namespace for symbol "isnan"
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/579>
2020-07-26 15:34:54 +01:00
Tim-Philipp Müller
36715f407c event, query: fix g-ir-scanner warnings
gstevent.h:72: Warning: Gst: symbol='FLAG': Unknown namespace for symbol 'FLAG'
gstquery.h:76: Warning: Gst: symbol='FLAG': Unknown namespace for symbol 'FLAG'

Use _FLAG(xyz) instead of FLAG(xyz) to silence g-ir-scanner
warnings about this internal helper define.

It's also slightly more hygienic.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/579>
2020-07-26 15:34:54 +01: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
Tim-Philipp Müller
cb5d31a2fb buffer: improve seqnum fallback warning message
Print target CPU we're building for.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/565>
2020-07-22 12:19:59 +00:00
Tim-Philipp Müller
5bd81abdb1 buffer: fix meta sequence number fallback on rpi
The global seqnum variable wasn't actually increased in
the fallback code path, leading to all buffers getting
a seqnum of 0. Which also made the unit test fail.

This affects platforms/toolchains that don't have
64-bit atomic ops such as when compiling for armv7 rpi.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/565>
2020-07-22 12:19:59 +00:00
Matthew Waters
a1b41b2b24 gst/bufferpool: only resize in reset when maxsize is larger
Only resize the buffer if the maxsize is larger then the configued pool
size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/570>
2020-07-21 23:31:17 +10:00
Seungha Yang
30dfa177be info: Fix possible broken debug output on Windows
Depending on Windows codepage setting, some characters could
be broken when printing on terminal. Fortunatly g_print* family will
take care Windows codepage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/566>
2020-07-17 22:59:21 +09:00
Olivier Crête
90530bdb28 pad: More explicitly explain how to post errors on GST_FLOW_ERROR
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/568>
2020-07-16 16:34:05 -04:00
Edward Hervey
cecb291263 Revert "gstinfo: Check threshold for category from macro"
This reverts commit dcece2a878.

This increased the code size and number of branches for all debug statements.

Fixes #564

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/563>
2020-07-13 08:02:26 +02:00
Thibault Saunier
1627222aa5 taglist: Stop inlining gst_tag_list_copy
This way it gets exposed to bindings through GObject Introspection.

Same logic as with d1b2d3429c

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/561>
2020-07-09 07:57:01 -04: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
Christoph Reiter
3cfda6d6eb gstelementfactory: Fix missing features in case a feature moves to another filename
In case a plugin filename was renamed with the plugin being in the registry cache
the features were not loaded after the rename:

1) Cache of old/gone filename was loaded, features added
2) New filename was loaded, features where not added because
   they were already found in the registry.
3) In the end stale cache entries for files which are no longer there
   are removed, including the wanted features.
4) The cache gets updated without the features.

Fix this by also checking at (2) that the found feature is from the loaded plugin
and not from some stale cache entry.

This affected directsoundsink where libgstdirectsoundsink.dll was renamed
to libgstdirectsound.dll, losing the directsoundsink element in the process.

Fixes #290

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/102>
2020-07-06 14:31:48 +00:00
Sebastian Dröge
d22813ef97 element: When removing a ghost pad also unset its target
Otherwise the proxy pad of the ghost pad still stays linked to some
element inside the bin, which is not allowed anymore according to the
topology.

In 2.0 this should be fixed more generically from inside GstGhostPad but
currently there is no way to get notified that the ghost pad is
unparented.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/553>
2020-07-03 06:55:37 +00:00
Sebastian Dröge
f341619a4d stream: Don't use GST_FIXME_OBJECT() when generating a random stream id if the caller didn't provide one
That would call into gst_info_describe_stream(), which takes the same
mutex a second time and then deadlocks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/552>
2020-07-01 19:50:20 +00:00
Mathieu Duponchelle
1816f74339 gstutils: fix link in parse_bin_from_description_full doc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/475>
2020-07-01 18:56:47 +01:00
Jan Schmidt
53b193414d gstbin: Fix docs typo
element-added-deep -> deep-element-added in the GstBin doc header

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/547>
2020-07-01 02:22:43 +10: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
Nirbheek Chauhan
488acce730 registry: Print the pointer when printing features
This is what we do everywhere else too, useful for debugging.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/542>
2020-06-23 12:16:49 +01:00
Nirbheek Chauhan
43174bfe1d registry: Use a toolchain-specific registry file on Windows
If we load a plugin registry for MinGW plugins when running with MSVC,
we will have to write out the whole cache again, and vice-versa. Just
use separate cache files so that the cache is actually useful.

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/427

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/542>
2020-06-23 12:16:45 +01:00