Commit graph

19069 commits

Author SHA1 Message Date
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
Nirbheek Chauhan
926652be10 meson: Enable some MSVC warnings for parity with GCC/Clang
This makes it easier to do development with MSVC by making it warn
on common issues that GCC/Clang error out for in our CI configuration.

Continuation from https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/223

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/698>
2020-11-04 18:29:44 +00:00
Bing Song
e5e27010c8 identity/clocksync: Also provide system clock if sync=false
identity should provide when sync=true. Don't provide when sync=false.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/690>
2020-11-04 09:27:53 +00:00
Jonathan Matthew
146b2ddf50 queue2: Fix modes in scheduling query handling
Create a new query to send upstream and copy the flags across from it,
rather than reusing the same query, as this allows us to prevent use
of pull mode when we don't have a download file.

Fixes: #629
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/693>
2020-11-04 09:05:18 +00: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
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
Mathieu Duponchelle
fc5cd9591a baseparse: always use incoming DTS
When parsing interlaced video streams, ignoring incoming DTS could
cause the parser to end up with PTS < DTS output buffers, for example
when increasing next_dts using the duration of the last pushed
buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/681>
2020-10-27 01:58:32 +01: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
Seungha Yang
61703625f6 filesrc: Use *Ex Win32 method for UWP
non-*Ex methods are not allowed for UWP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/610>
2020-10-21 17:24:01 +09:00
Sebastian Dröge
44e3888657 filesrc: Don't use fstat() on Windows but use specific Windows APIs
fstat() fails on Windows in various situations if the file metadata has
invalid values, and we only care about getting attributes and the file
size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/610>
2020-10-21 16:30:27 +09:00
Sebastian Dröge
671e459d69 filesrc: Remove unused #define on Windows
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/610>
2020-10-21 16:30:27 +09:00
Xavier Claessens
6780dfd55a pkgconfig: Fix missing libcheck dependencies in gstreamer-check-1.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/676>
2020-10-16 18:14:38 +00:00
Nicolas Dufresne
e600c85aee aggregator: Include min-upstream-latency in buffering time
While we can fixe the upstream latency using the min-upstream-latency, we
are now forced to use queues (hence more thread) in order to store the pending
data whenever we have an upstream source that has lower latency.

This fixes the issue by allowing to buffer the fixed upstream latency. This is
particularly handy on single core systems were having too many threads can
cause serious performance issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/677>
2020-10-16 17:50:11 +00:00
Olivier Crête
3d5c849a6c identity: Add a stats property
This is inspired by the stats on rtpjitterbuffer, it's useful
to be able to get some simple stats out of the pipeline without having
to write yet another pad probe.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/615>
2020-10-16 15:43:56 +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
Seungha Yang
74dc8f7678 meson: Disallow DbgHelp for UWP build
Most symbols in DbgHelp.h are not allowed for UWP

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/665>
2020-10-12 03:46:54 +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
Matthew Waters
e4567b2dbd build: use cpu_family for arch checks
e.g. on 32-bit arm, we may have armv6, armv7l, armv7hf, etc which all
generally have the same layouts.  cpu_family() groups all of these into
just 'arm' that the ABI check table is expecting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/664>
2020-10-09 12:13:15 +11:00
Jan Alexander Steffens (heftig)
0f93889c7a basetransform: Fix in/outbuf confusion of _default_transform_meta
The default implementation doesn't actually use its buffer parameters,
but this error might have been the cause of some actual confusion in
the plugins code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/663>
2020-10-08 18:30:00 +02: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
Matthew Waters
9f17094cf3 aggregator: don't fail all sink pads when a caps event fails negotiation
If one pad returns not-negotiated from a caps event, then all other sink
pads were returning not-negotiated.

In our case, we can't reliably easily fail at all so just remove that
code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/623>
2020-09-18 09:04:21 +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
Sebastian Dröge
46305b292f aggregator: Hold SRC_LOCK while unblocking via SRC_BROADCAST()
Otherwise the clock id we access might not be a valid pointer anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/630>
2020-09-18 07:01:14 +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
Seungha Yang
62f2a86eea valve: Fix MSVC compile warning
gstvalve.c(285) : warning C4715: 'gst_valve_event_needs_dropping':
not all control paths return a value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/624>
2020-09-11 02:59:51 +09: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
Sebastian Dröge
1a59eeedb4 harness: Add gst_harness_set_live()
By default each harness returns is_live=TRUE in latency queries. This is
often not desired and can now be overridden.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/599>
2020-09-10 14:18:42 +03:00
Sebastian Dröge
ca38070bdf aggregator: Reset latency values in start()
Some base classes like videoaggregator try retrieving the latency during
construction, which causes the latency values to be set already until
reconfiguration happens.

By resetting them the same way as in stop() we ensure that we always
start cleanly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/599>
2020-09-10 14:18:34 +03:00
Tom Schoonjans
40c994cdde ptp_helper_post_install.sh: deal with none
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/620>
2020-09-09 19:27:19 +00:00