Commit graph

19219 commits

Author SHA1 Message Date
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
Edward Hervey
ca2994700e gstvalue: Use quark-based structure usage for segment (de)serialization
Instead of string-based one. Smaller and faster code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
d539d619e4 value: Handle runtime checks as such
The various `g_strdup_printf()` returns values are runtime checks
which could be disabled if one wants and therefore should be
handled as such with g_return_val_if_fail()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
be76ba1312 gstvalue: Remove useless checks
The calling function already checks that the values exists and it's
a valid list

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
761bdc9e5c gstvalue: Use previous assumption
The types were already checked for equality just before, not need to
check for that again

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
9af9113c4a gstvalue: Use comparision functions directly
We know the types of values, just use the comparision function directly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
f800559789 gstvalue: Minor optimization for checks
For value types that aren't subclassable, just check the type directly.
For flags, compare against the fundamental type directly instead of going through
the more expensive recursive check of `G_TYPE_CHECK_VALUE_TYPE()`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
dc7efe296d gstvalue: Optimize list subset some more
Avoid going through the double subtract function when comparing
anything to a list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
46449cbb76 gstvalue: Optimize gst_value_compare_list
The compare function only needs to be retrieved once and used
directly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
ee4d2f9178 gstvalue: Avoid temporary allocation
The problem is that:
* g_value_init will end up allocating an internal list/array
* g_value_copy *clears* the existing value by calling the free func
  and then the copy function (creating it again)

To avoid that alloc/free/alloc cycle, directly call the appropriate
function

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
62f553873b gstcaps: Move assignment outside loop
s1 and f1 stay the same within the inner loop

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
7e1a0ed604 gststructure: inline gst_structure_is_subset()
Having direct access to the iteration allows tighter code and
also being able to stop earlier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
586454bf10 gststructure: Inline gst_structure_intersect()
Having direct access to the iteration allows tighter code and
also being able to stop earlier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
2020-05-05 10:17:49 +00:00
Edward Hervey
973986f40b gstregistry: Directly get list of plugin features
Previously this was:
* iterating and referencing all plugin features in a GList
* *then* filtering out the ones we want
* Was doing that filtering by name (i.e. `strcmp`) instead of direct pointer
comparision

Instead, just create a private direct function to get the list of plugin
features

Uses 4 times less instructions ...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/462>
2020-05-05 10:50:05 +02:00
Rubén Gonzalez
32600b48a2 plugin: Fix typo with GStremaer version:
```
has incompatible version (plugin: 1.15, gst: 1,12)
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/460>
2020-05-04 20:20:17 +00:00
Edward Hervey
841fa7062e gstvalue: No longer store same-type intersection functions in table
The intersection function table is a legacy of 2005, when one could
register random intersection functions. This is no longer the case.

The only place where that table was used was:

* `gst_value_can_intersect()`, where it was already only used for identical
GType
* `gst_value_intersect()`, where the table iteration was insanely expensive

Instead this patch:
* Only stored intersection functions for *different* types (of which there are
only 4)
* Make gst_value_intersect directly call the same-type intersection functions
and only use the table if ever it doesn't match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/454>
2020-05-04 14:41:01 +00:00
Edward Hervey
5e553b8cce gstpad: Simplify task name creation
This was going through a few locks and doing temporarily allocations for every
single task creation.. just to get a name.

We don't need to take locks since:
* The parent exists (we have a reference to it)
* The pad exists (the task belongs to it)
* Changing names of pad/elements when activating is a big no-no

Instead use the existing direct GST_DEBUG_PAD_NAME macro

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
2020-05-04 12:26:10 +00:00
Edward Hervey
7a207da733 gstevent: Add function for checking event name by GQuark
Avoids doing string<=>quark conversions in the sticky event handling path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
2020-05-04 12:26:10 +00:00
Edward Hervey
1d0bda8005 caps: Unify common checks for intersections
Regardless of the intersect method chosen, migrate the same checks
up into the calling function. Same result, just less code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
2020-05-04 12:26:10 +00:00
Edward Hervey
a307c0623c gstregistry: Remove unneeded call
_priv_gst_preload_plugins is only filled if option parsing is active.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
2020-05-04 12:26:10 +00:00
Edward Hervey
c416e2457e basesrc: Don't get flow name if not needed
Put it in the debug call so it's only called when/if needed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
2020-05-04 12:26:10 +00: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
Sebastian Dröge
c09f797231 aggregator: Mark segment parameter as const in gst_aggregator_update_segment()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/457>
2020-05-03 16:11:39 +03:00
Tim-Philipp Müller
df6cbe64cd tools: gst-stats: parse thread-id in windows debug logs properly
They don't seem to have the "0x" prefix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/376>
2020-05-01 21:12:31 +00:00