Commit graph

18605 commits

Author SHA1 Message Date
Matthew Waters 0cc42f9dc6 element: NULL the lists of contexts in dispose()
If dispose() is called more than once, we may double unref the list of
GstContext's.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/877>
2021-08-27 14:08:08 +01:00
Jan Schmidt 867bfb840e baseparse: Don't return more data than asked for in pull_range()
Even when pulling a new 64KB buffer from upstream, don't return
more data than was asked for in the pull_range() method and then
return less later, as that confused subclasses like h264parse.

Add a unit test that when a subclass asks for more data, it always
receives a larger buffer on the next iteration, never less.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/733>
2021-01-13 11:25:58 +00:00
Tim-Philipp Müller 570736df65 Release 1.16.3 2020-10-21 14:41:25 +01:00
Tim-Philipp Müller 0922975a02 Update docs 2020-10-21 14:41:22 +01:00
Tim-Philipp Müller 155a4b6da8 Update translations 2020-10-21 14:41:20 +01:00
Tim-Philipp Müller c899387b54 Automatic update of common submodule
From 59cb678 to a825d27
2020-10-20 15:09:52 +01:00
Mathieu Duponchelle e846ef2221 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/674>
2020-10-14 00:59:03 +01:00
Matthew Waters fa2f853013 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/671>
2020-10-12 13:47:28 +01:00
Mathieu Duponchelle 90e9bf1457 gst-launch: go back down to GST_STATE_NULL in one step.
Going through each state on the way back down to GST_STATE_NULL
can cause deadlocks, for example:

gst-launch-1.0 audiotestsrc ! valve drop=true ! autoaudiosink

ctrl + C

Hangs forever when going to PAUSED, because the "final" state is
ASYNC, and the sink blocks waiting for a preroll buffer.

Going straight to NULL addresses this issue, and also helps
making teardown faster when piping sparse streams to a
sync sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/519>
2020-09-26 11:50:24 +00:00
Roman Shpuntov cc13705855 systemclock: Fix clock time conversion on Windows/xbox
The returned ratio can be bigger than GST_SECOND, in which case we would
forever return 0 for the system clock time. Even in other cases if it's
close to GST_SECOND it would result in accuracy loss.

Instead of doing the division by GST_CLOCK_TIME_NONE during
initialization once, do it every time the clock time is requested.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/635>
2020-09-25 01:35:16 +00:00
Sebastian Dröge 90077c2f1d identity: Use g_cond_signal() instead of g_cond_broadcast()
There can only be a single waiter: on the streaming thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/397>
2020-09-25 00:33:43 +00:00
Sebastian Dröge 27e766137c identity: Unblock condition variable on FLUSH_START
... and immediately return FLUSHING from the streaming thread instead of
waiting potentially forever.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/516

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/397>
2020-09-25 00:33:43 +00:00
Seungha Yang 95c8d8e4b5 check: Use g_thread_yield instead of g_usleep(1)
Since the commit
01c02ac08b,
g_usleep(1) will be translated to Sleep(1) on Windows which means
sleep in 1 millisecond. But GLib provides g_thread_yield() API
which is exactly what we required here for thread context switching.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/644>
2020-09-24 22:28:12 +00:00
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