Commit graph

2342 commits

Author SHA1 Message Date
Xavier Claessens
4a554a2a68 Meson: Add 'coretracers' feature option
This was the only plugin still built when using
-Dauto_features=disabled, besides coreelements.
2019-12-03 19:01:38 -05:00
Edward Hervey
f590a861be tracers: Don't leak temporary GstStructure
CID: 1455462
2019-11-28 08:03:51 +00:00
Niels De Graef
0ca0a9d982 queue2: Use g_object_notify_by_pspec
`g_object_notify()` actually takes a global lock to look up the
`GParamSpec` that corresponds to the given property name. It's not a
huge performance hit, but it's easily avoidable by using the
`_by_pspec()` variant.
2019-10-31 11:06:48 +01:00
Sebastian Dröge
d25a88e3a1 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-24 22:49:41 +00:00
Sebastian Dröge
7f7da6a0d0 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-24 22:49:41 +00:00
Sebastian Dröge
aa29864317 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-24 22:49:41 +00:00
Tim-Philipp Müller
10d9e18f02 Remove autotools build system 2019-10-13 16:10:42 +01:00
Xavier Claessens
d109dd2752 dataurisrc: Do not include trailing \0 into buffer 2019-10-07 17:47:47 +00:00
Aaron Boxer
509f6201e1 documentation: fix a number of typos 2019-10-06 11:12:11 -04:00
Niels De Graef
4812c4087f Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-09-09 12:16:24 +00:00
Jim Mason
a4aa2256d1 consolidated IOV_MAX/UIO_MAXIOV handling per GLib + legacy behaviour for osx/ios 2019-09-07 12:32:40 +01:00
Jim Mason
dc5250e751 gst_writev: respect IOV_MAX for the writev iovec array #439 2019-09-06 19:23:01 +01:00
Matthew Waters
43622119bb file/fdsrc: use struct stat64 on android to match stat64()
Fixes android werror failures:

../plugins/elements/gstfdsrc.c:244:25: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
    if (fstat (src->fd, &stat_results) < 0)
                        ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
../plugins/elements/gstfdsrc.c:560:23: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

  if (fstat (fd, &stat_results) < 0)
                 ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
../../../../../android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
../plugins/elements/gstfilesrc.c:477:23: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
../../../../../android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
2019-08-28 15:46:33 +10:00
Guillaume Desmottes
b7c1195f29 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-13 09:09:55 +05:30
Mathieu Duponchelle
3f93290151 funnel: fix documentation
funnel no longer sends its own segment since:

bbb26f8756

Update the documentation to reflect that
2019-08-06 13:30:12 +00:00
Guillaume Desmottes
e4cba8a0bf 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-02 13:07:58 +05:30
Alicia Boya García
b50abd9f4e 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-07-22 15:06:20 +00:00
Nicolas Dufresne
86b9f78788 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-07-19 22:12:29 -04:00
Philippe Normand
be56bd9aff identity: Fix the ts-offset property getter
Previous code was a copy/paste from the property setter function.
2019-07-11 17:53:53 +01:00
Thibault Saunier
7a2d32abda multiqueue: Fix possible NULL pointer dereferencing
In the hotdoc inspector for example, pads are instantiated with
g_object_new, other code paths to get/set properties already make
that check.

And update doc cache
2019-07-02 17:27:32 -04:00
Tim-Philipp Müller
b5dc8598be leakstracer: Improve notes in the the get-live-objects API docs
It may not be obvious to the user how this action signal is meant to
be called, so document it.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
6ccf59ec06 leakstracer: Add API for tracking and checkpointing objects
This feature was previously available only through the SIGUSR2 signal,
which meant it wasn't available on platforms that don't have UNIX
signals, such as Windows and with applications that already use
SIGUSR1 for something else.

