Commit graph

18582 commits

Author SHA1 Message Date
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
Jim Mason
abeb5e677f consolidated IOV_MAX/UIO_MAXIOV handling per GLib + legacy behaviour for osx/ios 2019-09-08 20:57:25 +00:00
Jim Mason
c2d10bd6c4 gst_writev: respect IOV_MAX for the writev iovec array #439 2019-09-08 20:57:25 +00:00
David Svensson Fors
e6bd5b4193 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-08 19:42:59 +00:00
Nicolas Dufresne
94ba1cea88 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 22:27:38 +01:00
Tim-Philipp Müller
090a928329 meson: fix warning about configure_file() install kwarg
The install kwarg on configure_file() was only added in
Meson 0.50 but we're targetting older versions as well,
which caused a warning. The install kwarg is not needed
here as we specify install_dir, so we can just drop it.

Fixes #379
2019-08-15 14:16:51 +01:00
Sebastian Dröge
549cc941eb aggregator: Actually handle NEED_DATA return from update_src_caps()
The documentation says that this allows the subclass to signal that it
needs more data before it can decide on caps, so let's actually
implement it that way.
2019-08-14 14:49:53 +01:00
Sebastian Dröge
5bf13cdd53 aggregator: Assert if the sink/src pad type that is to be used is not a GstAggregatorPad or subclass thereof 2019-08-14 13:35:31 +01:00
Sebastian Dröge
8f3fa68504 aggregator: Ensure that the source pad is created as a GstAggregatorPad if no type is given in the pad template
Otherwise we would create a GstPad and that causes invalid memory
accesses later.
2019-08-14 13:35:31 +01:00
Guillaume Desmottes
a9bc30b51c latency: fix custom event leaks
If the element before the sink needs $n buffers to produce one output
buffer, we were reffing $n events and unreffing only one.
Prevent this by using g_object_set_qdata_full() to handle the event
unreffing so we're sure no ref will be lost.
2019-08-14 08:51:06 +05:30
Guillaume Desmottes
de9ff83533 tracers: set MAY_BE_LEAKED on tracer records
The records are static and so appear as false positives when using those
tracers with the leaks tracer as well.
The leaks tracer was already setting this flag on its record so let's
set it on the other ones as well.
2019-08-14 08:51:02 +05:30