Commit graph

20894 commits

Author SHA1 Message Date
Guillaume Desmottes 457e33fee5 appsink: factor out dequeue_object()
No semantic change, will be used to implement new event API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1046>
2021-07-22 13:53:53 +02:00
Nicolas Dufresne aba6bd7822 glwindow: wayland: Skip redoing surfaces if window haven't changed
The problem is that EGLNativeWindowSurface and wl_egl_surface are the
same object underneath, so we must recreate both together. As an
optimization, the EGLNativeWindowSurface wrapper is only re-created
if the window_handle changed.

On Mesa, this would cause crash, which will be fixed by:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11979

And will lead to proper errors in the future or on other GL stack. This
issue was encounter using a permanent GstGLDisplay after cycling one of
multiple independent pipelines through NULL state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
2021-07-21 20:56:23 +00:00
Nicolas Dufresne e97fda46dc glwindow: wayland: Remove redundant create_surfaces call
The surfaces will be created in _roundtrip_async, so no need to call
this early. This should cause no functional difference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1230>
2021-07-21 20:56:23 +00:00
Michael Olbrich 5bfb78aa28 decodebin3: improve decoder selection
Currently the decoder selection is very naive: The type with the highest
rank that matches the current caps is used. This works well for software
decoders. The exact supported caps are always known and the static caps are
defined accordingly.
With hardware decoders, e.g. vaapi, the situation is different. The decoder
may reject the caps later during a caps query. At that point, a new decoder
is created. However, the same type is chosen an after several tries,
decodebin fails.

To avoid this, do the caps query while adding the decoder and try again
with other decoder types if the query fails:

1. create the decoder from the next matching type
2. add and link the decoder
3. change the decoder state to READY
4. do the caps query
   if it fails then remove the decoder again and go back to 1.
5. expose the source pad
6. sync the decoder state with the parent.

This way, the decoder is already part of the pipeline when the state change
to READY happens. So context handling should work as before.

Exposing the source pad after the query was successful is important:
Otherwise the thread from the decoder source pad may block in a blocked pad
downstream in the playsink waiting for other pads to be ready.
The thread now blocks trying to set the state back to NULL while holding
the SELECTION_LOCK. Other streams may block on the SELECTION_LOCK and the
playsink never unblocks the pad. The result is a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1201>
2021-07-19 08:56:35 +00:00
Nicolas Dufresne 210cf85fdc gl: x11: Issue XSync to close our top level window
This is similar action as when the window handle is modified, we now issue
XSync whenever we destroy our internal window. This ensure that the window is
properly closed before the connecgtion is dropped.

Fixes #815

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1226>
2021-07-15 16:22:48 +00:00
Nicolas Dufresne 3e69c5546b gl: wayland: Fix hinding the window on close()
When the window is called, we properly destroy all surfaces, which effectively
will unmap that surface and should make it disapear on screen, but we also
destroy the wl_source, a GSource that is resposibble of dispatching and executing
messages to/from the Wayland server.

As a side effect, the server never gets the message and the surfaces are
"leaked" on the server. We fix this using wl_display_flush() before destroying
the wl_source.

Fixes #815

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1226>
2021-07-15 16:22:48 +00:00
Nicolas Dufresne 88e19f857a tests: example: Add missing glx_dep when building sdlshare
Might be realted to some recent Mesa cleanup, but GLX is not longer visible
through libOpenGL, so add the missing deps now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1227>
2021-07-15 11:11:00 -04:00
Matthew Waters 2ed12573b8 examples/qt/textureshare: add explicit dep on glx_dep
Fixes linking:

/usr/bin/ld: subprojects/gst-plugins-base/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.p/qglrenderer.cpp.o: undefined reference to symbol 'glXGetCurrentContext'
/usr/bin/ld: /usr/lib64/libGLX.so.0: error adding symbols: DSO missing from command line

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
2021-07-13 13:42:13 +00:00
Haelwenn (lanodan) Monnier e08dcdf622 gl: Try GLVND 'opengl' and 'glx' first
This fixes targetting desktop OpenGL without libGL.so

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1143>
2021-07-13 13:42:13 +00:00
Sebastian Dröge 9243418a23 audioaggregator: Only post QoS messages if the property is enabled
Previously one of the branches did not check for the property value. To
avoid this in the future, check inside the QoS calculation function
instead.

