Commit graph

2413 commits

Author SHA1 Message Date
Mathieu Duponchelle
2a710a484c concat: adjust running time offsets on events
When concat adjusts the base of the segments it forwards
downstream, it needs to also adjust the running time offsets,
as GstPad does when an offset is set by the application on a pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/819>
2021-05-14 12:53:20 +00:00
Mathieu Duponchelle
d7272b3247 concat: fix locking in SEGMENT event handler
concat->current_start_offset needs the lock taken for safe access,
as it can be accessed from outside of the streaming thread, eg
in release_pad.

An early break is also added for an error case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/818>
2021-05-11 19:13:08 +00:00
Doug Nazar
24f0370c2d sparsefile: Fix sparsefile on Win32
When switching between read/write a fseek() or fflush() is required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/814>
2021-05-06 23:04:27 -04:00
Doug Nazar
c71805c565 downloadbuffer: close file before trying to remove
On Windows, the file handles must be closed before you can delete a file.
Also, it would cause an error if you try to close an already closed handle.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/814>
2021-05-06 23:04:27 -04:00
Doug Nazar
135f517ea3 downloadbuffer: return flow error on read error
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/814>
2021-05-06 23:04:27 -04:00
Jan Alexander Steffens (heftig)
4ad1c8b7c9 multiqueue: Ensure peer pad exists when iterating internal links
The pads can be NULL when we're racing with pad removal, e.g. when the
pads get removed between `gst_pad_iterate_internal_links` acquiring the
parent element and `gst_multi_queue_iterate_internal_links` locking the
multiqueue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/810>
2021-05-06 13:08:26 +02:00
Edward Hervey
4eef67cc7e queue2: Refuse all serialized queries when posting buffering messages
When posting buffering messages there are no safe places or timing to avoid
deadlocks.

Previously the code was trying to be "smart" by only forwarding serialized
queries if the queue was empty ... but that could happen when queue2 hadn't yet
posted a 100% buffering message. Meaning the pipeline might be paused and
pushing a serialized query downstream might never complete.

Therefore let's completely disable forwarding of serialized queries when
`queue2` is used as a buffering element (meaning `ALLOCATION` and `DRAIN`
queries).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/796>
2021-04-16 11:41:26 +02:00
Doug Nazar
d323942999 leaks: Fix SIGSEGV detecting object type.
G_IS_OBJECT & GST_IS_OBJECT work by following pointers which is unsafe
on certain architectures. GstMiniObject detection however does a lookup
to see if it's a valid type derived from G_TYPE_BOXED.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/791>
2021-04-12 05:18:25 -04:00
Doug Nazar
f52937d1ff clocksync: Fix providing system clock by default
clocksync defaults to sync=true so should advertise it by default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/786>
2021-04-08 07:27:07 +00:00
Matthew Waters
3d887c7f07 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/775>
2021-03-19 04:15:19 +00:00
Seungha Yang
69e6cd773a clocksync: Add a new property "sync-to-first" for automatic ts-offset setup
Add a new property so that clocksync can setup "ts-offset" value
based on the first buffer and pipeline's running time when the
first arrived. Newly update "ts-offset" in this case would be
a value that allows outputting the first buffer without clock waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/702>
2021-03-18 14:22:44 +00:00
Seungha Yang
4a2d1d9c78 filesrc/filesink: Use g_open/g_fopen and g_close instead of ours
There should be no more cross-CRT issue on Windows since we bumped
MinGW toolchain

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/744>
2021-02-02 19:17:49 +09:00
Philippe Normand
e02902a783 concat: Fix active-pad property doc typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/727>
2021-01-07 11:57:51 +00:00
Stéphane Cerveau
783e19b04c coreelements: allow per features registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661>
2020-12-10 12:45:16 +01:00
Jonathan Matthew
12bc728805 typefind: copy seqnum to new segment event
Fixes: #635
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/700>
2020-11-10 21:39:13 +10: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
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
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
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
5bab6154aa input-selector: Wake up blocking pads when releasing them
Otherwise deactivating them will cause a deadlock as they're blocking
inside the streaming thread.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/606>
2020-09-09 06:53:00 +00:00
Sebastian Dröge
00fd649640 valve: Add modes to forward sticky events when dropping and to convert buffers into gap events
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/587
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/84

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/594>
2020-09-09 06:16:51 +00:00
Tim-Philipp Müller
e4f7cdb0df tracer: declare GstTracer API stable
It's been around for more than 4 years and people have built
lots of stuff on top of it, doesn't really make sense to keep
it marked as unstable. We're unlikely to change it now, and
we can always deprecate it and make a new one if needed.

