Commit graph

6648 commits

Author SHA1 Message Date
Sebastian Dröge
367d693f22 gstreamer: ptp-helper: Use if_nametoindex and setsockopt on Solaris / Illumos too
Patch by Marcel Telka <marcel@telka.sk>.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Sebastian Dröge
c36296895f gstreamer: ptp-helper: Don't import Context trait multiple times unnecessarily
This only affected the Solaris / Illumos code path.

Patch by Marcel Telka <marcel@telka.sk>.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Sebastian Dröge
c97ec122d9 gstreamer: ptp-helper: Use c_ulong for ifa_flags on Solaris/Illumos
Based on a patch by Marcel Telka <marcel@telka.sk>.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Sebastian Dröge
895ee6f72e gstreamer: Solaris/Illumos require linking to libnsl / libsocket for various socket APIs
Patch by Tim Mooney <Tim.Mooney@ndsu.edu> from OpenIndiana/oi-userland

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6947>
2024-05-29 01:54:29 +03:00
Philippe Normand
1caa041c91 webrtcbin: Allow session level setup attribute in SDP
An SDP answer can declare its setup attribute at the session level or at the
media level. Until this patch we were validating only the latter case and an
assert was raised in the former case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6945>
2024-05-28 15:44:21 +00:00
Sebastian Dröge
3d9fd9926c typefind: Fix handling of ID_ODD_SIZE in WavPack typefinder
Chunks are always starting on an even position and this flag only
specifies that the last byte of the chunk is not valid.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6944>
2024-05-28 17:47:22 +03:00
Sebastian Dröge
b77de8f6f2 dtlsconnection: Fix overflow in timeout calculation on systems with 32 bit time_t
If a timeout of more than 4295s was scheduled, the calculation would
overflow and a too short timeout would be used instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6920>
2024-05-25 08:03:22 +00:00
Sebastian Dröge
4116127217 clock: Fix 32 bit assertions in GST_TIME_TO_TIMEVAL and GST_TIME_TO_TIMESPEC
On various 32 bit systems, time_t is actually 64 bits while long is
still only 32 bits. The macro would wrongly trigger its assertion in
this case if a value with more than 68 years worth of seconds is
converted.

Examples are various newer 32 bit platforms and old ones that are
compiled with -D_TIME_BITS=64.

Also statically assert that time_t is either 32 or 64 bits. Other values
might need adjustments in the macro.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6919>
2024-05-25 10:07:32 +03:00
He Junyan
e7e6472a31 kmssink: Do not close the DRM prime handle twice
The prime_fds for multi planes may be the same. For example, on Intel's
platform, the NV12 surface may have the same FD for the plane0 and the
plane1. Then, the DRM_IOCTL_GEM_CLOSE will close the same handle twice
and get an "Invalid argument 22" error the second time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6916>
2024-05-23 23:08:36 +00:00
Daniel Stone
75ad05b518 wayland: Use wl_display_create_queue_with_name
Wayland 1.23 and above allow us to attach names to an event queue, which
are printed out when debugging. Do this to make the logs easier to read.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6915>
2024-05-23 23:28:52 +01:00
Yacine Bandou
1b191d1d8d streamsynchronizer: Fix deadlock when streams have been flushed before others start
To simplify the description, I'm assuming we only have two streams: video and audio.

For the video stream, we have the following events :
- STREAM_START => stream->wait set to true
- NEW_SEGMENT(1) => blocked waiting in gst_stream_synchronizer_wait
- FLUSH_START => unblocked
- FLUSH_STOP => stream->wait reset to false
- NEW_SEGMENT(2) => not waiting, since stream->wait is false

Then for the audio stream, we have the following events :
- STREAM_START => stream->wait set to true
- NEW_SEGMENT(2) => blocked waiting in gst_stream_synchronizer_wait for ever.

Note: The first NEW_SEGMENT event and the FLUSH_START, FLUSH_STOP events of the audio stream
are dropped before being received by the streamsynchronizer element, because the decodebin audio pad src
is not yet linked to the playsink audio pad sink.