As a side effect this now always prints the debug messages into the logs
when samples are dropped, which is useful information even without the
QoS messages.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>
2021-07-12 09:42:39 +03:00
Sebastian Dröge 71e46bcf38 audioaggregator: Resync on the next buffer when dropping a buffer on discont resyncing
If a buffer is dropped during resyncing on a discont because either its
end offset is already before the current output offset of the
aggregator or because it fully overlaps with the part of the current
output buffer that was already filled, then don't just assume that the
next buffer is going to start at exactly the expected offset. It might
still require some more dropping of samples.

This caused the input to be mixed with an offset to its actual position
in the output stream, causing additional latency and wrong
synchronization between the different input streams.

Instead consider each buffer after a discont as a discont until the
aggregator actually resynced and starts mixing samples from the input
again.

Also update the start output offset of a new input buffer if samples
have to be dropped at the beginning. Otherwise it might be mixed too
early into the output and overwrite part of the output buffer that
already took samples from this input into account.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/912
which is a regression introduced by https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1180/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1224>
2021-07-12 09:42:39 +03:00
Olivier Crête e8b4164a1f audiomixer: Add test for QoS message posting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête 49f6d3bf33 audio aggregator: Post QoS message when dropping audio
Post a QoS message every time some audio samples are dropped.
Also print log messages to make it easier to debug

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête ea516aee33 audio aggregator: Count samples that are dropped or processed
Keep a count of samples that are dropped or processed as statistics

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête e3be1b8490 audio aggregator: Add QoS property to pad
Add a property to emit a QoS message whenever any data is dropped.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 23:01:13 -04:00
Olivier Crête 1eff5ffef6 audio aggregator: Rename property enum to match class name
Add "CONVERT" into the property enum as we're going to add an
enum specifically for the base pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1209>
2021-07-08 22:34:49 +00:00
Stéphane Cerveau 63de6d564e videodecoder: add API to receive subframes
A video decoder can now receive subframes and start decoding
instead of waiting for the full frame to be complete.
Subframe support will reduce latency as described in the
video encoder base class.

A unit test illustrating this API is available in
tests/check/libs/videodecoder.c.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/454>
2021-07-08 13:19:21 +02:00
Seungha Yang aa34710bb6 gl/context/wgl: Add missing NULL init
The value of uninitialized local variable is varying depending
on compiler and not guaranteed to be NULL initialized.
That results in pointing random address instead of expected function pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1222>
2021-07-03 11:40:25 +00:00
Francisco Javier Velázquez-García 6389eef70d videotestsrc: Add SMPTE75 RP-219 color bars conformant
Implement 8-bit values of SMPTE RP 2019-1:2014.  The bar widths and
heights are the result of fractions as integers.  The remainders of
widths are distributed in a way that they match the values in Table
C.1 (a) in the specification.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
2021-07-01 18:03:14 +02:00
Jan Alexander Steffens (heftig) 7ab7a8ad7c videotestsrc: Add a start parameter to _blend_line
Makes it easier to paint part of a line.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
2021-07-01 18:03:14 +02:00
Jan Alexander Steffens (heftig) 96decaf7ef videotestsrc: Keep tmpline unchanged in_convert_tmpline
This will allow us to repeatedly
call it to render subsequent lines.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1063>
2021-07-01 18:03:14 +02:00
Michael de Gans d8a7fc0a0b appsink: fix incorrect return nullability
This commit fixes the annoations for return nullability on several
GstAppSink functions. This was causing bindings to be generated
incorrectly.

Fixes #914

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1203>
2021-06-30 18:46:37 +00:00
Seungha Yang 058f1e92b7 compositor: Add scaling policy to support PAR-aware scaling
Adding "sizing-policy" property for user to be able to specify
scaling policy (aspect-ratio for example).
At the moment, supported mode is only keep-aspect-ratio, but we might
be able to add more policies such as cropping, etc.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/696
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1156>
2021-06-29 23:06:37 +09:00
Seungha Yang 2551b1d976 video: Deprecate gst_video_sink_center_rect()
... and add gst_video_center_rect() method as a replacement.
The method is useful for outside of videosink subclasses as well
but the old naming might be able to mislead people.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1156>
2021-06-29 18:00:43 +09:00
Jakub Adam 556ce36ce4 rtpbasepayload: don't write empty extension header
When some header extensions are present but none decides to write any
data to the currently processed RTP buffer, remove the extension data
section.