This stabilises the following API:
- gst_tracer_register()
- gst_tracing_get_active_tracers()
- gst_tracing_register_hook()
- gst_tracer_record_new()
- gst_tracer_record_log()

Might also help a bit with #424

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/576>
2020-07-24 13:33:50 +01:00
Matthew Waters
056cad44c3 build/coretracers: add dep on threads
Fixes the following build error and missing '-pthread' argument when
linking:

subprojects/gstreamer/plugins/tracers/libgstcoretracers.so.p/gstleaks.c.o: In function `gst_leaks_tracer_setup_signals':
/work/build32/../subprojects/gstreamer/plugins/tracers/gstleaks.c:919: undefined reference to `pthread_atfork'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/571>
2020-07-20 17:09:32 +10:00
Nicolas Dufresne
f11e9b3aa0 latency tracer: Fix leaks in the reported latency trace
The stack item was not freed as it was supposed, causing leaks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/269>
2020-07-15 16:28:34 -04:00
Jan Schmidt
e07bb52bf7 latency tracer: Fix unsafe and NULL pointer accesses
Use thread-safe accesses to pad peers and parent objects. This
fixes some crashers and all the non-safe access patterns I could
spot. There's still some weirdness when using the latency
tracer on pipeline chains that aren't yet linked, but this
at least stops it segfaulting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/269>
2020-07-15 16:28:32 -04:00
Thibault Saunier
9d195da36c inputselector: Push event on selected pad only when one is selected
Calling `gst_input_selector_get_active_sinkpad` triggers sinkpad
selection but won't notify about it, leading  to breaking code that
relying on it. This new code added as part of
63ccf45395 was thought to be triggered only
when a pad was already selected and not change the behavior otherwise
so this commit makes sure it is actually the case.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/766

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/522>
2020-06-15 17:33:22 +00:00
Matthew Waters
15761c93c2 tracers/leaks: fix reentrancy issues with the custom signal handlers
The signal handlers were performing mutex operations in the signal handlers
which is bad idea that may lead to deadlocks.

1. Implement a separate signal thread to handle the signals.
2. Use the glib provided signal GSource to avoid performing operations in
   the signal handler.

Fix #186

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/487>
2020-06-09 12:36:18 +00:00
Camilo Celis Guzman
3ac3a01298 queue: protect against lost wakeups for iterm_del condition
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/513>
2020-06-06 17:41:20 +00:00
Mathieu Duponchelle
0c1ce6e8c4 utils: expose GstPluginAPIFlags
These can be passed to gst_type_mark_as_plugin_api, to inform
plugin cache generation.

For now a single flag is specified, "IGNORE_ENUM_MEMBERS", it
can be used for dynamically generated enums to avoid documenting
environment-specific enumeration members. An example is
GstX265EncTune.
2020-06-06 00:38:29 +02:00
Mathieu Duponchelle
d46e902273 identity, clocksync: implement provide_clock
Since those are using the clock for sync, they need to also
provide a clock for good measure. The reason is that even if
downstream elements provide a clock, we don't want to have
that clock selected because it might not be running yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/509>
2020-06-05 11:28:12 +00:00
Jan Schmidt
8e670a23b0 queue2: Defer downstream bitrate query to the streaming thread.
When we want to perform a downstream bitrate query, just
set the reconfigure flag on the srcpad and get the streaming
thread to do it. That avoids emitting a downstream query
when receiving the upstream RECONFIGURE event - which can
lead to deadlocks if downstream is sending the event from
within a lock - e.g. input-selector.

