Commit graph

116505 commits

Author SHA1 Message Date
Sebastian Dröge
229b727017 aggregator: Allow passing unparented pads to gst_aggregator_pad_is_inactive()
It's very difficult to ensure that a pad is still child of the
aggregator during aggregation, so simply consider unparented pads as
inactive instead of asserting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5553>
2023-10-25 14:58:06 +01:00
Sebastian Dröge
16e7f08597 aggregator: Also release clipped buffer when releasing an aggregator pad
Instead of waiting until the pad is actually finalized.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5553>
2023-10-25 14:58:06 +01:00
Sebastian Dröge
0596d637e2 aggregator: Take pad lock while releasing buffers when removing pads
Accessing the buffers in all other places requires the pad lock and not
taking it here can cause access to already freed buffers if there's
concurrent access from another thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5553>
2023-10-25 14:58:06 +01:00
Sebastian Dröge
8419c1e6dc audioaggregator: Make access to the pad list thread-safe while mixing
When mixing every single buffer the object lock is shortly released and
acquired again. In the meantime the pad list can become invalid because
a pad was removed or added, and equally the current pad might as well
have been finalized in the meantime.

To get around that, take a snapshot of all sinkpads before mixing and
work with that list of pads.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5553>
2023-10-25 14:58:06 +01:00
Jan Schmidt
970eb963c7 glfiter: Protect GstGLContext access
The propose and decide allocation vfuncs are called directly from
basetransform and need to use the locked accessor function for
retrieving a reliable reference to the GstGLContext (if available)

Fixes spurious crashes on shutdown during pad reconfiguration

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5518>
2023-10-20 11:02:02 +01:00
Jan Alexander Steffens (heftig)
4299be47ab tsmux: Fix default get_es_descrs_func
`tsmux_stream_default_get_es_descrs` is missing the `user_data`
parameter and shouldn't be cast to `TsMuxStreamGetESDescriptorsFunc`.

Prefer not casting at all to make sure we don't miss such an issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
da02db0d95 tsmux: Fix default new_stream_func
`tsmux_stream_new` is missing the `user_data` parameter and shouldn't be
cast to `TsMuxNewStreamFunc`.

Prefer not casting at all to make sure we don't miss such an issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
2d938d37a6 tsmux: Add missing include
We need `GstMpegtsPMTStream` here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
77429e4096 tsmux: Simplify tsmux_section_write_packet
- Don't try to make the parameters match `GHFunc`. Use a dedicated
  callback for `g_hash_table_foreach`.
- Don't try to be clever with buffer memories. We're allocating a full
  packet anyway, might as well memcpy and save on a lot of complexity.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
c205086f2b tsmux: tsmux_packet_out should always consume its buffer
Consuming the buffer only when successful is an antipattern and easily
leads to leaks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
6198c4b8a1 tsmux: Don't memset in pad_stream when writing a PCR packet
tsmux_write_ts_header will write a stuffing adaptation field, so we
don't need to prefill the buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
4e9cb5d8eb tsmux: Move out parameters of tsmux_write_ts_header
Move them to the end of the parameter list and also allow passing NULLs
to ignore the payload information, but assert that the payload length is
zero in this case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Jan Alexander Steffens (heftig)
a65035ac25 tsmux: Fix two more uses of gst_buffer_map
The buffers should be used for writing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
2023-10-20 08:53:19 +00:00
Matthias Fuchs
7c49ce1c21 qmlglsrc: sync on the streaming thread
After rendering a QML scene the qmlglsrc element copies the contents of
the scene to a GStreamer buffer. This happens on the Qt render thread.
Then it attaches a sync point to the destination buffer. This sync point
must be awaited by other threads which use the buffer later on. The
current implementation relies on the downstream elements to wait for the
sync point. However, there are situation where this does not work. The
GstBaseTransform e.g. copies the buffer metadata (which overwrites the
sync point without waiting for it) *before* waiting for the sync point.

This commit waits for the sync point inside the qmlglsrc element before
sending it downstream. The wait command is issued on the streaming
thread with the pipeline OpenGL context, i.e. it will synchronize with
the GStreamer OpenGL thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5515>
2023-10-20 00:36:26 +00:00
Jan Alexander Steffens (heftig)
61c62919a7 tsmux: Fix error handling in pad_stream
Don't leak the map or the buffer if we encounter an error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5513>
2023-10-19 23:22:33 +01:00
Jan Alexander Steffens (heftig)
5e78ef7a10 tsmux: Fill padding packets with stuffing bytes
Instead of leaving it uncleared, emitting probably old packet data but
potentially also random or sensitive application data.

Also fix the mapping mode.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5513>
2023-10-19 23:22:33 +01:00
Nicolas Dufresne
a92050493a v4l2codecs: h265: Fix entry_point_offsets array leak
This array was being leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5503>
2023-10-18 00:17:54 +00:00
Detlev Casanova
99435dc499 codecs: h265: Do not free slice header before using it
The v4l2codecs H.265 decoder uses the
GstH265SliceHdr::entry_point_offset_minus1 array so make sure that it is not
freed before decoding the frame.

