Commit graph

18892 commits

Author SHA1 Message Date
Sebastian Dröge bf0672f00b systemclock: Only try initializing entries if they were not initialized before
And add assertions accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00
Sebastian Dröge d9bf0f1ec2 systemclock: Clarify comment that described a previous version of the code
Nowadays we are only waking up the head entry waiting if either the head
entry is unscheduled (which is handled some lines above already), or
when the head entry specifically is woken up because a new entry became
the new head entry.

We're not waking up *all* entries anymore whenever any entry in the last
was unscheduled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00
Sebastian Dröge c4a2d92718 systemclock: Get rid of atomic access to clock entry status and use the mutex instead
We already have a mutex in each clock entry anyway and need to make use
of that mutex in most cases when the status changes. Removal of the
atomic operations and usage of the mutex instead simplifies the code
considerably.

The only downside is that unscheduling a clock entry might block for the
time it needs for the waiting thread to go from checking the status of
the entry to actually waiting, which is not a lot of code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +00:00
Sebastian Dröge 3e924f5df9 systemclock: Don't start waiting for a clock id if it was signalled before
Otherwise it can happen that unscheduling a clock id never takes place
and instead it is waiting until the normal timeout. This can happen if
the wait thread checks the status and sets it to busy, then the
unschedule thread sets it to unscheduled and signals the condition
variable, and then the waiting thread starts waiting. As condition
variables don't have a state (unlike Windows event objects), we have to
remember ourselves in a new boolean flag protected by the entry mutex
whether it is currently signalled, and reset this after waiting.

Previously this was not a problem because a file descriptor was written
to for waking up, and the token was left on the file descriptor until
the read from it for waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/500>
2020-05-27 12:15:34 +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
Edward Hervey 79374b8d94 value: Fix comparison of int/int64 ranges
ranges are only equal if:
* Their bounds are equal
* And their step value are equal *IF* they contain more than one value

https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/253
2020-05-25 08:29:21 +02: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
Sebastian Dröge d0e430a690 docs: Add boolean field for readability of properties
Some properties are write-only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/496>
2020-05-20 12:02:08 +00:00
Thor Andreassen 41d77e0327 tools: option '-u' occurs twice in gst-inspect-1.0.1
I have removed the erroneous one according to the source file.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/492>
2020-05-20 08:20:50 +00:00
Thibault Saunier 827c181447 tester: Stop using g_file_new_build_filename
It was introduced in GLib 2.56 only

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/495>
2020-05-19 14:17:34 -04:00
Thibault Saunier 34916e133d tests: Add a gst-tester utility
gst-tester is a tool to launch `.validatetest` files with
TAP[0] compatible output and supporting missing `gst-validate`
application which means that it can be cleanly integrated with meson
test harness.

It allows us to use `gst-validate` to write integration tests in any
GStreamer repository keeping them as close as possible to the code. It
can simplify a lot test writing and reading and not having to go into
another repository to implement or run tests makes it more convenient to
use.

This also implements a stupid simple test to show how that works

[0] https://testanything.org/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/461>
2020-05-19 13:14:46 +00:00
Stéphane Cerveau 618c37fca4 docs: update moving-plugins to use gitlab and meson
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/493>
2020-05-19 10:21:28 +00:00
Edward Hervey 7f068512ec gstbin: Remove mentions of duration caching
This was effectively disabled in 1.0 with the intent of maybe re-enabling it.

The problem is that caching duration at a bin level doesn't make much sense
since there might be queueing/buffering taking place internally and therefore
the duration reported might have no correlation to what is actually being
outputted.

Remove commented code and fixmes, and update documentation

