Commit graph

8567 commits

Author SHA1 Message Date
Mathieu Duponchelle
0dafe6e639 gstvalue: use value_nick for serialization
not value_name . This was causing incorrect launch lines to be
displayed by gst-device-monitor, and the deserialization code
below works with nicks.
2019-09-17 01:09:05 +00:00
Mathieu Duponchelle
a9e2776074 deviceprovider: set the bus to non-flushing before calling klass->start
Not posting DEVICE_ADDED messages while a device provider is being
started makes things awkward for applications, as they have to call
get_devices() after starting the monitor.

This requires redundant code on the application side, and as far as
I understand also could cause race conditions, when a device gets
added between the calls to gst_device_monitor_start() and
gst_device_monitor_get_devices(), causing the application to "see"
the same device twice.
2019-09-16 23:56:44 +00:00
Sebastian Dröge
9cf764b2ec element: Enforce that elements created by gst_element_factory_create/make() are floating
Bindings might have a hard time making sure that the reference is indeed
still floating after returning here.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444
2019-09-12 09:50:17 +00:00
Sebastian Dröge
341ee45155 device: Enforce that elements created by gst_device_create_element() are floating
Bindings might have a hard time making sure that the reference is indeed
still floating after returning here.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444
2019-09-12 09:50:17 +00:00
Sebastian Dröge
1edcf747ee device: gst_device_create_element() is transfer floating, not transfer full
Fixing the annotation fixes leaking of the created element in all
bindings using GObject-Introspection.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444
2019-09-12 09:50:17 +00:00
Niels De Graef
4812c4087f 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-09-09 12:16:24 +00:00
Vivia Nikolaidou
7774aae713 pad: Added gst_pad_get_single_internal_link
gst_pad_iterate_internal_links is usually used to find a single internal
link that a pad has, e.g. to find the corresponding pad of a multiqueue.
Added a helper function that will return either a single internal link,
if there's no other, or NULL.
2019-09-05 11:49:18 +03:00
David Svensson Fors
f8d70b475c miniobject: free qdata array when the last qdata is removed
In cases with many long-lived buffers that have qdata only very
briefly, the memory overhead of keeping an array of 16 GstQData
structs for each buffer can be significant. We free the array when
the last qdata is removed, like it was done in 1.14.

Fixes #436
2019-09-04 16:31:53 +02:00
Nicolas Dufresne
80a76a4b4d bin: Fix minor race when adding to a bin
This patch simply add a null check around a case where a child may have
been unparented concurrently to the deep_add_remove operation. This was
found by accident in the form of an "IS_GST_OBJECT" assertion, but had
no other known side effect in that test.
2019-09-03 15:42:17 -04:00
Niels De Graef
9e69c90869 object: Use g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the
`GParamSpec` that corresponds to the given property name. It's not a
huge performance hit, but it's easily avoidable by using the
`_by_pspec()` variant.
2019-08-25 21:32:44 +02:00
Seungha Yang
e6c43380bb info: Take lock around all prinf on Windows
On Windows, concurrent colored gstreamr debug output and usual
stdout/stderr string will cause broken output on terminal.
Since it's OS specific behavior, that's hard to completely avoid it
but we can protect it at least among our printing interfaces side.
2019-08-24 12:15:56 +00:00
Mathieu Duponchelle
7e87a05e5a docstrings: port ulinks to markdown links 2019-08-23 18:17:41 +02:00
Johan Sternerup
a4d5c95638 utils: Avoid memory merge in gst_util_dump_buffer()
For buffers with multiple memory chunks, gst_buffer_map() has the side
effect of merging the memory chunks into one contiguous
chunk. Since gst_util_dump_mem() used gst_buffer_map() the internals
of the buffer could actually change as a result of printing it.

For the case of a buffer containing several memory chunks,
gst_memory_map() is now used to obtain the memory address and each
memory chunk is dumped separately preceded by a header line. The
behaviour for a buffer containing a single memory chunk is left unchanged.
2019-08-21 08:37:50 +02:00
Jan Alexander Steffens (heftig)
1d5a1e8235 element: Added gst_element_get_current_clock_time and gst_element_get_current_running_time
Helper functions for getting the element clock's time, and the clock
time minus base time, respectively.
2019-08-12 12:59:27 +03:00
Sebastian Dröge
533fbf766e registry: Use plugin directory from the build system for relocateable Windows builds
Instead of guessing something based on preprocessor defines and magic.
2019-08-09 07:22:38 +00:00
Thibault Saunier
d6c14e70a1 device-monitor: list hidden providers before listing devices
The way it was implemented could make the list updated after the
list of device was filled with supposdely hidden devices
2019-08-07 15:20:39 -04:00
Tim-Philipp Müller
8841c3a22f message: fix up enum value for GST_MESSAGE_DEVICE_CHANGED
This was added in 1.16 and accidentally duplicated the value of
the existing GST_MESSAGE_REDIRECT.