To fix this deadlock, we don't reset stream->wait to false in the FLUSH_STOP event when it is not
waiting for the EOS of the other streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6887>
2024-05-23 17:51:02 +01:00
He Junyan
a084bedd58 vabaseenc: delete the useless frame counter fields
They are used to calculate the PTS and DTS before, no usage now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6786>
2024-05-23 16:47:55 +01:00
He Junyan
3c26c0bc33 vabaseenc: Do not set the min_pts
Because all the va encoders improved their PTS/DTS algorithm, now
it is impossible to generate minus DTS. So no underflow will happen
and we do not need to set a 1000 hour offset now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6786>
2024-05-23 16:47:48 +01:00
Backport Bot
607dadbc53 Revert "tests/d3d11: add concurrency test for gstd3d11device"
This reverts commit 203f6b00d4.

Revert test that was added with reverted commit as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6907>
2024-05-23 16:37:01 +01:00
Seungha Yang
a648f0da81 Revert "d3d11device: protect device_lock vs device_new"
This reverts commit 0cb12db96c
(i.e. commit 926d5366b9 on main).

AcquireSRWLockExclusive seems to be acquiring lock in exclusive mode
when the same lock is combined with write lock access.
Reverting the commit because of this is unexpected behavior
and unavoidable OS bug.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6907>
2024-05-23 16:36:45 +01:00
He Junyan
7526919fb3 vah265enc: Let FORCE_KEYFRAME be IDR frame rather than just I frame
The FORCE_KEYFRAME frame which has GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME
bit set should be the sync point. So we should let it be an IDR frame to begin
a new GOP, rather than just promote it to an I frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6857>
2024-05-23 16:29:47 +01:00
He Junyan
5e24324f4f vah264enc: Let FORCE_KEYFRAME be IDR frame rather than just I frame
The FORCE_KEYFRAME frame which has GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME
bit set should be the sync point. So we should let it be an IDR frame to begin
a new GOP, rather than just promote it to an I frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6857>
2024-05-23 16:29:47 +01:00
He Junyan
af88e87eec examples: vaenc-dynamic: support force key frame setting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6857>
2024-05-23 16:29:40 +01:00
He Junyan
77455b50d3 vah265enc: Fix a memory leak when destroying the object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6913>
2024-05-23 16:24:13 +01:00
He Junyan
2dd3ce721a vah265enc: Use a FIFO queue to generate DTS
The base parse will infer the DTS by itself, so we need to make DTS
offset before PTS in order to avoid DTS bigger than PTS. We now use
a FIFO queue to store all PTS and assign it to DTS by an offset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6913>
2024-05-23 16:24:13 +01:00
He Junyan
09d07f13f9 vah264enc: Use a FIFO queue to generate DTS
The base parse will infer the DTS by itself, so we need to make DTS
offset before PTS in order to avoid DTS bigger than PTS. We now use
a FIFO queue to store all PTS and assign it to DTS by an offset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6913>
2024-05-23 16:24:13 +01:00
Seungha Yang
9a9650aeb2 cudamemory: Fix offset of subsampled planar formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6910>
2024-05-23 13:52:28 +01:00
Sebastian Dröge
620d5cb5d6 av1enc: Use 1/90000 as timebase and don't use the framerate at all
This mirrors the behaviour in vp8enc / vp9enc and is generally more
useful than using any framerate from the caps as it provides some degree
of accuracy if the stream doesn't have timestamps perfectly according to
the framerate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6909>
2024-05-23 11:10:14 +00:00
Sebastian Dröge
afe74a0181 av1enc: Fix last timestamp tracking so it actually works
This behaves exactly the same as in vp8enc / vp9enc now.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6909>
2024-05-23 11:10:14 +00:00
Sebastian Dröge
36a2eb0f03 gtk: Fail initialization of the sink if GTK4 is already initialized in the same process
Initializing GTK3 and GTK4 in the same process does not work and is not
supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6905>
2024-05-23 10:30:47 +01:00
Piotr Brzeziński
cdaf50de8f osxaudio: Avoid using private APIs on iOS
Turns out AudioConvertHostTimeToNanos and AudioGetCurrentHostTime are macOS-only APIs, which prevents apps using
GStreamer on iOS from being accepted into App Store.

