Commit graph

2321 commits

Author SHA1 Message Date
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
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
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
Stéphane Cerveau e3afb0ea8e identity: Fix a minor leak using meta_str 2020-03-14 00:21:01 +00:00
Edward Hervey ebd0d664d4 tracers: Don't leak temporary GstStructure
CID: 1455462
2019-11-28 10:53:00 +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
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
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
Guillaume Desmottes 3e04aa2afc latency: display event pointer in logs
This is quite useful for debugging when tracer is reporting the wrong
latency because of an element breaking the events/buffers ordering.
2019-08-14 08:50:42 +05:30
Alicia Boya García 5dbaaa1e51 downloadbuffer: Check for flush after seek
In gst_download_buffer_wait_for_data(), when a seek is made with
perform_seek_to_offset() the `qlock` is released temporarily. Therefore,
the flushing condition can be set during this period and should be
checked.

This was not being checked before, causing occasional deadlocks when
GST_DOWNLOAD_BUFFER_WAIT_ADD_CHECK() was called.

GST_DOWNLOAD_BUFFER_WAIT_ADD_CHECK() assumes that the caller has already
checked that we're not flushing before, since this is done when
acquiring the lock; so if we release it temporarily somewhere, we need
to check for flush again.

Without that check, the function would keep waiting for the condition
variable to be notified before checking for flushing condition again,
and that may very well never happen. This was reproduced when during pad
deactivation when running WebKit in gdb.
2019-08-11 12:37:45 +01:00
Nicolas Dufresne 819b316e03 identity: Non-live upstream have no max latency
sync=TRUE implementation changes the latency query of a non-live
upstream into live, though it wrongly set the upstream max latency to 0.
As non-live sources won't loose data if we wait longer, this should have
been reported as have no max latency limite (-1).
2019-08-08 23:27:10 +01:00
Philippe Normand 66e1ee5137 identity: Fix the ts-offset property getter
Previous code was a copy/paste from the property setter function.
2019-08-08 22:15:43 +01:00
Guillaume Desmottes 84707d088f gstelements_private: sync gst_buffer_get_flags_string() with new flags 2019-08-08 16:57:56 +01:00
Thibault Saunier a5d22be74b multiqueue: never unref queries we do not own
The `query` argument of gst_pad_query is "transfer none".

Query objects are "borrowed" by the pad query handlers and those
should never unref them.