As the only known user of this message is GStreamer core itself,
and it is quite an obscure message, it seems best to just fix up
the enum value even if that technically breaks API.

Fixes #418
2019-08-06 08:02:09 +00:00
Doug Nazar
7b596ba6c6 info: Fix deadlock in gst_ring_buffer_logger_log
gst_ring_buffer_logger_log calls several functions while formatting
the message which may in turn log a message while we already hold
the mutex. Do all formatting first before acquiring the mutex to
avoid this and reduce the time we hold the mutex.
2019-08-05 15:24:03 +00:00
Sebastian Dröge
55e79c3772 info: Free some more memory on gst_deinit() 2019-07-15 11:35:07 +03:00
Sebastian Dröge
04a7334140 info: Deprecate gst_debug_category_free()
And change it to do nothing at all.

As debug categories don't use reference counting and they can be
retrieved from anywhere at any time by name, it is fundamentally unsafe
to free them at any point in time except for right before the end of the
process.

No code apart from a unit test seems to be currently using the function,
so deprecate it and also change it to do nothing at all.
2019-07-15 11:35:07 +03:00
Jan Schmidt
318a6169f7 gsttracerutils: Fix build with disabled tracer hooks.
Add a stub gst_tracing_get_active_tracers() call when building
with tracer hooks disabled.
2019-07-07 20:42:56 +10:00
Nirbheek Chauhan
e5a3f12ff2 gstinfo: Fix typo in debug log message 2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
1685f38bb2 gsttracer: Add new API to fetch the list of active tracers
This will be useful in the next commit where we add action-signals on
the leaks tracer to get information about leaks and to manipulate
checkpoints as a replacement for the SIGUSR1 and SIGUSR2 signals for
doing the same.
2019-07-02 15:13:26 +05:30
Nicolas Dufresne
8a9b20a18b bufferpool: Fix the buffer size reset code
The offset in gst_buffer_resize() is additive. So to move back the
offset to zero, we need to pass the opposite of the current offset. This
was raised through the related unit test failingon 32bit as on 64bit
the alignment padding was enough to hide the issue. The test was
modified to also fail on 64bit. This patch will remove spurious
assertions like:

  assertion 'bufmax >= bufoffs + offset + size' failed

Fixes #316
2019-07-01 16:49:04 -04:00
Nirbheek Chauhan
aae5f58dd1 tracerrecord: Be stricter while parsing record templates
It's not really possible for us to recover when someone uses the
gst_tracer_record_new() API incorrectly. Also, document a piece of
somewhat-obscure code.
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
f336fdd088 gstsystemclock: Mark the clock as MAY_BE_LEAKED
It is freed in gst_deinit(), but otherwise it is leaked.
2019-07-01 11:51:46 +00:00
Nirbheek Chauhan
4ba6898f24 gstinfo: Rework stack trace detection a bit
Ensure that the code paths for HAVE_UNWIND and HAVE_DBGHELP are never
taken at the same time, even if the build file code changes.

Prefer DbgHelp over libunwind on Windows in case both are somehow
available because DbgHelp is only available when building with the
MSVC toolchain, and libunwind won't give us debug symbols from objects
built with the MSVC toolchain.

Also, print slightly more useful messages for the level of stack trace
support enabled, and document what each if conditional does.
2019-07-01 10:36:09 +00:00
Nirbheek Chauhan
145f8546c4 gstinfo: Add an explicit enum for GST_STACK_TRACE_SHOW_NONE
The code implicitly uses this value when the stack trace is not FULL.
Mostly useful for documenting the behaviour when each flag is passed
and for translating to/from strings.
2019-07-01 10:36:09 +00:00
Nirbheek Chauhan
5f89225bc2 gstplugin: Don't stat plugins when building for UWP
When using GStreamer with Universal Windows Platform apps, dynamic
plugins can only be loaded by filename (without a path) using
gst_plugin_load_file() which will call into g_module_open().

On Windows, GModule calls LoadLibrary() on the filename, but with
UWP we need to use LoadPackagedLibrary() which is basically the same
as LoadLibrary(), except it looks only for DLLs (by name) that have
been packaged as assets with the app.

These assets are not files and cannot be accessed using normal file
APIs such as open() or stat().