Fixes #4

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/489>
2020-05-18 15:37:20 +02: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
Sebastian Dröge a3562b0d2a docs: Add list of interfaces implemented by elements to the docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/486>
2020-05-15 11:46:28 +00:00
Thibault Saunier 1c97dac2b1 gdb: Print event seqnums, object pointers and structures
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>
2020-05-15 06:33:22 +00:00
Thibault Saunier ab4821630a gdb: Add support for queries and buffers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>
2020-05-15 06:33:22 +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
Edward Hervey 8076051a19 basetransform: Minor refactoring
Move checks related to peerfilter in one place. No impact except for logic.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/484>
2020-05-14 12:19:58 +02:00
Edward Hervey 3c7db917dd gstvalue: Minor list intersection optimization
When matching against the 2nd list, increment the starting position of the inner
list iteration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/484>
2020-05-14 12:19:58 +02:00
Xu Guangxin 003b25f39d bufferpool: unblock acquire thread when we discard buffer
else the acquire thread will wait infinitely.
The deadlock showed in prevous unit test commit. This will fix it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/470>
2020-05-14 07:04:02 +00:00
Xu Guangxin 8a58d67709 tests: bufferpool: add dead lock test for buffer discard
you will see a deadlock after you apply this patch, and run following commandline:

GST_STATE_IGNORE_ELEMENTS=1 tests/check/gst_gstbufferpool

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/470>
2020-05-14 07:04:02 +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
Nirbheek Chauhan b63dd628d2 meson: Pass native: false to add_languages()
This is needed for cross-compiling without a build machine compiler
available. The option was added in 0.54, but we only need this in
Cerbero and it doesn't affect older versions so it should be ok.
Will just cause a spurious warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/477>
2020-05-13 08:19:10 +00:00
Thibault Saunier 7a7cd9de6c gdb: Fix iterating GstStructure fields
This broke with 1b568fa01f where we inlined the array

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/479>
2020-05-12 16:42:42 -04:00
Sebastian Dröge 70469b4a4c docs: Update gst_plugins_cache.json
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/474>
2020-05-10 11:37:45 +03:00
Sebastian Dröge 0eefad2967 docs: Output JSON files with UTF-8 encoding
Otherwise non-ASCII characters are encoded as \uXXXX.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/474>
2020-05-10 11:35:53 +03:00
Edward Hervey 2536cf7c57 gstvalue: Fix segment (de)serialization
By using the proper quarks (stored in the indirection table) and not the *enums*
of those entry in the quark table.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/473>
2020-05-08 17:21:20 +02:00
Edward Hervey 67df099241 check: uri: Check return value
CID #1455381

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:11:20 +02:00
Edward Hervey 9daf1ca44e check: gstvalue: Check return value
As is done everywhere else

CID #1455540

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:11:20 +02:00
Edward Hervey f085dabebc check: testclock: Check return values
As done everywhere else.

CID #1455383
CID #1455524

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:11:20 +02:00
Edward Hervey b6c9491c92 check: gst_promise_reply() takes ownership
Copy the structure temporarily to check it further down.

CID #1455392

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:10:38 +02:00
Edward Hervey 78b0baa7c9 check: Don't leak test string
Turns out the length returned by `__gst_vasprintf()` doesn't include the final
`\0`.

CID #1455430

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>
2020-05-08 12:10:38 +02:00
Matej Knopp cab5b22f21 taglist: Fix crash when comparing two lists of the same length but with different items
Fixes #549

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/469>
2020-05-08 11:04:14 +03:00
Jan Schmidt e329e1f769 tests/input selector: Fix a shutdown crash
Hold a ref to the pad we're planning on sending EOS too, so that
it doesn't disappear if things shut down before the thread gets
to actually send the EOS event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/467>
2020-05-07 03:30:43 +10: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
Thibault Saunier 39b9cc554c basesink: Fix clock synchronization running time in reverse playback
In reverse playback, buffers have to be displayed at buffer.stop running
time, otherwise a same set of buffer can't be displayed in the exact opposite
order to forward playback.

For example, seeking a video stream at 1fps with start=0, stop=5s, rate=1.0

