Commit graph

2398 commits

Author SHA1 Message Date
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
Sebastian Dröge
687c65994e clocksync: Remove handoff signals
They're not really useful on this element and were just a leftover from
identity.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/443>
2020-05-04 09:21:02 +03:00
Mathieu Duponchelle
d2299180c9 multiqueue: fix link-like syntax in doc 2020-04-28 00:33:22 +02:00
dhilshad
c8bcb9db18 downloadbuffer:fix pushing buffer before stream start event
downloadbuffer source pad pushes the first buffer before pushing
Stream Start and Segment event, when working in Push mode.

Fix:Pushing Stream Start and Segment after coming out of
wait for data, and before pushing the buffer to next element.

Fixes #534
2020-04-17 15:16:18 +00:00
Vivia Nikolaidou
4679c2ed6f multiqueue: Add current-level-{buffers, bytes, time} pad properties
To get the current buffers/bytes/time levels of the corresponding
internal queue
2020-04-09 18:03:35 +03:00
Vivia Nikolaidou
74938f07c2 multiqueue: Add stats property
The returned "stats" structure contains, for now, one array called
"queues" with one GstStructure per internal queue, containing said
queue's current level of bytes, buffers, and time.
2020-04-09 17:57:43 +03:00
Vivia Nikolaidou
cbdc259865 downloadbuffer, multiqueue, queue2: Fix watermark docs
It is not explicitly specified anywhere in the docs that 0% buffering is
at low-watermark and 100% buffering is at high-watermark. It was
specified only in the sources.
2020-04-06 18:19:06 +03:00
Seungha Yang
13bee5ae0c filesink: Fix for updating the index of memory to write in the next iteration
current_buf_mem_idx stands for the index of memory of the corresponding
buffer which is scheduled to be written in the next iteration.
If all memory objects were scheduled to be written in the current
iteration, reset the index to zero so that starting from the first
memory object of the next buffer.
2020-03-31 19:05:30 +09:00
Seungha Yang
5c74c8c4f8 filesink: Fix crash caused by zero-size memory allocation
If size of vector is greater than one, we are allocating zero-size
memory and trying invalid memcpy operation
2020-03-28 16:20:51 +09:00
Sebastian Dröge
dcb2be3282 filesink: Add a new full buffer mode to filesink
Previously the default and full modes were the same. Now the default
mode is like before: it accumulates all buffers in a buffer list until
the threshold is reached and then writes them all out, potentially in
multiple writes.

The new full mode works by always copying memory to a single memory area
and writing everything out with a single write once the threshold is
reached.
2020-03-26 11:31:03 +00:00
Sebastian Dröge
93ffec7b2e filesink/fdsink: Write 1 iovec directly without copying if there's no writev() support 2020-03-26 11:31:03 +00:00
Sebastian Dröge
c15f1b2bec fdsink/filesink: Refactor writev() code to prevent stack overflows
If buffer lists with too many buffers would be written before, a stack
overflow would happen because of memory linear with the number of
GstMemory would be allocated on the stack. This could happen for example
when filesink is configured with a very big buffer size.

Instead now move the buffer and buffer list writing into the helper
functions and at most write IOV_MAX memories at once. Anything bigger
than that wouldn't be passed to writev() anyway and written differently
in the previous code, so this also potentially speeds up writing for
these cases.

For example the following pipeline would crash with a stackoverflow:
gst-launch-1.0 audiotestsrc ! filesink buffer-size=1073741824 location=/dev/null
2020-03-26 11:31:03 +00:00
Stéphane Cerveau
0b1c2f715a identity: Fix a minor leak using meta_str 2020-03-13 12:14:08 +01:00
Sebastian Dröge
8fb1fe4620 clocksync: Use g_cond_signal() instead of g_cond_broadcast()
There can only be a single waiter: on the streaming thread.
2020-03-09 21:32:28 +02:00
Sebastian Dröge
be8a15b0f9 identity: Use g_cond_signal() instead of g_cond_broadcast()
There can only be a single waiter: on the streaming thread.
2020-03-09 21:31:48 +02:00
Sebastian Dröge
c7ddc5eb79 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
2020-03-09 20:27:58 +02:00