The upstream glib merge request for adding LoadPackagedLibrary support
is: https://gitlab.gnome.org/GNOME/glib/merge_requests/951

NOTE: Whitespcae removal is to make gst-indent happy
2019-06-28 13:44:49 +05:30
Nirbheek Chauhan
9b7eaa3ed5 gstconfig.h.in: Windows ARM64 does not allow unaligned access 2019-06-28 13:01:14 +05:30
Mathieu Duponchelle
c34fe82b5b devicemonitor: add debug category 2019-06-21 13:38:58 +00:00
Michael Bunk
4bc68bb3fe Fixing various typos 2019-06-20 15:20:27 +00:00
Havard Graff
0257c7813b gstmeta: Optimize get_tags() by using private quark table 2019-06-17 09:50:32 +02:00
Havard Graff
ce7e6a9406 pad: increase debug-level to warning for fatal outcomes 2019-06-13 16:30:14 +00:00
Niels De Graef
09141c6e1f Use G_DEFINE_AUTOPTR_CLEANUP_FUNC unconditionally
Since we started depending on GLib 2.44, we can be sure this macro is
defined (it will be a no-op on compilers that don't support it). For
plugins we should just start using `G_DECLARE_FINAL_TYPE` which means
we no longer need the macro there, but for most types in core we don't
want to break ABI, which means it's better to just keep it like it is
(and use the `#ifdef` instead).
2019-06-04 08:50:59 +02:00
Mathieu Duponchelle
bcb4be455e gstelement: fix links to the gsterror page 2019-05-31 01:56:08 +02:00
Mathieu Duponchelle
cce397cc50 gsttaglist: do not link to symbols from gst-plugins-base in doc 2019-05-31 01:45:41 +02:00
Mathieu Duponchelle
ca17a6c791 doc: remove xml from comments 2019-05-29 21:33:42 +02:00
Thibault Saunier
e31f06f7f9 registry: Avoid discovering plugins in hotdoc private directories 2019-05-16 18:22:20 +00:00
Edward Hervey
7aee718394 gstpad: Probes that return HANDLED can reset the data info field
Before GST_PAD_PROBE_HANDLED was introduced, we had to handle the case
where some probes would reset the probe info data field to NULL. This would
be considered an invalid use-case.

But with GST_PAD_PROBE_HANDLED it is totally fine to reset that, since
the probe has "handled" it.
2019-05-16 15:13:48 +02:00
Thibault Saunier
949fba4b1f doc: Fix hotdoc warnings
* Making sure that `static inline` function are in the GIR (by first
  defining them, and make sure to mark as skiped)
* Do not try to link to unexisting symbols
* Also generate GIR information about gst_tracers
2019-05-13 16:34:09 -04:00
Thibault Saunier
a0c65067e0 Port to hotdoc 2019-05-13 16:34:09 -04:00
Thibault Saunier
3d5dbfb457 gst: Add a GParamSpecFlag to force gst-inspect to use pspec default value
Instead of the object value, this should be used every time a random
value will be returned by g_object_get This is also useful to make the
values returned by inspecting element stable accross runs.
2019-05-13 11:33:49 -04:00
Thibault Saunier
4e29b4aa34 doc: Add some missing docstrings 2019-05-13 11:33:49 -04:00
Thibault Saunier
5b2da0835e doc: Fix and add some missing docstrings 2019-05-13 11:33:49 -04:00
Thibault Saunier
4d259e8af3 structure: Mark _from_string as constructor 2019-05-13 11:33:49 -04:00
Nirbheek Chauhan
ebd918c0f6 meson: Pass -DGST_STATIC_COMPILATION for static builds
This is only needed on Windows when building with MSVC, but it is safe
to pass it everywhere.

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/398
2019-05-13 14:42:28 +05:30
Nirbheek Chauhan
b19de413b9 meson: Link to objects instea of static helper library
Otherwise the objects from that static helper library are not included
in the gstreamer-1.0 static library. This was supposed to be fixed in
Meson, but the pull request hasn't been merged yet:
https://github.com/mesonbuild/meson/pull/3939

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/398
2019-05-13 13:24:42 +05:30
Niels De Graef
8d180557eb uri: Add gst_clear_uri()
Basically, you can use this instead of using `gst_uri_unref()` (which
needs to be preceded by a NULL-check).

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/275
and https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/3
2019-05-10 14:59:23 +02:00
Niels De Graef
cfca53ce67 gst: Add support for g_autoptr(GstPromise) 2019-05-08 12:11:50 +02:00