will display the following buffers:

  b0.pts = 0s, b0.duration = 1s - at running time = 0s
  b1.pts = 1s, b1.duration = 1s - at running time = 1s
  b2.pts = 2s, b2.duration = 1s - at running time = 2s
  b3.pts = 3s, b3.duration = 1s - at running time = 3s
  b4.pts = 4s, b4.duration = 1s - at running time = 4s
  <wait at EOS for 1second>

Now, playing that reverse with start=0, stop=5s, rate=1.0 has to display
the following buffers:

  b0.pts = 4s, b0.duration = 1s - at running time = 0s
  b1.pts = 3s, b1.duration = 1s - at running time = 1s
  b2.pts = 2s, b2.duration = 1s - at running time = 2s
  b3.pts = 1s, b3.duration = 1s - at running time = 3s
  b4.pts = 0s, b4.duration = 1s - at running time = 4s
  <wait at EOS for 1second>

With the previous code, it reproduced the following:

  b0.pts = 4s, b0.duration = 1s - at running time = 1s
  b1.pts = 3s, b1.duration = 1s - at running time = 2s
  b2.pts = 2s, b2.duration = 1s - at running time = 3s
  b3.pts = 1s, b3.duration = 1s - at running time = 4s
  b4.pts = 0s, b4.duration = 1s - at running time = 5s
  <NO WAIT AT EOS AND POST EOS RIGHT AWAY>

This is being tested with the `validate.launch_pipeline.sink.reverse_playback_clock_waits.*`
set of tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/450>
2020-05-06 14:24:36 +00:00
Thibault Saunier 4a025d77ac basesrc: Fix the way position is computed in reverse playback
In reverse playback, buffers are played back from buffer.stop
(buffer.pts + buffer.duration) to buffer.pts, which means that the
position after the buffer is consumed is buffer.pts, not buffer.pts -
buffer.duration.

Without that change, and when `automatic_eos` feature is on,
we were dropping the last buffers as marking the stream EOS one buffer
too soon.

This is now being tested extensively by GstValidate in the
`validate.test.clock_sync.*` set of tests.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/450>
2020-05-06 14:24:36 +00:00
Tim-Philipp Müller dc1a1e5275 pkgconfig: add pluginscannerdir variable
So we can get this in a unified way from installed
and uninstalled GStreamer when using pkg-config to
set up test environments in other modules.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/582

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/456>
2020-05-06 13:32:56 +00:00
Edward Hervey 81752169a4 taglist: Make equality check more uniform
Previously this was iterating over taglists with ... string names.

Instead use the same technique as `gst_structure_is_equal()` with the additional
double check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/466>
2020-05-06 12:00:46 +02:00
Sebastian Dröge a3c7e1c9b9 registrybinary: Also call fclose() if fflush()/fsync() failed
Otherwise we would be leaking the file in error cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/465>
2020-05-06 07:33:42 +00:00
Sebastian Dröge 0d1fe824e2 registrybinary: Don't call fclose() more than once
We must not retry fclose() on EINTR as POSIX states:

  After the call to fclose(), any use of stream results in undefined
  behavior.

We ensure above with fflush() and fsync() that everything is written out
so chances of running into EINTR are very low. Nonetheless assume that
the file can't be safely renamed, we'll just try again on the next
opportunity.

CID #1462697

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/465>
2020-05-06 07:33:42 +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
Thibault Saunier c740c10404 segment: Enhance the GstSegment structure documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/435>
2020-05-05 20:52:11 +00:00
Thibault Saunier 416d4a13e0 doc: Add signal flags information in the plugin cache
Updating the plugin cache file
Same behavior as g-ir as the signal flags don't have a GType associated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/463>
2020-05-05 13:40:50 -04:00
Richard Kreckel 96ebee1dc8 registrybinary: Use a FILE* in BinaryRegistryCache...
...instead of a file descriptor so buffered I/O is used when writing
the binary cache. This boosts performance at startup, particularly on
network filesystems where writes may be quite slow.

Fixes gstreamer#545.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/458>
2020-05-05 12:27:46 +00:00