platform/upstream/gstreamer.git
4 years agofdsink: remove unused struct member `bytes_written`
Mathieu Duponchelle [Mon, 11 May 2020 22:57:36 +0000 (00:57 +0200)]
fdsink: remove unused struct member `bytes_written`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/476>

4 years agofilesink: port over unlock code from fdsink
Mathieu Duponchelle [Mon, 11 May 2020 22:54:56 +0000 (00:54 +0200)]
filesink: port over unlock code from fdsink

See also: 5216322d39448ed61c86bb1b3dd9c8c5e6feccf3

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>

4 years agodocs: Add boolean field for readability of properties
Sebastian Dröge [Tue, 19 May 2020 19:24:39 +0000 (22:24 +0300)]
docs: Add boolean field for readability of properties

Some properties are write-only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/496>

4 years agotools: option '-u' occurs twice in gst-inspect-1.0.1
Thor Andreassen [Tue, 19 May 2020 08:34:01 +0000 (10:34 +0200)]
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>

4 years agotester: Stop using g_file_new_build_filename
Thibault Saunier [Tue, 19 May 2020 18:16:49 +0000 (14:16 -0400)]
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>

4 years agotests: Add a gst-tester utility
Thibault Saunier [Mon, 4 May 2020 21:05:07 +0000 (17:05 -0400)]
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>

4 years agodocs: update moving-plugins to use gitlab and meson
Stéphane Cerveau [Tue, 19 May 2020 09:30:50 +0000 (09:30 +0000)]
docs: update moving-plugins to use gitlab and meson

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/493>

4 years agogstbin: Remove mentions of duration caching
Edward Hervey [Mon, 18 May 2020 08:46:04 +0000 (10:46 +0200)]
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>

4 years agoinput-selector: Ensure events are forwarded only once per pad
Thibault Saunier [Fri, 15 May 2020 11:48:07 +0000 (11:48 +0000)]
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>

4 years agoinputselector: Ensure that events are pushed first on active pad
Thibault Saunier [Thu, 14 May 2020 21:13:05 +0000 (17:13 -0400)]
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>

4 years agodocs: Add list of interfaces implemented by elements to the docs
Sebastian Dröge [Fri, 15 May 2020 07:38:30 +0000 (10:38 +0300)]
docs: Add list of interfaces implemented by elements to the docs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/486>

4 years agogdb: Print event seqnums, object pointers and structures
Thibault Saunier [Wed, 13 May 2020 21:35:01 +0000 (17:35 -0400)]
gdb: Print event seqnums, object pointers and structures

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>

4 years agogdb: Add support for queries and buffers
Thibault Saunier [Wed, 13 May 2020 21:34:12 +0000 (17:34 -0400)]
gdb: Add support for queries and buffers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>

4 years agoinputselector: Never reset active pad set from the user
Thibault Saunier [Wed, 13 May 2020 21:07:43 +0000 (17:07 -0400)]
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>

4 years agobasetransform: Minor refactoring
Edward Hervey [Thu, 14 May 2020 10:13:07 +0000 (12:13 +0200)]
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>

4 years agogstvalue: Minor list intersection optimization
Edward Hervey [Thu, 14 May 2020 09:32:39 +0000 (11:32 +0200)]
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>

4 years agobufferpool: unblock acquire thread when we discard buffer
Xu Guangxin [Thu, 7 May 2020 13:06:18 +0000 (21:06 +0800)]
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>

4 years agotests: bufferpool: add dead lock test for buffer discard
Xu Guangxin [Mon, 11 May 2020 10:21:48 +0000 (18:21 +0800)]
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>

4 years agooutput-selector: Drop duplicated seek events
Thibault Saunier [Tue, 12 May 2020 02:27:14 +0000 (22:27 -0400)]
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>

4 years agomeson: Pass native: false to add_languages()
Nirbheek Chauhan [Tue, 12 May 2020 00:28:38 +0000 (05:58 +0530)]
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>

4 years agogdb: Fix iterating GstStructure fields
Thibault Saunier [Tue, 12 May 2020 20:42:42 +0000 (16:42 -0400)]
gdb: Fix iterating GstStructure fields

This broke with 1b568fa01fa16885c3a7368551034c206493a41a where we inlined the array

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/479>

4 years agodocs: Update gst_plugins_cache.json
Sebastian Dröge [Sun, 10 May 2020 08:37:45 +0000 (11:37 +0300)]
docs: Update gst_plugins_cache.json

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/474>

