Commit graph

18592 commits

Author SHA1 Message Date
Mathieu Duponchelle
1baa2ba9f0 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/647>
2020-09-24 19:13:13 +00:00
Mathieu Duponchelle
eed0e22020 aggregator: fix iteration direction in skip_buffers
Subclasses use the pad segment to determine whether a buffer
should be skipped, we thus don't want to check if a buffer
needs to be skipped before processing the segment it's part
of.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/646>
2020-09-24 18:30:43 +00:00
Tim-Philipp Müller
e9e2069de5 buffer: improve seqnum fallback warning message
Print target CPU we're building for.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/645>
2020-09-24 17:50:01 +00:00
Tim-Philipp Müller
0a6f93df2d 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/645>
2020-09-24 17:50:01 +00:00
Christoph Reiter
bc566d2859 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/643>
2020-09-24 16:28:54 +00:00
Sebastian Dröge
d0eb870c14 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/642>
2020-09-24 16:40:53 +01:00
Edward Hervey
c33f859aa0 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/634>
2020-09-21 15:46:39 +00:00
Camilo Celis Guzman
d04b27f4ec queue: protect against lost wakeups for iterm_del condition
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/633>
2020-09-21 11:16:50 +00:00
Nirbheek Chauhan
80c753c4a9 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/636>
2020-09-21 10:18:59 +00:00
Nirbheek Chauhan
f83bf11d75 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/636>
2020-09-21 10:18:59 +00:00
Seungha Yang
6b8bb822e4 gst-inspect: Use gst_info_strdup_vprintf to print string
g_vprintf() will write a string binary to stdout directly using fwrite().
So, depending on character in the string, fwrite to stdout can
print broken one but printf family might not cause the issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/637>
2020-09-21 00:34:39 +01:00
Edward Hervey
b935ac6642 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/632>
2020-09-20 11:49:18 +01:00
Mathieu Duponchelle
fa8ea66418 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-09-20 01:12:15 +01:00
Carlos Rafael Giani
f66959c275 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-09-20 01:12:14 +01:00
dhilshad
5f7e3392a9 sparsefile: fix possible crash when seeking
In gst_sparse_file_clear function we were closing a file and
reopening it using closed file descriptor.

Fix: Removed closing and reopening of file.

Fixes #512

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/372>
2020-06-07 11:36:32 +01:00
Thibault Saunier
c666a9a7e1 value: Fix segfault comparing empty GValueArrays
Adding a test
2020-06-07 01:41:52 +01:00
Jan Schmidt
177d0fa1c2 baseparse: Fix upstream read caching
When running in pull mode (for e.g. mp3 reading),
baseparse currently reads 64KB from upstream, then mp3parse
consumes typically around 417/418 bytes of it. Then
on the next loop, it will read a full fresh 64KB again,
which is a big waste.

Fix the read loop to use the available cache buffer first
before going for more data, until the cache drops to < 1KB.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/518
2020-06-07 00:47:41 +01:00
Jan Schmidt
0f91868ef0 baseparse: Fix typo 2020-06-07 00:47:41 +01:00
Ondřej Hruška
7b0e6f3e62 gstdatetime: Add missing NULL check to gst_date_time_new_local_time
Also add a unit test for this.

Fixes #524
2020-06-04 22:59:10 +00:00
Miguel Paris
687c0f0ce7 bufferlist: foreach: always remove as parent if buffer is changed
In case the buffer is not writable, the parent (the BufferList) is not
removed before calling func. So if it is changed, the parent (the BufferList)
of the previous buffer should be removed after calling func.
2020-06-04 21:49:02 +00:00
Stéphane Cerveau
e3afb0ea8e identity: Fix a minor leak using meta_str 2020-03-14 00:21:01 +00:00
Matthew Waters
d1c887bc77 basetransform: allow not passthrough if generate_output is implemented
This allows an element to not require implementing transform or
transform_ip.
2020-03-13 14:37:58 +00:00
Seungha Yang
c2a7875aa1 gst-launch: Follow up to missing s/g_print/gst_print/g
Required to avoid broken log string on Windows but missed
in the commit of 493a3261a9
2020-03-13 12:37:36 +00:00
Seungha Yang
87f70650be gst-inspect: Add define guard for g_log_writer_supports_color()
g_log_writer_supports_color() was introduced since GLib 2.50.0
which is slightly higher version than our minimum required GLib version.
2020-02-26 15:27:46 +00:00
Matus Gajdos
ba43993f24 baseparse: fix memory leak
A buffer to be skipped wasn't unref'd in gst_base_parse_chain().

Fixes #406
2020-02-15 19:16:42 +00:00
Zebediah Figura
b52c8fc2b2 baseparse: Set the private duration before posting a duration-changed message
Otherwise an application cannot rely on a subsequent call to e.g. gst_pad_query_duration() succeeding.
2020-02-15 00:14:10 +00:00
Sebastian Dröge
a1c0ca3ac0 bus: Make setting/replacing/clearing the sync handler thread-safe
Previously we would use the object lock only for storing the sync
handler and its user_data in a local variable, then unlock it and only
then call the sync handler. Between unlocking and calling the sync
handler it might be unset and the user_data be freed, causing it to be
called with a freed pointer.