Now we have action-signals for doing the same. These action signals
can also be used for fetching the checkpoint information
programmatically instead of printing to the debug log.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
6e3565ca86 leakstracer: Add API for logging leaks in the debug log
This is the equivalent of sending SIGUSR1 to the application, and is
useful on platforms where UNIX signals are not available, such as
Windows.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
44198ec4d6 leakstracer: Add API for fetching leaked objects
This allows programs to inspect the leaked objects directly, log them,
and so on. Unlike the existing mechanism to use SIGUSR1, this also
works on platforms that do not support UNIX signals, such as Windows
and with applications that already use SIGUSR1 for something else.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
5cdf1b7db8 tracers: Allow setting a name for all tracer objects
This will be useful in combination with the next commit when we add
API to get a list of active tracers so that consumers of the API can
easily distinguish tracer objects.
2019-07-02 15:13:26 +05:30
Nirbheek Chauhan
3e2f24955e leakstracer: Get rid of GSlice usage
It's not faster than malloc, and is slower in most cases. Glib is also
getting rid of it entirely: https://gitlab.gnome.org/GNOME/glib/merge_requests/940
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
a1c44cca3a leakstracer: Remove unused and redundant record fields
All leak records are obviously scoped to the process, and nothing in
the GstTracerRecord code uses these fields anyway.
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
bafa7a5ca7 leakstracer: Improve documentation for the element
Also print a useful g_warning() message when leaks are detected.
2019-07-01 13:33:13 +00:00
Nirbheek Chauhan
145f8546c4 gstinfo: Add an explicit enum for GST_STACK_TRACE_SHOW_NONE
The code implicitly uses this value when the stack trace is not FULL.
Mostly useful for documenting the behaviour when each flag is passed
and for translating to/from strings.
2019-07-01 10:36:09 +00:00
Thibault Saunier
27fbaf9d44 multiqueue: Hold weak references to pads/multiqueue in SingleQueue
Without holding a ref we have no guarantees that the SingleQueue
doesn't have dangling pointers on those objects during its destruction.
2019-06-28 15:30:54 -04:00
Thibault Saunier
6a20fcc97a multiqueue: Stop using the gst_pad_element_private API
There was a race where we could still get the pad event function
called when its private member were already unset, leading to
a segfault in the event handler:

```
0  gst_multi_queue_src_event (pad=<optimized out>, parent=<optimized out>, event=0x7f3ff0007600) at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c:2534
2534          ret = gst_pad_push_event (sq->sinkpad, event);
[Current thread is 1 (Thread 0x7f406c0258c0 (LWP 21925))]
(gdb) bt
0  0x00007f4062ec1399 in gst_multi_queue_src_event (pad=<optimized out>, parent=<optimized out>, event=0x7f3ff0007600 [GstEvent]) at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c:2534
1  0x00007f406b40f46d in gst_validate_pad_monitor_src_event_check (handler=0x7f4062ec1360 <gst_multi_queue_src_event>, event=0x7f3ff0007600 [GstEvent], parent=0x7f3fcc01f090 [GstMultiQueue|multiqueue167], pad_monitor=0x7f3fe809e7c0 [GstValidatePadMonitor|validatepadmonitor2213]) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2101
2  0x00007f406b40f46d in gst_validate_pad_monitor_src_event_func (pad=<optimized out>, parent=0x7f3fcc01f090 [GstMultiQueue|multiqueue167], event=0x7f3ff0007600 [GstEvent]) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2374
3  0x00007f406b904387 in gst_pad_send_event_unchecked (pad=pad@entry=0x7f3fdc027650 [GstPad|src_0], event=event@entry=0x7f3ff0007600 [GstEvent], type=<optimized out>, type@entry=GST_PAD_PROBE_TYPE_EVENT_UPSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5772
4  0x00007f406b90481b in gst_pad_push_event_unchecked (pad=pad@entry=0x7f4058182fc0 [GstPad|sink], event=event@entry=0x7f3ff0007600 [GstEvent], type=type@entry=GST_PAD_PROBE_TYPE_EVENT_UPSTREAM) at ../subprojects/gstreamer/gst/gstpad.c:5417
5  0x00007f406b90f016 in gst_pad_push_event (pad=0x7f4058182fc0 [GstPad|sink], event=event@entry=0x7f3ff0007600 [GstEvent]) at ../subprojects/gstreamer/gst/gstpad.c:5554
6  0x00007f406a1c99ba in gst_video_decoder_src_event_default (decoder=0x7f3fe81c6060 [GstTheoraDec|theoradec46], event=<optimized out>) at ../subprojects/gst-plugins-base/gst-libs/gst/video/gstvideodecoder.c:1532
7  0x00007f406b40f46d in gst_validate_pad_monitor_src_event_check (handler=0x7f406a1ca270 <gst_video_decoder_src_event>, event=0x7f3ff0007600 [GstEvent], parent=0x7f3fe81c6060 [GstTheoraDec|theoradec46], pad_monitor=0x7f4028163aa0 [GstValidatePadMonitor|validatepadmonitor2216]) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2101
8  0x00007f406b40f46d in gst_validate_pad_monitor_src_event_func (pad=<optimized out>, parent=0x7f3fe81c6060 [GstTheoraDec|theoradec46], event=0x7f3ff0007600 [GstEvent]) at ../subprojects/gst-devtools/validate/gst/validate/gst-validate-pad-monitor.c:2374
```