This commit replaces those functions with a manual version of what they do - mach_absolute_time() for the current time,
and data from mach_timebase_info() at the beginning to convert host timestamps to nanoseconds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6899>
2024-05-22 11:31:32 +01:00
Jordan Petridis
47afb4564b tests/check: Avoid using "bool" for the variable name
Glib 2.82 will be aliasing [1] TRUE and FALSE to the C99
definitions, which means it will be including stdbool.h

As such, having variables named "bool" causes issues
since it conflicts with the symbol defined in stdbool.h

[1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4001

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6896>
2024-05-22 00:18:51 +01:00
Joshua Breeden
d5f3b77e50 videotestsrc: add mutex around cache buffer to prevent race condition
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6889>
2024-05-21 14:48:14 +01:00
Seungha Yang
1d2a0d75a0 filesrc: Don't abort on _get_osfhandle()
_get_osfhandle() expects valid fd and CRT will abort program
if given paramerter is invalid. The fd can be invalidated
in various way, file was deleted by other process after
we open a file. To avoid it, our own exception
handler must be installed so that _get_osfhandle() can return
INVALID_HANDLE_VALUE if fd is invalid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6879>
2024-05-20 11:02:44 +01:00
Brad Reitmeyer
7f94a1e3b2 nvcodec: Accept progressive-high profiles for h264
Videos using progressive-high used to work on 1.16 before the parser added progressive-high. It looks like partial
support was added to nvcodec in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1634
but accidentally ommited gstnvh264dec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6873>
2024-05-17 13:14:23 +01:00
Seungha Yang
329ba08665 decodebin3: Fix caps and stream leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6866>
2024-05-16 12:49:16 +01:00
Sebastian Dröge
063efae0be mpegtsmux: Allow pads to have no caps until they receive their first buffer
If the muxer times out because of the latency deadline it can happen
that some pads have no caps yet. In that case skip creation of streams
for these pads and create updated section tables once the first buffer
arrives later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6859>
2024-05-15 20:31:36 +01:00
Sebastian Dröge
24be7b5c58 mpegtsmux: Correctly time out and mux anyway in live pipelines
This makes sure that for sparse streams (KLV, DVB subtitles, ...) the
muxer does not wait until the next buffer is available for them but
times out on the latency deadline and outputs data.

For non-live pipelines it will still be necessary for upstream to
correctly produce gap events for sparse streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6859>
2024-05-15 20:31:36 +01:00
Alexander Slobodeniuk
3b595479f9 systemclock: fix usage of __STDC_NO_ATOMICS__
__STDC_NO_ATOMICS doesn't seem to exist. In fact the only compiler
I've found that sets any of those is msvc, but it sets
__STDC_NO_ATOMICS__, not __STDC_NO_ATOMICS.

__STDC_NO_ATOMICS__ is the one documented by C11 standard.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6856>
2024-05-15 15:09:34 +01:00
Edward Hervey
765f8767ef avvidec: Fix dropping wrong "ghost" frames
This fixes the code regarding dropping "ghost frames", that is to say input
frames which ended up not producing any decoded frame.

The iteration itself makes sense.. but it was stopping at the "input" frame and
not the decoded frame we just got back.

When dealing with I-frame codecs, ffmpeg will decode frames in separate frames,
so there is no guarantee that they are decoding in order.

Fixes playback issues with such codecs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6845>
2024-05-14 13:59:35 +01:00
Seungha Yang
38cbc51822 nvencoder: Fix maximum QP value setting
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6832>
2024-05-12 23:53:10 +01:00
Sebastian Dröge
8e3b2121bb audioconvert: Add test for 96 channel conversion
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6828>
2024-05-12 11:06:15 +01:00
Sebastian Dröge
d2e8b4db07 level: Don't post a message on EOS without a valid audio info
If EOS is received before caps, e.g. because of an error, then rate and
number of channels would be 0 and some divisions by zero would happen.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6828>
2024-05-12 11:06:15 +01:00
Sebastian Dröge
d05a8516a7 audioconvert: Support converting >64 channels
There's nothing requiring <= 64 channels except for getting the reorder
map and creating a channel mixing matrix, but those won't be possible to
call anyway as channel positions can only express up to 64 channels.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6828>
2024-05-12 11:06:15 +01:00
Robert Mader
e869185287 v4l2codecs: decoder: Reorder caps to prefer DMA_DRM ones
Certain V4L2 fourccs don't (yet) have DRM counter parts, in which case
we can't create DMA_DRM caps for them. This is usually the case for
specific tilings, which are represented as modifiers for DMA formats.

While using these tilings is generally preferable - because of e.g.
lower memory usage - it can result in additional conversion steps when
interacting with DMA based APIs such as GL, Vulkan or KMS. In such cases
using a DMA compatible format usually ends up being the better option.

Before the addition of DMA_DRM caps, this was what playbin3 ended up
requesting in various cases - e.g. prefering NV12 over NV12_4L4 - but
the addition of DMA_DRM caps seems to confuse the selection logic.

As a simple and quite robust solution, assume that peers supporting
DMA_DRM caps always prefer these and reorder the caps accordingly.

In the future we plan to have a translation layer for cases where
there is a matching fourcc+modifier pair for a V4L2 fourcc, ensuring
optimal results.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6824>
2024-05-09 23:46:16 +01:00
Sebastian Dröge
fb8e2c60a2 play: Mention that gst_play_new() also initialized GStreamer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6821>
2024-05-09 12:02:06 +01:00
Sebastian Dröge
f67559716e play: Initialize debug category and error quark in class_init
Doing it in gst_play_new() means that bindings that directly call
g_object_new() with the GType wouldn't end up initializing both.
This affects at least the Python and GJS bindings.

gst_init() is nonetheless only called from gst_play_new() once because
calling it from class_init would likely lead to problems as that's
called from somewhere in the middle of GObject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6821>
2024-05-09 12:02:06 +01:00
Emil Pettersson
6f508684e7 vtdec: Fix deadlock when negotiating format change
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6817>
2024-05-08 09:13:50 +01:00
Piotr Brzeziński
fabd09bd93 audiovisualizer: Add simple pipeline unit test
Creates pipelines with each of our visualizer elements and runs them with 20 buffers from audiotestsrc.
Added after a completely broken (segfaulting) synaescope went unnoticed for a while.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6814>
2024-05-07 18:52:00 +01:00
Bill Nottingham
59dfc54b61 pbutils: fix visualization plugins
inbuf is persistent, GST_BUFFER_COPY_MEMORY's append behavior is
not what we want.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6814>
2024-05-07 18:52:00 +01:00
Matthew Waters
7bebb24880 webrtc: request-aux-sender, only sink floating refs
Don't add an extra ref if non-floating as that ref will never be
unreffed.

gst_bin_add() is transfer floating (alias to transfer none).

Fixes a leak when a non-floating ref was provided as a return value in
the request-aux-sender signal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6809>
2024-05-06 16:12:59 +01:00
Sebastian Dröge
e933c7a7e3 qtdemux: Use G_GUINT64_CONSTANT when creating test caps
Otherwise this fails on 32 bit platforms.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6806>
2024-05-06 11:28:07 +01:00
Seungha Yang
5e4a76fdf1 d3dshader: Fix gamma and primaries conversion pixel shader
Fixing regression introduced by the commit of f52ecb9607

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6803>
2024-05-05 18:20:03 +09:00
Seungha Yang
e2679face1 qsvh264dec,qsvh265dec: Fix nalu leaks
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3514
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6790>
2024-05-01 13:43:29 +00:00
Piotr Brzeziński
3d39c3ce00 vtdec: Fix PAUSED->READY deadlock when output loop is running
Makes sure the GST_PAD_STREAM_LOCK is not taken when pad is being deactivated.
The lack of this was causing deadlocks when stopping the pipeline right after producing first buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6788>
2024-05-01 12:54:23 +00:00
Stéphane Cerveau
9db0b83aa1 vkh26xdec: Fix stop memory leak
The h26xdecoder 'stop' method was not called
as the vulkan h26x class rewires the video decoder
'stop' base method to its own one.

It was causing some memory leaks such as dangling parser
and dpb in h26xdecoder base class.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6787>
2024-05-01 11:24:25 +01:00
Edward Hervey
51fd0f16a3 ges-pipeline: Configure encodebin before linking
Modifying the `avoid-reencoding` property of `encodebin` could potentially cause
it to reconfigure itself, in which case the source pad will be removed and then
re-added.

Therefore set that property *before* attempting to link to that pad.

Fixes smart-render

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6785>
2024-04-30 21:59:31 +00:00
Shengqi Yu
f74bdaf4d5 glmixer: Add GL_SYNC_META option to bufferpool
when pipline is
glvideomixerelement->glcolorconvertelement->gldownloadelement and
glcolorconvertelement is not passthrough, the gl bufferpool between
glvideomixerelement and glcolorconvertelement will not add gl sync meta
during allocating buffer. This will cause that glcolorconvert's inbuf
has no sync meta to wait for.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6784>
2024-04-30 18:07:45 +01:00
Tim-Philipp Müller
204ba57e81 Back to development after 1.24.3
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6772>
2024-04-30 00:36:59 +01:00
Tim-Philipp Müller
da69285863 Release 1.24.3 2024-04-30 00:15:23 +01:00
Tim-Philipp Müller
02c3bb124e unixfd: disable flaky test_unixfd_segment for now
It's a problem with the test, and a proper fix might
require new API, so just disable it for now.
2024-04-30 00:15:12 +01:00
Sebastian Dröge
e33578a3c2 exiftag: Prevent integer overflows and out of bounds reads when handling undefined tags
Fixes ZDI-CAN-23896
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3483

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6768>
2024-04-29 19:54:45 +01:00
He Junyan
ca49577cbb vah265enc: Set the correct buffer flag for output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6764>
2024-04-29 17:27:41 +00:00
He Junyan
bda1aa3559 vah264enc: Set the correct buffer flag for output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6764>
2024-04-29 17:27:41 +00:00
Seungha Yang
dc8d09d6d2 vabaseenc: Fix frame leak on error path
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6764>
2024-04-29 17:27:41 +00:00
He Junyan
8a76079e17 vah265enc: Do not touch the PTS of output frame
1. The PTS of all frames should not be changed.
2. Just update the DTS based on the PTS. For the frame which is not
   reordered, the DTS is equal to PTS. For frame which is reordered,
   the DTS is equal to previous DTS. For example:
   Input: F0[D0, P0] -- F1[D1, P1] -- F2[D2, P2] -- F3[D3, P3]
   Output: F0[I, D0, P0] -- F3[P, D0, P3] -- F1[B, D1, P1] -- F2[B, D2, P2]

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6764>
2024-04-29 17:27:41 +00:00
He Junyan
a9551fec9a vah264enc: Do not touch the PTS of output frame
1. The PTS of all frames should not be changed.
2. Just update the DTS based on the PTS. For the frame which is not
   reordered, the DTS is equal to PTS. For frame which is reordered,
   the DTS is equal to previous DTS. For example:
   Input: F0[D0, P0] -- F1[D1, P1] -- F2[D2, P2] -- F3[D3, P3]
   Output: F0[I, D0, P0] -- F3[P, D0, P3] -- F1[B, D1, P1] -- F2[B, D2, P2]

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6764>
2024-04-29 17:27:41 +00:00
William Wedler
782f0c885b fix: qmlglsink: video content resizes to new item size
Mark geometry dirty when the item rectangle changes in the
QtGLVideoItem::updatePaintNode method. This allows changes in the bounding
rectangle to be applied to the scene graph geometry node.

Fixes #3493

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6759>
2024-04-29 16:36:16 +00:00
William Wedler
57446d1252 fix: qml6glsink: video content resizes to new item size
Mark geometry dirty when the item rectangle changes in the
QtGLVideoItem::updatePaintNode method. This allows changes in the bounding
rectangle to be applied to the scene graph geometry node.

Fixes #3493

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6759>
2024-04-29 16:36:16 +00:00
Tim Blechmann
d829ff510c v4l2: silence valgrind warning
Valgrind complains about uninitialized memory used in an ioctl

    Syscall param ioctl(VKI_V4L2_G_TUNER).reserved points to uninitialised byte(s)
       at 0x719294F: ioctl (ioctl.c:36)
       by 0x3126A817: gst_v4l2_fill_lists (v4l2_calls.c:185)
       by 0x3126A817: gst_v4l2_open (v4l2_calls.c:589)
       by 0x3123F1C2: gst_v4l2_device_provider_probe_device (gstv4l2deviceprovider.c:122)
       by 0x3123F648: gst_v4l2_device_provider_device_from_udev (gstv4l2deviceprovider.c:301)
       by 0x3123F998: provider_thread (gstv4l2deviceprovider.c:395)
       by 0x796FA50: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
       by 0x710CAC2: start_thread (pthread_create.c:442)
       by 0x719DA03: clone (clone.S:100)
     Address 0x44008a34 is on thread 11's stack
     in frame #1, created by gst_v4l2_open (v4l2_calls.c:524)
     Uninitialised value was created by a stack allocation
       at 0x3126A024: gst_v4l2_open (v4l2_calls.c:524)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6761>
2024-04-29 15:35:34 +01:00
Seungha Yang
4a7f3d0b75 d3d12decoder: Fix d3d12 resource copy
It was copying to self resource

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6755>
2024-04-29 17:44:56 +09:00
He Junyan
17ede2149b vabaseenc: No need to call _finish_subframe()
After vaav1enc is aligned to TU, there is no case that generates
multi output for one input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6751>
2024-04-28 11:25:54 +01:00
He Junyan
c63bcb1c2a vaav1enc: Set the correct buffer flag for output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6751>
2024-04-28 11:25:24 +01:00
He Junyan
8c4aa7067d vaav1enc: Do not change the PTS/DTS of output frames
The AV1 encoder does not reorder the frames, so there is no need
to change the timestamp related meta data of output frames, just
inheriting it from the input frames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6751>
2024-04-28 11:25:13 +01:00
He Junyan
7ec4a7cc01 vaav1enc: Change the alignment of output to "tu"
The current output alignment is "frame", which may cause some issues
for PTS and DTS calculation. We now change the alignment to "tu",
and this is also the alignment mode for av1enc and svtav1enc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6751>
2024-04-28 11:25:05 +01:00
Nirbheek Chauhan
1bff1bb801 meson: Fix Python library searching on Windows
Neither LIBDIR nor LIBPL are set with the native windows Python
(unlike MSYS2), so we need to use `prefix` which takes us to the
rootdir of the Python installation.

The name is also different: it's python312.dll, not python3.12.dll.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6748>
2024-04-27 10:23:40 +00:00
Nirbheek Chauhan
7d04276c5b meson: Fix Python library name fetching on Windows
`python.get_variable('FOO', [])` becomes `python.get_variable('FOO')`
due to how Meson treats empty arrays in arguments, which breaks the
fallback feature of get_variable().

So we need to actually check whether the variable exists before trying
to fetch it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6748>
2024-04-27 10:23:40 +00:00
Xavier Claessens
839f9bbd18 unixfd: Close file descriptors on error
After calling g_unix_fd_list_steal_fds() and before calling
gst_fd_allocator_alloc(), we are responsible for closing those fds.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6747>
2024-04-27 10:41:46 +01:00
Xavier Claessens
e62adb4d12 unixfdsink: Take segment into account when converting timestamps
Also rename `calculate_timestamp()` to `to_monotonic()` and
`from_monotonic()` which better describe what it does.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6747>
2024-04-27 10:41:46 +01:00
Xavier Claessens
5593a3c698 unixfd: Allow sending buffers with no memories
There is no reason to not allow it, and it is useful for simple unit
test.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6747>
2024-04-27 10:41:46 +01:00
Víctor Manuel Jáquez Leal
b370afab76 vaallocator: disable derived all together for Mesa <23.3
First it derived mapping was disabled for P010 formats, but also there's an
issue with interlaced frames.

It would be possible to disable derived mapping only for interlaced (H.264
decoder and vadeinterlace) but it would spread the hacks along the code. It's
simpler and contained to disable derived completely for Mesa <23.3

Fixes: #3450
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6746>
2024-04-26 17:35:17 +00:00
Víctor Manuel Jáquez Leal
3dd291b99c va: videoformat: use video library to get DRM fourcc
Instead of duplicating the GStreamer format to DRM fourcc mapping, this patch
uses the GstVideo library helpers. This duplicates the big O of looking for,
since the two lists are traversed, but it's less error prone.

Partially reverts commit 547f3e8622.

Fixes: #3354
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6744>
2024-04-26 17:20:31 +01:00
Edward Hervey
7a0e52bb15 playbin3: Handle combiner update in case of errors
The assertion that was present before is a bit too harsh, since there is now
a (understandable) use-case where this could happen.

In gapless use-case, with two files containing the same type (ex:audio). The
first one *does* expose a collection with an audio stream, but decoding
fails (for whatever reason).

That would cause us to have configured a audio combiner, which was never
used (i.e. not active).

Then the second file plays and we (wrongly) assume it should be activated
... whereas the combiner was indeed present.

Demote the assertion to a warning and properly handle it

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6742>
2024-04-26 13:28:06 +00:00
Tim Blechmann
aa982bfa15 soup: fix thread name
thread names should be below 16char, otherwise they won't be shown on
linux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6739>
2024-04-26 12:36:55 +01:00
Hou Qi
fcd0c76e12 wlwindow: free staged buffer when do gst_wl_window_finalize
If waylandsink received buffer rate is high which causes frame
drop, the cached staged buffer will be replaced when next buffer
needs to be rendered and be freed after redraw. But there is
chance to get memory leak if ended without redraw. So need to
free staged buffer when do gst_wl_window_finalize().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6735>
2024-04-26 01:58:09 +01:00
Edward Hervey
a6732946d5 validate/flvdemux: Stop spamming audio/video on test
Use the sinks specified by the runner

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6728>
2024-04-24 10:59:33 +01:00
Haihua Hu
420e79e00b wlwindow: clear configure mutex and cond when finalize
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6724>
2024-04-23 18:57:19 +01:00
Edward Hervey
8db552f404 mpegtsbase: Fix Program equality check
There was an issue with this equality check, which was to figure out what to do
with PCR pids (whether they were part of the streams present or not) and whether
we ignore PCR or not.

Turns out ... we already took care of that further up in the function.

The length check can be simplified by just checking whether the length of
the *original* PMT and the new PMT are identical. Since we don't store "magic"
PCR streams in those, we can just use them as-is.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6719>
2024-04-23 12:49:39 +00:00
Seungha Yang
06e955f94e d3d12decoder: Lock DPB while building command
Since DPB resource can be modified in output thread, protect
it when building command list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6717>
2024-04-23 12:26:07 +01:00
Seungha Yang
d22fe06234 d3d12decoder: Hold reference pictures in fence data
Keep reference pictures alive during executing decoding commands

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6717>
2024-04-23 12:26:07 +01:00
Seungha Yang
e102560883 d3d12vp9dec: Disallow resolution change to larger size on non-keyframe
Intel GPU seems to be crashing if the case happens.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6717>
2024-04-23 12:26:06 +01:00
Edward Hervey
b02f41441c decodebin3: Remove custom stream-start field if present
This field is added by urisourcebin so that we can avoid double-parsing. It's no
longer needed after.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6716>
2024-04-23 11:17:32 +01:00
Edward Hervey
ec2af45402 urisourcebin2: Adaptive demuxers don't require another parsebin
By setting the same field on the GST_EVENT_STREAM_START decodebin3 will be able
to avoid plugging in an extra parsebin

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6716>
2024-04-23 11:17:32 +01:00
Edward Hervey
e534f681b4 adaptivedemux2: Answer GST_QUERY_CAPS
If we have a generic caps, we can answer the query.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6716>
2024-04-23 11:17:32 +01:00
Edward Hervey
19e613d889 adaptivedemux2: Refactor output slot creation
Set as much information as possible on the slot (including the associated
track) *before* the associated source pad is added to the element.

We need this so that incoming event/queries can be replied to if they are
received when adding the pad

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6716>
2024-04-23 11:17:32 +01:00
Seungha Yang
9daa541816 d3d12decoder: Fix potential use after free
A DPB buffer held by codec picture object may not be writable
at the moment, then gst_buffer_make_writable() will unref passed buffer.

Specifically, the use after free or double free can happen if:
* Crop meta of buffer copy is required because of non-zero
  top-left crop position
* zero-copy is possible with crop meta
* A picture was duplicated, interlaced h264 stream for example

Interlaced h264 stream with non-zero top-left crop position
is not very common but it's possible configuration in theory.

Thus gst_buffer_make_writable() should be called with
GstVideoCodecFrame.output_buffer directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6710>
2024-04-22 15:14:13 +01:00
Seungha Yang
72ffee6355 d3d11decoder: Fix potential use after free
A DPB buffer held by codec picture object may not be writable
at the moment, then gst_buffer_make_writable() will unref passed buffer.

Specifically, the use after free or double free can happen if:
* Crop meta of buffer copy is required because of non-zero
  top-left crop position
* zero-copy is possible with crop meta
* A picture was duplicated, interlaced h264 stream for example

Interlaced h264 stream with non-zero top-left crop position
is not very common but it's possible configuration in theory.

Thus gst_buffer_make_writable() should be called with
GstVideoCodecFrame.output_buffer directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6710>
2024-04-22 15:14:13 +01:00
Edward Hervey
228c75a336 tsdemux: Disable smart program update
The goal of this code was, for programs which were updates (i.e. adding/removing
streams but not completely changing) to allow dynamic addition/removal of
streams without completely removing everything.

But this wasn't 100% tested and there are a bunch of issues which make it fail
in plenty of ways.

For now disable that feature and force the legacy "add all pads again and then
remove old ones" behaviour to make it switch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6708>
2024-04-22 13:45:17 +01:00
Seungha Yang
210a225ad2 mediafoundation: Fix infinite loop in device provider
Initialize source state with GST_MF_DEVICE_NOT_FOUND to terminate
loop immediately if no available capture device is available

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3492
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6707>
2024-04-21 16:56:39 +01:00
Seungha Yang
180cf124a7 d3d12videosink: Disconnect window's signal on dispose
Same as the commit of 7b69d1758f
but for d3d12videosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6700>
2024-04-20 23:47:14 +00:00
Seungha Yang
e0143754ad d3d12videosink: Handle external HWND's mouse/keyboard events
OS will not propagate the event to child HWND if it's handled by
the parent. Thus, navigation event should be handled by parent HWND's
event handler.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6700>
2024-04-20 23:47:14 +00:00
Alexander Slobodeniuk
0cb12db96c d3d11device: protect device_lock vs device_new
It seems that when D3D11CreateDevice collides in time
with other D3D11 calls, in particular the proccess of
creating a shader, it can corrupt the memory in the driver.
D3D11 spec doesn't seem to require any thread safety from
D3D11CreateDevice. Following MSDN, it is supposed to be called
in the beginning of the proccess, while GStreamer calls it with each
new pipeline.
Such crashes in the driver were frequently reproducing on the
Intel UHD 630 machine.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6702>
2024-04-20 20:49:34 +00:00
Alexander Slobodeniuk
203f6b00d4 tests/d3d11: add concurrency test for gstd3d11device
We suspect that it's not thread safe to just create and
destroy the device from any thread, particularly because
of D3D11CreateDevice, that is not documented as thread-safe.
While D3D11CreateDevice is usually protected from outside
by the gst_d3d11_ensure_element_data, it still can cross
with the Release() method of another device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6702>
2024-04-20 20:49:34 +00:00
Elliot Chen
57b1db4a02 gstplay: query duration again if previous query failed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6701>
2024-04-20 19:29:10 +01:00
Hou Qi
21d6f6d783 waylandsink: config buffer pool with query size when propose_allocation
If propose_allocation comes before set_caps, self->video_info
has not been extracted from caps and self->video_info.size is 0.
It causes buffer pool fail to set config . So need to use info
size got from query instead when propose_allocation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6687>
2024-04-19 00:46:53 +01:00