4 years agodocs: Output JSON files with UTF-8 encoding
Sebastian Dröge [Sun, 10 May 2020 08:35:53 +0000 (11:35 +0300)]
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>

4 years agogstvalue: Fix segment (de)serialization
Edward Hervey [Fri, 8 May 2020 15:21:20 +0000 (17:21 +0200)]
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>

4 years agocheck: uri: Check return value
Edward Hervey [Fri, 8 May 2020 06:03:54 +0000 (08:03 +0200)]
check: uri: Check return value

CID #1455381

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>

4 years agocheck: gstvalue: Check return value
Edward Hervey [Fri, 8 May 2020 06:02:12 +0000 (08:02 +0200)]
check: gstvalue: Check return value

As is done everywhere else

CID #1455540

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>

4 years agocheck: testclock: Check return values
Edward Hervey [Fri, 8 May 2020 05:43:02 +0000 (07:43 +0200)]
check: testclock: Check return values

As done everywhere else.

CID #1455383
CID #1455524

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/472>

4 years agocheck: gst_promise_reply() takes ownership
Edward Hervey [Fri, 8 May 2020 05:03:49 +0000 (07:03 +0200)]
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>

4 years agocheck: Don't leak test string
Edward Hervey [Fri, 8 May 2020 04:49:45 +0000 (06:49 +0200)]
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>

4 years agotaglist: Fix crash when comparing two lists of the same length but with different...
Matej Knopp [Thu, 7 May 2020 21:00:13 +0000 (23:00 +0200)]
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>

4 years agotests/input selector: Fix a shutdown crash
Jan Schmidt [Wed, 6 May 2020 17:28:59 +0000 (03:28 +1000)]
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>

4 years agoidentity: Handle seeking with single_segment=True
Thibault Saunier [Wed, 29 Apr 2020 02:21:13 +0000 (22:21 -0400)]
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>

4 years agoidentity,clocksync: Fix timestamping inside single segment in reverse playback
Thibault Saunier [Tue, 28 Apr 2020 17:28:32 +0000 (13:28 -0400)]
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>

4 years agobasesink: Fix clock synchronization running time in reverse playback
Thibault Saunier [Thu, 23 Apr 2020 20:24:15 +0000 (16:24 -0400)]
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>

4 years agobasesrc: Fix the way position is computed in reverse playback
Thibault Saunier [Thu, 23 Apr 2020 20:10:24 +0000 (16:10 -0400)]
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>

4 years agopkgconfig: add pluginscannerdir variable
Tim-Philipp Müller [Sat, 2 May 2020 11:01:49 +0000 (12:01 +0100)]
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>

4 years agotaglist: Make equality check more uniform
Edward Hervey [Wed, 6 May 2020 09:59:15 +0000 (11:59 +0200)]
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>

4 years agoregistrybinary: Also call fclose() if fflush()/fsync() failed
Sebastian Dröge [Wed, 6 May 2020 07:07:30 +0000 (10:07 +0300)]
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>

4 years agoregistrybinary: Don't call fclose() more than once
Sebastian Dröge [Wed, 6 May 2020 06:59:47 +0000 (09:59 +0300)]
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>

4 years agoqueue2: Use explicit limit checking
Edward Hervey [Wed, 6 May 2020 06:04:28 +0000 (08:04 +0200)]
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>

4 years agosegment: Enhance the GstSegment structure documentation
Thibault Saunier [Wed, 15 Apr 2020 21:49:37 +0000 (17:49 -0400)]
segment: Enhance the GstSegment structure documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/435>

4 years agodoc: Add signal flags information in the plugin cache
Thibault Saunier [Tue, 5 May 2020 17:20:10 +0000 (13:20 -0400)]
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>

4 years agoregistrybinary: Use a FILE* in BinaryRegistryCache...
Richard Kreckel [Sun, 3 May 2020 16:50:26 +0000 (18:50 +0200)]
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>

4 years agogstvalue: Use quark-based structure usage for segment (de)serialization
Edward Hervey [Thu, 23 Apr 2020 12:57:59 +0000 (14:57 +0200)]
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>

4 years agovalue: Handle runtime checks as such
Edward Hervey [Fri, 17 Apr 2020 15:14:36 +0000 (17:14 +0200)]
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>

4 years agogstvalue: Remove useless checks
Edward Hervey [Fri, 1 May 2020 13:15:46 +0000 (15:15 +0200)]
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>