Resulting RTP buffer wasn't formatted correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
2021-06-28 19:28:41 +02:00
Jakub Adam d294d7da36 rtpbuffer: Add gst_rtp_buffer_remove_extension_data()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
2021-06-28 19:28:41 +02:00
Jakub Adam e2e9e321f6 rtpbasepayload: map RTP buffer READWRITE when setting headers
GstRTPHeaderExtension::write can map the RTP buffer for reading. If that
happens on a buffer that is already mapped WRITE-only by the payloader,
the payloader's mapping gets invalidated (GstRTPBuffer::map will point
to a different instance of GstMemory).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1173>
2021-06-28 19:07:44 +02:00
Olivier Crête b4caa6cbdd rtphdrext: Make all fields private
The presence of a method and a field with the same name confuses the C#
binding generator. As there are accessor functions for all the fields,
let's just make them private.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1218>
2021-06-28 18:07:56 +03:00
Olivier Crête 0adc6ccc01 gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in gst-plugins-good#868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1219>
2021-06-26 12:50:58 -04:00
Jan Schmidt 8c04f4bdae video-converter: Set up matrix tables only once.
When configuring a multi-thread converter, only allocate the
shared colour conversion matrices once for the first thread,
to avoid allocating multiple times and leaking memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1216>
2021-06-26 04:00:08 +00:00
Jan Alexander Steffens (heftig) ef324fa068 video-converter: Set up gamma tables only once
When the video converter is using multiple threads, the gamma tables
were created multiple times, leaking the tables set up for the previous
thread.

Only calculate the tables once.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1140>
2021-06-25 13:55:39 +00:00
Jan Alexander Steffens (heftig) b835356d6c audio-converter: Free config when gst_audio_converter_new fails
The config got leaked when parameter validation fails.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1140>
2021-06-25 13:55:39 +00:00
Seungha Yang f8dc833975 glprototypes: Add GST_GL_API_OPENGL to available version of sync
Make sync APIs usable if supported, even when GST_GL_API_OPENGL3 is
not selected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1215>
2021-06-25 10:30:35 +00:00
Per Förlin 30f88aa7c8 gstrtspconnection: Add IPv6 support for tunneled mode
An IPv6 address must be specified within [] brackets.
Add brackets for IPv6 address used for tunneled mode,
for non-tunneled this is already supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1145>
2021-06-24 06:10:19 +00:00
Nicolas Dufresne be6793d0d1 videodecoder: Call drain() rather then finish() on segment-done
The finish() virtual function documentation state that "Sub-classes can refuse
to decode new data after." Though, it is very common to issue a non-flushing
seek after that event in gapless playback uses case. This fixes potential
stalls with code using segment seeks, by using drain() virtual funciton
instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1206>
2021-06-23 20:31:06 +00:00
Matthew Waters 0ac4fda2d6 oggdemux: fix a race in push mode when performing the duration seek
There may be two or more threads involved here however the important
interaction is the use of ogg->seeK_event_drop_till value that was only
set in the push-mode seek-event thread and could race with upstream
sending e.g. and EOS (or data).

Scenario is this:
1. oggdemux performs a seek to near the end of the file to try and find
   the duration. ogg->push_state is set to PUSH_DURATION.
2. Seek is picked up by the dedicated seek event thread and sets
   ogg->seek_event_drop_till to the seek event's seqnum.
3. Most operations are blocked or dropped waiting on the duration to
   be determined and processing continues until a duration is found.
4. Two branching options for how this ultimately plays out
4a. The source is too fast and we receive an EOS event which is dropped
    because ogg->push_state == PUSH_DURATION.  In this case everything
    works.