This make the GstSingleQueue a MiniObject, mainly so it is properly
refcounted.

This also make use of the GstMultiQueuePad class for srcpads which
is totally valid as srcpads and sinkpads share the same SingleQueue
object.
2019-06-25 12:53:05 -04:00
Guillaume Desmottes
f321f42359 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-06-20 16:42:01 +05:30
Guillaume Desmottes
f2d37d5132 gstelements_private: sync gst_buffer_get_flags_string() with new flags 2019-06-20 13:49:14 +05:30
Thibault Saunier
eaa39398cc 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-06-20 00:19:24 -04:00
Håvard Graff
3260b2f630 queue: don't report 0 max-latency for leaky queue if max was already 0. 2019-06-13 15:21:03 +00:00
Sebastian Dröge
aaa4353368 concat: Improve debug output a bit 2019-06-05 01:12:42 +00:00
Sebastian Dröge
584c4c6282 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-06-05 01:12:42 +00:00
Thibault Saunier
f040102d45 docs: Add tracers support 2019-05-31 18:53:43 -04:00
Mathieu Duponchelle
ca17a6c791 doc: remove xml from comments 2019-05-29 21:33:42 +02:00
Benjamin Otte
73f6f466c2 dataurisrc: Fix crash when semicolon is aprt of data
This URI is valid:
  data:,;base64
(It encodes the literal string ";base64")

But would lead to a crash because the code assumed the semicolon would
be placed before the colon.
2019-05-21 17:22:04 +02:00
Benjamin Otte
3c2312ce6b dataurisrc: Allow case-insensitive scheme
Quoting RFC 2396:

  For resiliency, programs interpreting URI should treat upper case
  letters as equivalent to lower case in scheme names (e.g., allow
  "HTTP" as well as "http").
2019-05-21 17:15:52 +02:00
Matthew Waters
29557fe623 docs: add coretracers to the list of plugins 2019-05-18 02:41:43 +00:00
Sebastian Dröge
eec9bd8db3 filesink: Implement workaround for some (network) filesystems that spuriously return EACCES on write
This seems to happen when another client is accessing the file at the
same time, and retrying after a short amount of time solves it.

Sometimes partial data is written at that point already but we have no
idea how much it is, or if what was written is correct (it sometimes
isn't) so we always first seek back to the current position and repeat
the whole failed write.

It happens at least on Linux and macOS on SMB/CIFS and NFS file systems.

Between write attempts that failed with EACCES we wait 10ms, and after
enough consecutive tries that failed with EACCES we simply time out.

In theory a valid EACCES for files to which we simply have no access
should've happened already during the call to open(), except for NFS
(see open(2)).

This can be enabled with the new max-transient-error-timeout property, and
a new o-sync boolean property was added to open the file in O_SYNC mode
as without that it's not guaranteed that we get EACCES for the actual
writev() call that failed but might only get it at a later time.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/305
2019-05-16 14:15:02 +03:00
Thibault Saunier
a0c65067e0 Port to hotdoc 2019-05-13 16:34:09 -04:00
Thibault Saunier
5b2da0835e doc: Fix and add some missing docstrings 2019-05-13 11:33:49 -04: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