4 years agogstvalue: Use previous assumption
Edward Hervey [Fri, 1 May 2020 12:50:52 +0000 (14:50 +0200)]
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>

4 years agogstvalue: Use comparision functions directly
Edward Hervey [Fri, 1 May 2020 12:48:37 +0000 (14:48 +0200)]
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>

4 years agogstvalue: Minor optimization for checks
Edward Hervey [Fri, 1 May 2020 12:45:28 +0000 (14:45 +0200)]
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>

4 years agogstvalue: Optimize list subset some more
Edward Hervey [Mon, 23 Mar 2020 16:03:51 +0000 (17:03 +0100)]
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>

4 years agogstvalue: Optimize gst_value_compare_list
Edward Hervey [Mon, 23 Mar 2020 16:01:20 +0000 (17:01 +0100)]
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>

4 years agogstvalue: Avoid temporary allocation
Edward Hervey [Sat, 21 Mar 2020 12:05:33 +0000 (13:05 +0100)]
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>

4 years agogstcaps: Move assignment outside loop
Edward Hervey [Mon, 23 Mar 2020 07:20:58 +0000 (08:20 +0100)]
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>

4 years agogststructure: inline gst_structure_is_subset()
Edward Hervey [Mon, 23 Mar 2020 07:10:53 +0000 (08:10 +0100)]
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>

4 years agogststructure: Inline gst_structure_intersect()
Edward Hervey [Mon, 23 Mar 2020 07:06:26 +0000 (08:06 +0100)]
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>

4 years agogstregistry: Directly get list of plugin features
Edward Hervey [Tue, 5 May 2020 08:47:07 +0000 (10:47 +0200)]
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>

4 years agoplugin: Fix typo with GStremaer version:
Rubén Gonzalez [Mon, 4 May 2020 16:51:19 +0000 (16:51 +0000)]
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>

4 years agogstvalue: No longer store same-type intersection functions in table
Edward Hervey [Fri, 1 May 2020 13:03:55 +0000 (15:03 +0200)]
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>

4 years agogstpad: Simplify task name creation
Edward Hervey [Fri, 1 May 2020 15:27:07 +0000 (17:27 +0200)]
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>

4 years agogstevent: Add function for checking event name by GQuark
Edward Hervey [Fri, 1 May 2020 15:30:20 +0000 (17:30 +0200)]
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>

4 years agocaps: Unify common checks for intersections
Edward Hervey [Fri, 17 Apr 2020 15:12:10 +0000 (17:12 +0200)]
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>

4 years agogstregistry: Remove unneeded call
Edward Hervey [Wed, 15 Apr 2020 07:09:22 +0000 (09:09 +0200)]
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>

4 years agobasesrc: Don't get flow name if not needed
Edward Hervey [Fri, 1 May 2020 08:19:08 +0000 (10:19 +0200)]
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>

4 years agoclocksync: Remove handoff signals
Sebastian Dröge [Wed, 22 Apr 2020 07:26:45 +0000 (10:26 +0300)]
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>

4 years agoaggregator: Mark segment parameter as const in gst_aggregator_update_segment()
Sebastian Dröge [Sun, 3 May 2020 13:11:39 +0000 (16:11 +0300)]
aggregator: Mark segment parameter as const in gst_aggregator_update_segment()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/457>

4 years agotools: gst-stats: parse thread-id in windows debug logs properly
Tim-Philipp Müller [Mon, 24 Feb 2020 11:24:16 +0000 (11:24 +0000)]
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>

4 years agoAdd missing colons to Since markers in the docs
Sebastian Dröge [Fri, 1 May 2020 07:07:09 +0000 (10:07 +0300)]
Add missing colons to Since markers in the docs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/452>

4 years agomultiqueue: fix link-like syntax in doc
Mathieu Duponchelle [Mon, 27 Apr 2020 22:33:22 +0000 (00:33 +0200)]
multiqueue: fix link-like syntax in doc

4 years agoharness: also forward context queries between harnesses
Matthew Waters [Fri, 24 Apr 2020 02:47:52 +0000 (12:47 +1000)]
harness: also forward context queries between harnesses

Fixes multiple OpenGL contexts being created with a setup like:

h = gst_harness_new ("glcolorconvert");
gst_harness_add_src (h, "gltestsrc", FALSE);

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/448>

4 years agobaseparse: Always clear drain flag before pulling
Nicolas Dufresne [Wed, 22 Apr 2020 16:58:35 +0000 (12:58 -0400)]
baseparse: Always clear drain flag before pulling