Before this patch, some H.265 input would segfault in
gst_v4l2_codec_h265_dec_fill_slice_params() when executing the line:

guint32 entry_point_offset = slice_hdr->entry_point_offset_minus1[i] + 1;

Make sure that the array is not freed before using it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5503>
2023-10-18 00:17:54 +00:00
Doug Nazar
b2c7e8549c rtspclientsink: Don't leak previous server_ip
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5502>
2023-10-17 20:19:00 +01:00
Rahul T R
a7bc4ff3bb kmssink: Add TIDSS auto-detection
Add Texas Instruments TIDSS display controller into list of
auto-detected modules.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5486>
2023-10-15 23:17:29 +00:00
Stéphane Cerveau
87292c6026 imagesequencesrc: fix regular image deadlock
With one regular image file path provided (without %05d),
the element was stuck in a dead loop counting the frames:

gst_image_sequence_src_count_frames

This allows to display any image file out of the element
for a given number of buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5487>
2023-10-15 19:00:36 +01:00
Seungha Yang
3b3649353c d3d11converter: Fix 10/12bits planar output
Simple division can result in 10/12bits overflow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5484>
2023-10-15 20:31:06 +09:00
Seungha Yang
4b932ee989 d3d11videosink: Fix rendering with initial fullscreen state
Change fullscreen mode once the swapchain is fully configured

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5466>
2023-10-12 00:24:58 +00:00
Seungha Yang
07a2f7ebcc d3d11videosink: Fix toggling between fullscreen and maximized
Use GetWindowPlacement() and SetWindowPlacement() APIs
to remember and restore window status, such as maximized, position,
restore position, etc.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3016
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5466>
2023-10-12 00:24:58 +00:00
Guillaume Desmottes
81178eab42 flvmux: set the src segment position as running time
We were already converting the pad last timestamp to running time but
not the segment position.
This segment position is used by gst_aggregator_simple_get_next_time()
to compute the waiting time when aggregating.

Those waiting times were wrong in my live pipeline using the system
clock, resulting in the aggregator to never wait at all.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5465>
2023-10-12 00:28:50 +01:00
Nicolas Dufresne
f223ea076d v4l2: Fix tiled formats stride conversion
While adding arbitrary tile support, a round up operation was badly
converter. This caused the Y component of the stride to be 0. This
eventually lead to a crash in glupoad preceded by the following
assertion.

  gst_gl_buffer_allocation_params_new: assertion 'alloc_size > 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5463>
2023-10-11 16:48:51 +01:00
Nicolas Dufresne
c63e56fe63 v4l2codecs: Fix tiled formats stride conversion
While adding arbitrary tile support, a round up operation was badly
converter. This caused the Y component of the stride to be 0. This
eventually lead to a crash in glupoad preceded by the following
assertion.

  gst_gl_buffer_allocation_params_new: assertion 'alloc_size > 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5463>
2023-10-11 16:48:50 +01:00
Piotr Brzeziński
b5ca7eba4e glfilter: Only add parent meta if inbuf != outbuf
This was causing a memory leak in cases like `gltestsrc ! gltransformation scale-x=0.5 ! glimagesink`.
Parent meta was being added in assumption that those buffers are different, which was not the case here,
creating a reference loop and never freeing the buffer.

Co-authored-by: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5453>
2023-10-10 10:13:15 +01:00
Seungha Yang
019430949c decklink: Fix broken COM string conversion
WideCharToMultiByte return is the string length without null terminate
character if passed "cchWideChar" does not include the null terminate
character size. Instead of passing the exact string length, pass -1 so that
the API can understand the input string is null terminated already and
returned value from the API includes the character.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3023
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5446>
2023-10-09 15:34:44 +01:00
James Oliver
51e6209d1c nvh265encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh265enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5439>
2023-10-05 12:20:17 +01:00
James Oliver
23aa3907f5 nvh264encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh264enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5439>
2023-10-05 12:20:17 +01:00
Sebastian Dröge
10d42caef2 flacenc: Correctly handle up to 255 cue entries
The counter was using a signed 8 bit integer, which was overflowing
after 127 entries. That was then passed as an unsigned 32 bit integer to
libflac, which caused it to be converted to a huge unsigned number.
That then caused an invalid memory access inside libflac.

As a bonus, signed integer overflow is undefined behaviour.