This was leading to double freed queries in a very racy way with nested
GESTimelines.
2019-08-08 14:58:52 +01:00
Sebastian Dröge 80c5dacfb3 concat: Reset last_stop on FLUSH_STOP too
Otherwise when seeking backwards we would keep the last_stop at the last
position we saw until playback passed the seek position again, and if
switching to the next pad happens in the meantime we would set the wrong
offset in the outgoing segment.
2019-08-08 13:12:19 +01:00
Sebastian Dröge 9d27e5d70d concat: Improve debug output a bit 2019-08-08 13:12:19 +01:00
Julian Bouzas 35788c8563 tracer: latency: Don't compare element name as element Id is already unique 2019-04-15 11:29:32 +00:00
Julian Bouzas e128c7310c tracer: latency: Remove redundant if conditions 2019-04-15 11:29:32 +00:00
Julian Bouzas 780bf26e43 tracer: latency: Make GST_DEBUG logs consistent 2019-04-15 11:29:32 +00:00
Julian Bouzas a376bab21d tracer: latency: Fix bug when dropping sub-latency probe event
Fixes #373
2019-04-15 11:29:32 +00:00
Julian Bouzas d908dee9e9 tracer: latency: Fix typo bug 2019-04-10 09:17:01 -04:00
Julian Bouzas 308f505110 tracer: latency: Fix bug when storing latency probe event
The pad name sotred in the latency event has no longer the name of the element,
so we have to get the element Id, element name and pad name values from the data
structure and compare all 3 values.
2019-04-10 09:16:03 -04:00
Julian Bouzas 1ec8114717 tracer: latency: Show element id, element name and pad name 2019-04-09 08:50:16 -04:00
Julian Bouzas 0f0403e5d9 tracer: latency: Show per-element reported latency 2019-04-08 12:28:07 -04:00
Julian Bouzas e975d5d1c4 tracer: latency: Show element's source pad name instead of element's name
The full pad name gives more information than the element's name, which is very
useful when elements have multiple source pads.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne 5470f6df00 latency: Dot not override already stored events
First, the event would be leaved, but also when an element takes
several buffers before producing one, we want the reported latency to be
the aggregation, so the distance from the oldest buffer.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne bdb75a1450 tracer: latency: Add parameter to select latency type
This sets back the default to trace only pipeline latency, and add flags
to enabled element tracing. It is now possible to only trace element
latency, only trace pipeline latency, trace both or none.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne 6a35153e4e tracer: latency: Add per element latency tracer
This adds per element latency tracing.
2019-04-08 12:28:07 -04:00
Nicolas Dufresne 4585d22a8d tracer: Don't pass pads inside GstEvent
This removes the passing of pad inside of a GstEvent. While this is not
a bug, it may affect the live time of the pad, hense change the pipeline
behaviour.
2019-04-08 12:28:07 -04:00
Jonny Lamb 63170d52ae identity: fixes to the eos-after and error-after properties
I copied `error-after` to make the `eos-after` property, but it turned
out there were some problems with that one, so this patch: adds
separate counters (so setting to NULL and reusing the element will
still work); clarifies the properties' min values; and reports an
error when both are set.
2018-12-18 22:55:28 +00:00
Edward Hervey 1bca404191 queue2: Add details of query in debug log 2018-12-17 09:41:45 +01:00
Jonny Lamb 460c0edbfb identity: add eos-after property
Using `num-buffers` can be unpredictable as buffer sizes are often
arbitrary (filesrc, multifilesrc, etc.). The `error-after` property on
`identity` is better but obviously reports an error afterwards. This
adds `eos-after` which does exactly the same thing but reports EOS
instead.
2018-12-11 21:14:11 +00:00
Philippe Normand 9f5e65f0a2 input-selector: Let context queries pass through
By doing so GL source elements can successfully reuse the GL context and display
of downstream elements. This change fixes an issue in playbin when using
gltestsrc where the context query made by the source element would fail and the
source element would create a second (useless) GLDisplay.
2018-11-28 11:00:21 +00:00
Jordan Petridis 84512152c1
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:58:53 +02:00
Niels De Graef cf3fdbe4c0 typefind: cleanup (un)reffing of several objects.
By using these functions, we can shave off a few lines, and make the
intent of that line more clear.
2018-11-09 08:44:11 +00:00
Matthew Waters 4fc4ad87d5 query: add a new bitrate query
Allows determining from downstream what the expected bitrate of a stream
may be which is useful in queue2 for setting time based limits when
upstream does not provide timing information.

Implement bitrate query handling in queue2

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/60
2018-11-07 15:04:14 +00:00
Matthew Waters c4ccff7861 queue2: avoid ping-pong between 0% and 100% buffering messages
If upstream is pushing buffers larger than our limits, only 1 buffer
is ever in the queue at a time.  Once that single buffer has left the
queue, a 0% buffering message would be posted followed immediately by a
100% buffering message when the next buffer was inserted into the queue
a very short time later.  As per the recommendations, This would result
in the application pausing for a short while causing the appearance of
a short stutter.

The first step of a solution involves not posting a buffering message if
there is still data waiting on the sink pad for insertion into the queue.
This successfully drops the 0% messages from being posted however a
message is still posted on each transition to 100% when the new buffer
arrives resulting in a string of 100% buffering messages.  We silence
these by storing the last posted buffering percentage and only posting a
new message when it is different from or last posted message.
2018-11-07 15:04:14 +00:00
Nicolas Dufresne e1be065293 tracers: log: Fix post query trace
The post tracer hooks have a GstQuery argument which was truncated from
the trace. As the post hook is the one that contains the useful data,
this bug was hiding the important information from that trace.
2018-11-06 15:41:01 -05:00
Matthew Waters 874ad5faca meson: generate pkg-config files for our plugins 2018-11-05 15:18:41 +00:00
Sebastian Dröge 23e6096d0b typefind: Always forward RECONFIGURE events upstream
Based on a patch by Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/67
2018-11-04 12:45:57 +02:00
Sebastian Dröge 3eb334a7f9 typefind: Lower debug level of some output related to the URI query
It's not a warning if an URI doesn't have an extension, and it's also
not mandatory that sources have an URI or even answer the URI query.
2018-10-26 09:21:42 +01:00
Edward Hervey 127e211004 multiqueue: Don't clamp running times for position calculation
Since we use full signed running times, we no longer need to clamp
the buffer time.

This avoids having the position of single queues not advancing for
buffers that are out of segment and never waking up non-linked
streams (resulting in an apparent "deadlock").
2018-10-22 15:28:45 +02:00