In pull mode, each pull is unique. A following pull can be well inside the
range even if the previous one wasn't. Fix this my moving the drain flag
right before the pull.

This avoids passing a bad drain flag to parsers, which may endup truncate
buffers causing data corruption.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1275

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/446>

4 years agobuild: libcheck may require linking against rt
Matthew Waters [Thu, 23 Apr 2020 05:46:48 +0000 (15:46 +1000)]
build: libcheck may require linking against rt

In static linking scenarios, this is required to avoid this error
building tests:

/work/prefix/lib/libgstcheck-1.0.a(check_run.c.o): In function `tcase_run_tfun_fork':
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check_run.c:476: undefined reference to `timer_create'
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check_run.c:483: undefined reference to `timer_settime'
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check_run.c:493: undefined reference to `timer_delete'
/work/prefix/lib/libgstcheck-1.0.a(check.c.o): In function `check_get_clockid':
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check.c:628: undefined reference to `timer_create'
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check.c:629: undefined reference to `timer_delete'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/447>

4 years agogstcaps: fix out of bounds checks
Juan Navarro [Wed, 22 Apr 2020 16:59:54 +0000 (18:59 +0200)]
gstcaps: fix out of bounds checks

These two checks could end up allowing out of bounds array access, when
the index equals the array size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/445>

4 years agoRevert "gstvalue: Avoid expensive fallback on intersection"
Matthew Waters [Tue, 21 Apr 2020 09:33:08 +0000 (19:33 +1000)]
Revert "gstvalue: Avoid expensive fallback on intersection"

This reverts commit cd751c2de39969ab6187eab12e4e8a85e0467cf7.
Reverts https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/406

Fixes glviewconvert negotiation in e.g.:

gltestsrc ! glviewconvert output-mode-override=side-by-side ! glstereosplit name=s s.left ! queue ! fakesink s.right ! queue ! glimagesink

Problem here is that intersecting flagsets in gst_value_intersect will
always find a value comparison function but may fail a direct type
comparison due to flagsets supporting derived types.  When flagset
derived types are intersected, an intersection will therefore always
fail.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/441>

4 years agosystemclock: Fix clock waiting on Windows
Seungha Yang [Wed, 22 Apr 2020 11:19:23 +0000 (20:19 +0900)]
systemclock: Fix clock waiting on Windows

Add missing parentheses in macro for the divide operation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/444>

4 years agodebugutils: Skip multiqueue stats in dot dump
Charlie Turner [Tue, 21 Apr 2020 17:14:00 +0000 (18:14 +0100)]
debugutils: Skip multiqueue stats in dot dump

If this is not done, tools like xdot fail with "unexpected char
b'\\'". This is a regression caused by commit
74938f07c2a9b3411716fa7595178942c80e20f4 (multiqueue: Add stats
property).

The deserialized value coming out of g_object_get_property looks like
this,

$24 = (gchar *) 0x7f560c0046a0 "application/x-gst-multi-queue-stats, queues=(structure)< \\\"queue_0\\\\,\\\\ buffers\\\\=\\\\(uint\\\\)39\\\\,\\\\ bytes\\\\=\\\\(uint\\\\)8
120251\\\\,\\\\ time\\\\=\\\\(guint64\\\\)1460000000\\\\;\\\", \\\"queue_1\\\\,\\\\ buffers\\\\=\\\\(uint\\\\)186\\\\,\\\\ bytes\\\\=\\\\(uint\\\\)838020\\\\,\\\\ time\\\\=\
\\\(guint64\\\\)1984000002\\\\;\\\" >;"

That is immediately looking wrong. I don't know enough about GNOME
serialization details to say with confidence what happened here. It
gets worse after this is sent through g_strescape and then written to
the dot file. Interestingly, dot -Tpng is fine to ignore them it
seems.

Since the stats are by definition verbose, I decided the best choice
to omit them from the dot file, since such details are not of interest
there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/442>

4 years agoUse gst_object_unref() / gst_object_clear() instead of the GObject ones
Sebastian Dröge [Mon, 20 Apr 2020 13:21:10 +0000 (16:21 +0300)]
Use gst_object_unref() / gst_object_clear() instead of the GObject ones

To allow the refcounting tracer to work better. In childproxy/iterator
these might be plain GObjects but gst_object_unref() also works on them.
In other places where it is never GstObject, g_object_unref() is kept.

4 years agodownloadbuffer:fix pushing buffer before stream start event
dhilshad [Fri, 17 Apr 2020 06:14:40 +0000 (11:44 +0530)]
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

4 years agogstregistrychunks: Directly set name on features
Edward Hervey [Fri, 17 Apr 2020 05:44:55 +0000 (07:44 +0200)]
gstregistrychunks: Directly set name on features

4 years agogstobject: Don't double-notify when setting names
Edward Hervey [Fri, 17 Apr 2020 05:44:26 +0000 (07:44 +0200)]
gstobject: Don't double-notify when setting names

If the name is set via the gobject setters, the notificatio will
already be emitted.

4 years agobuild: Install bash-completion relative to datadir
Jan Tojnar [Thu, 16 Apr 2020 09:40:49 +0000 (11:40 +0200)]
build: Install bash-completion relative to datadir

Since bash-completion 2.9, it was no longer possible to override
the completionsdir through prefix. [1] In 2.10, the overridability
was re-estabilished but this time through datadir variable. [2]

This should not really matter except for developers installing the project
into a custom prefix or distros using per-package prefixes like NixOS.

[1]: https://github.com/scop/bash-completion/commit/81ba2c7e7dfbaefbafa1e8615727c9612e5fb314
[2]: https://github.com/scop/bash-completion/pull/344

4 years agosystemclock: introduce a minimum wait time
Matthew Waters [Wed, 15 Apr 2020 10:27:36 +0000 (20:27 +1000)]
systemclock: introduce a minimum wait time

There is not point waiting if the time to wait is less than this
platform specific value.  The worst case here is GCond usage on windows
where the granularity is 1ms.

4 years agogst/systemclock: wait on each entry individually
Matthew Waters [Wed, 15 Apr 2020 07:54:21 +0000 (17:54 +1000)]
gst/systemclock: wait on each entry individually

Problem:
multiple aggregator elements (audiomixer, compositor) in a live
pipeline use a lot of CPU waiting each other up.  This is because
of the previously unused clock entry unscheduling during regular
operation.

Clock entry unscheduling has the potential to wake up every clock entry
waiting using the system clock which may be a large number.

Solution:
Implement waiting per entry and only wakeup the unscheduled entry.

While this may be possible using GCond, theoretically GCond only gives
us microsecond accuracy and uses relative waits in a number of places.
We can unfortunately do better poking at the platform specifics
ourselves by using futexes on linux and pthread on other unix.  Windows
may have a possible implementation using Waitable timers but that is
not implemented here and instead falls back to the GCond implementation.
GCond waits on Windows is still as accurate as the previous GstPoll-based
implementation.

4 years agosystemclock: log the object name with all debug logs
Matthew Waters [Tue, 14 Apr 2020 05:08:47 +0000 (15:08 +1000)]
systemclock: log the object name with all debug logs

Simplifies correlating logs with clock instances

4 years agosystemclock: move to GCond waiting
Matthew Waters [Tue, 14 Apr 2020 04:48:20 +0000 (14:48 +1000)]
systemclock: move to GCond waiting

4 years agovalue: Fix segfault comparing empty GValueArrays
Thibault Saunier [Mon, 13 Apr 2020 00:33:43 +0000 (20:33 -0400)]
value: Fix segfault comparing empty GValueArrays

Adding a test

4 years agopipeline: fix base_time selection when flush seeking live
Mathieu Duponchelle [Wed, 8 Apr 2020 20:22:48 +0000 (22:22 +0200)]
pipeline: fix base_time selection when flush seeking live

When a live pipeline goes to PLAYING, its change_state method
is called twice for PAUSED_TO_PLAYING: the first time is
from GstElement, when NO_PREROLL is returned, the second
is from GstBin, after all async_done messages have been
collected.

base_time selection is done only the first time, through
comparisons with start_time.

On the other hand, when this live pipeline gets flush seeked,
even though start_time is reset by the sink upon reception
of flush_stop(reset_time=TRUE), PAUSED_TO_PLAYING only occurs
once, from GstBin, after all async_done messages have been
collected. This causes the base_time to be off by <latency>.

This commit addresses this by mimicing the behaviour of
GstElement on NO_PREROLL, and calling the change_state
method manually when the following conditions are met:

* The pipeline is live

* The target state is PLAYING

4 years agomultiqueue: Add current-level-{buffers, bytes, time} pad properties
Vivia Nikolaidou [Thu, 9 Apr 2020 13:38:23 +0000 (16:38 +0300)]
multiqueue: Add current-level-{buffers, bytes, time} pad properties

To get the current buffers/bytes/time levels of the corresponding
internal queue

4 years agomultiqueue: Add stats property
Vivia Nikolaidou [Thu, 9 Apr 2020 10:12:22 +0000 (13:12 +0300)]
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.

4 years agoMeson: Change extra-checks to feature option and make it yielding
Xavier Claessens [Wed, 8 Apr 2020 16:09:10 +0000 (12:09 -0400)]
Meson: Change extra-checks to feature option and make it yielding

4 years agobaseparse: Don't return more data than asked for in pull_range()
Jan Schmidt [Wed, 8 Apr 2020 07:53:17 +0000 (17:53 +1000)]
baseparse: Don't return more data than asked for in pull_range()

Even when pulling a new 64KB buffer from upstream, don't return
more data than was asked for in the pull_range() method and then
return less later, as that confused subclasses like h264parse.

Add a unit test that when a subclass asks for more data, it always
receives a larger buffer on the next iteration, never less.

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

4 years agodownloadbuffer, multiqueue, queue2: Fix watermark docs
Vivia Nikolaidou [Mon, 6 Apr 2020 15:14:12 +0000 (18:14 +0300)]
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.

4 years agopad: Add a guard against getrange functions not filling a caller-provided buffer
Sebastian Dröge [Thu, 2 Apr 2020 10:45:48 +0000 (13:45 +0300)]
pad: Add a guard against getrange functions not filling a caller-provided buffer

It's a programming error to not do so and would cause all kinds of
problems in the caller that assumed its own buffer to have been filled.

4 years agotask: Introduce gst_task_resume() API
Nicolas Dufresne [Fri, 31 Jan 2020 16:32:10 +0000 (11:32 -0500)]
task: Introduce gst_task_resume() API

This new API allow resuming a task if it was paused, while leaving it to
stopped stated if it was stopped or not started yet. This new API can be
useful for callback driver workflow, where you basically want to pause and
resume the task when buffers are notified while avoiding the race with a
gst_task_stop() coming from another thread.

4 years agogst-launch: go back down to GST_STATE_NULL in one step.
Mathieu Duponchelle [Wed, 1 Apr 2020 13:41:49 +0000 (15:41 +0200)]
gst-launch: go back down to GST_STATE_NULL in one step.

Going through each state on the way back down to GST_STATE_NULL
can cause deadlocks, for example:

gst-launch-1.0 audiotestsrc ! valve drop=true ! autoaudiosink

ctrl + C

Hangs forever when going to PAUSED, because the "final" state is
ASYNC, and the sink blocks waiting for a preroll buffer.

Going straight to NULL addresses this issue, and also helps
making teardown faster when piping sparse streams to a
sync sink.

4 years agobaseparse: Fix upstream read caching
Jan Schmidt [Tue, 31 Mar 2020 15:36:40 +0000 (02:36 +1100)]
baseparse: Fix upstream read caching

When running in pull mode (for e.g. mp3 reading),
baseparse currently reads 64KB from upstream, then mp3parse
consumes typically around 417/418 bytes of it. Then
on the next loop, it will read a full fresh 64KB again,
which is a big waste.

Fix the read loop to use the available cache buffer first
before going for more data, until the cache drops to < 1KB.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/518

4 years agobaseparse: Fix typo
Jan Schmidt [Tue, 31 Mar 2020 15:46:52 +0000 (02:46 +1100)]
baseparse: Fix typo

4 years agofilesink: Fix for updating the index of memory to write in the next iteration
Seungha Yang [Tue, 31 Mar 2020 10:05:30 +0000 (19:05 +0900)]
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.

4 years agofilesink: Fix crash caused by zero-size memory allocation
Seungha Yang [Sat, 28 Mar 2020 07:20:51 +0000 (16:20 +0900)]
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

4 years agogstsegment: Refuse instant-rate seeks in gst_segment_do_seek()
Jan Schmidt [Fri, 22 Nov 2019 12:55:56 +0000 (23:55 +1100)]
gstsegment: Refuse instant-rate seeks in gst_segment_do_seek()

Elements that pass a seek with INSTANT_RATE flag to
gst_segment_do_seek() haven't been updated and we should
refuse the seek.

4 years agobasesrc: Check the return value of gst_segment_do_seek()
Jan Schmidt [Fri, 22 Nov 2019 12:53:59 +0000 (23:53 +1100)]
basesrc: Check the return value of gst_segment_do_seek()

Don't assume that a given seek succeeds - check the return result.