Instead, use an unsigned 8 bit integer. Once this overflows the existing
code already catches it and stops adding the cue. While FLAC__metadata_object_cuesheet_insert_track()
takes an unsigned 32 bit integer for the track number, FLAC__StreamMetadata_CueSheet_Track is
limiting it to an unsigned 8 bit integer.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5436>
2023-10-04 19:06:33 +01:00
Philippe Normand
4311de2be0 interaudiosink: Ensure adapters don't store buffers with audio meta
The interaudiosrc might take buffers of different sizes from the audio adapter,
so keeping metas consistency would be an issue. So the sink now strips the audio
metas away and the src adds them back (for non-interleaved layouts only) when
taking buffers from the adapter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5416>
2023-09-28 15:14:38 +02:00
Philippe Normand
acd4202bc0 interaudiosrc: Add audio meta to buffers containing non-interleaved samples
Without this a downstream audioconverter wouldn't be able to map the
GstAudioBuffer prior to conversion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5416>
2023-09-28 15:14:38 +02:00
Florian Zwoch
80d62798c3 adaptivedemux2: Call GTasks's return functions for blocking tasks
Gio/Task states the following:

If a GTask has been constructed and its callback set, it is an error to
not call g_task_return_*() on it. GLib will warn at runtime if this
happens (since 2.76).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5414>
2023-09-28 12:04:11 +02:00
Albert Sjölund
c53376cbfc souphttpsrc: Chain finalize call to parent
GstSoupSession finalize does not chain parent finalize,
causing it to leak memory, shown under g freeze notify.
In finalize method, ensure all branches call to parent
finalize.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5402>
2023-09-27 11:27:02 +00:00
Seungha Yang
c7f7c8e346 d3d11decoder: Fix crash on negotiate() when decoder is not configured
The negotiate() can be called by GstVideoDecoder baseclass on GAP event,
and decoder helper object might not be configured at the time
when negotiate() is called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5401>
2023-09-27 12:29:34 +02:00
Hou Qi
ca2f7a4254 v4l2videodec: Correctly free caps to avoid memory leak
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5388>
2023-09-25 14:57:09 +02:00
Eric
c7eed33e22 rtspconnection: Ignore trailing whitespace in headers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5382>
2023-09-22 14:31:38 +00:00
Michiel Westerbeek
b5f72d930b video-scaler, audio-resampler: downgrade 'can't find exact taps' to debug
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5381>
2023-09-22 15:47:39 +02:00
Tim-Philipp Müller
0cccb1c9a6 Back to development
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5371>
2023-09-20 19:41:00 +01:00
Tim-Philipp Müller
ddb4fbe431 Release 1.22.6 2023-09-20 18:10:57 +01:00
Sebastian Dröge
1edd1c38dc mxfdemux: Check number of channels for AES3 audio
Only up to 8 channels are allowed and using a higher number would cause
integer overflows when copying the data, and lead to out of bound
writes.

Also check that each buffer is at least 4 bytes long to avoid another
overflow.

Fixes ZDI-CAN-21661, CVE-2023-40475

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5365>
2023-09-20 15:14:27 +01:00
Sebastian Dröge
f73fc41f2c mxfdemux: Fix integer overflow causing out of bounds writes when handling invalid uncompressed video
Check ahead of time when parsing the track information whether
width, height and bpp are valid and usable without overflows.

Fixes ZDI-CAN-21660, CVE-2023-40474

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5365>
2023-09-20 15:14:27 +01:00
Nicolas Dufresne
fddda16622 h265parser: Fix possible overflow using max_sub_layers_minus1
This fixes a possible overflow that can be triggered by an invalid value of
max_sub_layers_minus1 being set in the bitstream. The bitstream uses 3 bits,
but the allowed range is 0 to 6 only.

Fixes ZDI-CAN-21768, CVE-2023-40476

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5366>
2023-09-20 11:19:06 +01:00
Hugues Fruchet
9394979d67 waylandsink: Fix cropping for video with non-square aspect ratio
Padding of unaligned content is still visible at right with some aspect-ratio.
Fix this by giving the original content resolution to wp_viewport_set_source()
instead of pixel aspect ratio scaled one.

Fixes !5259

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5360>
2023-09-20 01:32:29 +01:00
Olivier Blin
ea2e829452 pulsedeviceprovider: fix incorrect usage of GST_ELEMENT_ERROR
The provider is not a GStreamer element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5354>
2023-09-19 14:09:46 +01:00
Seungha Yang
0f18fe67be h264decoder: Update latency dynamically
The actual number of reorder frames is unknown
unless frame reordering is disabled
(e.g., POC type 2 or constrained-* profiles).
Also derived maximum DPB size or max_num_reorder_frames in VUI
is not the upper bound of output delay.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2702
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5341>
2023-09-19 09:55:47 +00:00
L. E. Segovia
ffa307e614 applemedia: Also fix inconsistent pixel format definition for NV12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5203>
2023-09-18 19:42:22 +00:00
L. E. Segovia
6cfb9b7c85 applemedia: Fix pixel format for I420
In Intel Macs, using full range 8-bit 4:2:0 YCbCr results in a failure on
initialization. I've validated this to be the correct pixel format with FFmpeg:

8653dcaf7d/libavutil/hwcontext_videotoolbox.c (L45)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5203>
2023-09-18 19:42:22 +00:00