4b. We hit our 'almost at the end' check in
    gst_ogg_pad_handle_push_mode_state() and attempt to seek back to the
    beginning (or to a user-provided seek).  This seek is marshalled to
    the seek event thread without setting ogg->seek_event_drop_till but
    with change ogg->push_state = PUSH_PLAYING.  If an EOS event or
    e.g. buffers arrive from upstream before the seek event thread has
    picked up the seek event, then the EOS/data is processed as if it
    came as a result of the seek event.  This is the case that fails.

The fix is two-fold:
1. Preemptively set ogg->seek_event_drop_till when setting the seek
   event so that data and other events can be dropped correctly.
2. In addition to dropping and EOS events while ogg->push_state ==
   PUSH_DURATION, also drop any EOS events that are received before the
   seek event has been processed by also tracking the seqnum of the seek.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1196>
2021-06-23 05:09:41 +00:00
Sergei Kovalev ba4f031864 audiobasesink: Fix of double lock release
Add missing "return;" which prevents double lock release.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1208>
2021-06-21 15:58:01 +00:00
Corentin Damman e5382fe84c Update COPYING
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1207>
2021-06-21 09:28:04 +00:00
Matthew Waters aa8b27d45a gl/context: fill a GError on platform-specific fill_info() error
Fixes bindings assuming that GError is always set on error:
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809#note_957493
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809#note_957494
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/809#note_957498

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1204>
2021-06-21 08:02:31 +00:00
François Laignel 973f0bf552 Check mandatory ClockTime arguments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1205>
2021-06-16 14:52:38 +00:00
Scott Moreau 885c1c605b gl/wayland: Use consistent wl_display when creating work queue for proxy wrapper
Without this, glimagesink since wayland 727c7903 fails with
gst-launch-1.0: ../src/wayland-client.c:2181: wl_proxy_set_queue:
Assertion 'proxy->display == queue->display' failed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1200>
2021-06-11 09:31:58 -06:00
Haihua Hu 58f4217468 gl/viv-fb: fix gl plugin hang when run with viv-fb backend
below commit change the window resize thread and cause viv-fb backend
hang, need move resize code after window->open is called. Otherwise,
the resize message will send to a thread that not start running and
window resize call will waiting forever.

Commit:        b887db1efe
glwindow: fix racy resize updates

Take locks around resize handling and marshall all resizes to the
windowing thread by default.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1195>
2021-06-11 04:52:40 +00:00
Nicolas Dufresne 025a14e7fe eglimage: Add AV12 DMABuf import support
The per plane format mapping for AV12 was missing, which would force
raw upload.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1199>
2021-06-10 12:41:31 -04:00
Nicolas Dufresne 0661b15957 eglimage: Fix wrong stride when importing DMABuf
When the code was ported to use component index instead of plane
index, the call to GST_VIDEO_INFO_PLANE_STRIDE() was accidently ported
to use component index, but this macro takes a plane index.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1199>
2021-06-10 12:39:34 -04:00
Sebastian Dröge 1565b9635b appsrc: When dropping buffers before handling the initial segment use the latest input segment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1198>
2021-06-08 17:31:02 +03:00
Sebastian Dröge 0b9976ac46 appsrc: Correctly check if this is the first buffer that was queued
By checking the queue length this would also count events and caps. We
already keep track of the number of buffers separately so just use that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1197>
2021-06-08 13:05:46 +03:00
Mathieu Duponchelle d1fa109083 appsrc: signal enough-data even when leaking
this is convenient for application that wish to monitor whether
the appsrc is leaking.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1193>
2021-06-05 16:55:44 +02:00
Marijn Suijten ed6c970d9c rtp/header: Add missing array length annotation to read/write methods
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1190>
2021-06-03 21:14:42 +02:00
Sebastian Dröge c18dd84f79 video: Sort video formats correctly
AV12 should be right after A420 because it is the same format with just
one plane less, instead of being next to I420/NV12 which don't have an
alpha channel.

RGBP should be before GBR because it's the same format except for the
more canonical component order.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/790
which actually checks on the CI if the algorithm defined in
video-format.h is implemented correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1189>
2021-06-03 14:00:54 +03:00
Matthew Waters 3bbcfe9c23 glvideomixer: hold extra pad ref while calling parent
Our subsequent cleanup needs a ref on the pad and calling the parent may
release the last reference and could cause a use-after-free.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1187>
2021-06-03 15:58:39 +10:00