If querying the downstream bitrate changes the cached
value, then make sure to update our buffering state
and potentially post a BUFFERING message to the application.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/566
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/501>
2020-06-05 10:29:19 +00:00
Edward Hervey
f2478618b5 inputselector: Avoid deadlock when requesting pads
The deadlock was the following:
* One thread requests a new pad, the internal lock is kept while adding the pad
* Another thread (or the same one) requests the internal links of a pad (could
be that pad)... which also requires that lock.

That internal lock is not required when adding the pad to the element (which is
the last action when requesting a new pad). The fact it will be actually used
will be *after* the request pad function is released.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/512>
2020-06-05 09:59:15 +00:00
Sebastian Dröge
5bdbde32da plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 15:49:24 -04:00
Edward Hervey
08d2d3cfd7 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/511>
2020-06-04 11:24:39 +02:00
Mathieu Duponchelle
07fcd4d1b5 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-05-27 13:07:03 +00:00
Carlos Rafael Giani
6d4ad80b82 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-05-27 13:07:03 +00:00
dhilshad
319f81bc60 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-05-25 08:35:32 +00:00
Mathieu Duponchelle
742291c799 fdsink: do not supress legitimate errors when unlocking
Instead, only wait_preroll when writev_* returns FLUSHING

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/476>
2020-05-20 14:10:14 +00:00
Mathieu Duponchelle
2812064734 fdsink: remove unused struct member bytes_written
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/476>
2020-05-20 14:10:14 +00:00
Mathieu Duponchelle
710ce84d0c filesink: port over unlock code from fdsink
See also: 5216322d39

The previous code was causing "random" flushing returns
in scenarios with intensive state changes such as within
a buffering pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/476>
2020-05-20 14:10:14 +00:00
Thibault Saunier
24d789a9b5 input-selector: Ensure events are forwarded only once per pad
The code was prepared to do it but was missing to fill the pushed_pads
list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/485>
2020-05-15 13:51:43 +00:00
Thibault Saunier
63ccf45395 inputselector: Ensure that events are pushed first on active pad
Making it less random and fixing a race in a GES test where we have
as pipeline:

```
videotestsrc ! output-selector name=s ! input-selector name=i s. ! timecodestamper ! i.
```

which we seek, leading to the seek reaching the video testsrc
without going through the timecodestamper and generating a buffer
even before timecodestamper gets the seek which means that its internal
state is wrong compared to the datastream it gets and attaches wrong
timecode metas.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/485>
2020-05-15 13:51:43 +00:00
Thibault Saunier
9f2e9ccd7e inputselector: Never reset active pad set from the user
This was leading to interesting races in a GES test.
Related to: https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/issues/108

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/481>
2020-05-14 22:15:12 +00:00
Thibault Saunier
f41f84538a output-selector: Drop duplicated seek events
When we get a seek event on several source pads, we should drop
the duplicated ones as any element that has several srcpads (like
demuxers).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/478>
2020-05-13 17:59:06 -04:00
Thibault Saunier
cb212c9fd7 identity: Handle seeking with single_segment=True
Identity was ignoring seek and flush events even when using
a single segment. In the end it means that we couldn't compute
buffers running-time and stream time after seeks.

This commits adds support for flushing seeks only as I have no idea
what to do for non flushing ones.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/450>
2020-05-06 14:24:36 +00:00
Thibault Saunier
b517b59171 identity,clocksync: Fix timestamping inside single segment in reverse playback
In reverse playback, buffers are played back from buffer.stop
(buffer.pts + buffer.duration) to buffer.pts running times which
mean that we need to use the buffer end running time as a buffer
timestsamp, not the buffer pts when using a single segment in reverse
playback.

This is now being tested in
`validate.test.identity.reverse_single_segment`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/450>
2020-05-06 14:24:36 +00:00
Edward Hervey
d854fb12e9 queue2: Use explicit limit checking
When we know we'll only be checking the real limits, use a clearer/simpler
macro.

CID #1037148

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/464>
2020-05-06 08:04:28 +02:00