To prevent this add a refcounting wrapper struct around the sync
handler, hold the object lock while retrieving it and increasing the
reference count and only actually free it once the reference count
reaches zero.

As a side-effect we can now also allow to actually replace the sync
handler. Previously it was only allowed to clear it after initially
setting it according to the docs, but the code still allowed to clear it
and then set a different one.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/506
2020-02-14 18:51:35 +00:00
Thibault Saunier
cdf7d802db 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
2020-02-05 09:08:31 +00:00
Jan Alexander Steffens (heftig)
63f0b31dbf bin: Fix deep-element-removed log message
child and bin were switched.

https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/354
2020-01-09 20:20:47 +00:00
Mathieu Duponchelle
5c47fe6118 Revert "element: Enforce that elements created by gst_element_factory_create/make() are floating"
See https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/333

The reference we receive when calling g_object_new should be
floating, but we can't force it at our level.

This reverts commit ce43de8690.
2019-12-05 10:45:49 +01:00
Mathieu Duponchelle
3c21d6a29f Revert "device: Enforce that elements created by gst_device_create_element() are floating"
See https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/333

The reference we receive when calling g_object_new should be
floating, but we can't force it at our level.

This reverts commit cc6342d853.
2019-12-05 10:45:10 +01:00
Tim-Philipp Müller
1294936877 Release 1.16.2 2019-12-03 10:57:31 +00:00
Tim-Philipp Müller
326dbc56a1 Update docs 2019-12-03 10:57:30 +00:00
Tim-Philipp Müller
41c82ae9be Update translations 2019-12-03 10:57:29 +00:00
Tim-Philipp Müller
7105428470 Revert "gst/parse: define pure-parser depending on bison version"
This reverts commit 77141834bb.

This breaks the autotools build and it seems too much effort to
fix that up just to fix a bison warning.
2019-12-03 10:40:44 +00:00
Edward Hervey
ebd0d664d4 tracers: Don't leak temporary GstStructure
CID: 1455462
2019-11-28 10:53:00 +00:00
Víctor Manuel Jáquez Leal
77141834bb gst/parse: define pure-parser depending on bison version
After release bison 2.5 the declaration %pure-parser was deprecated
in favor of %define api.pure

Nonetheless, until bison 3.4, the declaration was treated as backward
compatibility, but now bison shows a warning:

  warning: deprecated directive, use ‘%define api.pure’

The patch's approach is to handle both directives according with the
used bison's version, by string replacement at source configuration
stage.
2019-11-05 15:25:23 +00:00
Sebastian Dröge
44623cacd6 tee: First deactivate the pad and then remove it when releasing pads
This reverts a96002bb28, which is not
necessary anymore. If we release the pad after removing it then none of
the deactivation code will actually be called because the pad has no
parent anymore, and we require a parent on the pad for deactivation to
happen.

This can then, among other things, cause a streaming thread to be still
stuck in a pad probe because the pad was never flushed, and waiting
there forever because now the pad will actually never be flushed anymore.
2019-10-26 20:56:19 +01:00
Sebastian Dröge
dac5966da6 tee: Check for the removed pad flag also in the slow pushing path
If a pad is currently being released we don't want to forward the
FLUSHING flow return but instead consider it as NOT_LINKED. FLUSHING
would also cause upstream to be FLUSHING.

This part was missed in a3c4a3201a and
resulted in a different (and wrong) workaround in
a96002bb28.
2019-10-26 20:56:19 +01:00
Sebastian Dröge
94c765a173 tee: Lock mutex before reading the removed flag of the pads
Otherwise we're not guaranteed to read the very latest value that
another thread might've written in there when the pad was released, and
could instead work with an old value.
2019-10-26 20:56:19 +01:00
Sebastian Dröge
e6f55805b4 bin: Drop need-context messages without source instead of crashing 2019-10-24 12:58:54 +01:00
Sebastian Dröge
0c6f5b3e4c gst: Don't pass miniobjects to GST_DEBUG_OBJECT() and similar macros
The argument must be at least a GObject according to the GstLogFunction
definition, and while the default C log function handles miniobjects
just fine this is crashing bindings and user-supplied log functions that
(rightfully) don't expect anything but GObjects.
2019-10-01 13:45:31 +00:00
Seungha Yang
3ffd1e4f1d gst-launch: Use gst_print* instead of g_print* to fix broken stdout on Windows
Concurrent Windows' colored debug message and g_print will print
string hard to read. Instead, use gst_print* which serialize
debug output and the APIs call.
2019-10-01 12:40:32 +01:00
Seungha Yang
32b7108d54 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-10-01 12:40:32 +01:00
Tim-Philipp Müller
de0a7c4bc8 Release 1.16.1 2019-09-23 11:01:52 +01:00
Tim-Philipp Müller
60ce375e9c Update docs 2019-09-23 11:01:50 +01:00
Tim-Philipp Müller
e77fa2581d Update translations 2019-09-23 11:01:47 +01:00
Sebastian Dröge
ce43de8690 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-15 00:26:54 +01:00
Sebastian Dröge
cc6342d853 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-15 00:26:54 +01:00
Sebastian Dröge
937a6ca6d3 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-15 00:26:54 +01:00