Commit graph

116462 commits

Author SHA1 Message Date
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
Víctor Manuel Jáquez Leal
6efc79f5b6 va: Fix in error logs functions mismatches
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5340>
2023-09-16 17:57:33 +01:00
Matthew Waters
eef2348743 androidmedia/enc: handle codec-data before popping GstVideoCodecFrames
Issue is that when amc was producing a codec-data buffer, a
GstVideoCodecFrame was being popped off the internal queue.  This meant
that the codec-data was being associated with the first input frame and
the second (first encoded buffer) output buffer with the second input
frame.  At the end (assuming one input produces one output which seems
to hold in my testing and how the encoder is currently implemented)
there would be an input frame missing and would be pushed without any
timing information.  This would lead to e.g. muxers rejecting the buffer
without PTS and failing to mux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5335>
2023-09-16 01:40:17 +00:00
Matthew Waters
790e480c7f androidmedia/enc: add fixme log about partial frames
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5335>
2023-09-16 01:40:17 +00:00
Seungha Yang
737057c27a av1parser: Fix segmentation params update
Even if the segmentation feature value is not updated,
the parsed "segmentation_update_map" and "segmentation_temporal_update"
values should not be cleared as it's referenced during lower
level bitstream parsing. Also, don't use assert() in parser
unless it's clearly impossible condition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5336>
2023-09-16 01:37:26 +01:00
Jan Alexander Steffens (heftig)
3b46b162b7 rtmp2: Allow NULL flash version, omitting the field
rtmpsink omits it by default. Allow us to do the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5248>
2023-09-12 18:13:06 +00:00
Thomas Schneider
ae56da8447 androidmedia: fix hevc codec profile registration
Fix the codec registration logic such that all supported
profiles are available instead of just the first in the
list.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5313>
2023-09-12 17:27:44 +00:00
Nicolas Dufresne
92820a8cf2 v4l2: object: Handle video helper return value
gst_video_info_set_interlaced_format() can return an error if the
width/height causes integer overflow. Handle this case, so that we can
fail cleanly. This has been experienced while testing an in-progress
driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5319>
2023-09-12 17:44:44 +01:00
Nicolas Dufresne
bce3053598 v4l2: bufferpool: Avoid warnings on empty last buffer
Some drivers will push an buffer flagged LAST but empty. In decoder
case, this results in an "producing too many buffer" warning, even
though the result is entirely correct. Detect this case in order to
signal EOS earlier and avoid this warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5319>
2023-09-12 17:42:16 +01:00
Nicolas Dufresne
914e752015 v4l2: bufferpool: Do not resize compressed buffer
Avoid resizing compressed buffer to their maximum size. This fixes a
regression that caused valid but very large streams to be generated.

Fixes #2953

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5319>
2023-09-12 17:42:06 +01:00
Sebastian Dröge
2bd21a6f40 rtpjitterbuffer: Avoid integer overflow in max saveable packets calculation with negative offset
The timestamp offset can be negative, and it can be a bigger negative
number than the latency introduced by the rtpjitterbuffer so the overall
timeout offset can be negative.

Using the negative offset for calculating how many packets can still
arrive in time when encountering a lost packet in an equidistant stream
would then overflow and instead of considering fewer packets lost a lot
more packets are considered lost.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5318>
2023-09-12 10:40:33 +01:00
Akihiro Sagawa
edf37b216f codecparsers: Fix MPEG-1 aspect ratio table
The values defined in ISO/IEC 11172-2 are different from those used so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5300>
2023-09-07 21:41:06 +00:00
Nirbheek Chauhan
e07ea8abe3 macos-bison: Update to 3.8.2 and add an ARM64 build
Also includes a shell script to build bison and match pycodestyle.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5299>
2023-09-07 21:36:15 +00:00
Nicolas Dufresne
7851f98886 waylandsink: Crop surfaces to their display width height
Setting the surface source rectangle has been omitted so far. As a side effect
surface created with padded width/height are being scaled down. Fix this using
the viewporter source rectangle configuration. This can later be enhanced
to support crop meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5298>
2023-09-07 20:48:05 +00:00
Seungha Yang
1254dd49be d3d11convert: Passthrough allocation query on same caps
Since d3d11convert and its variant elements does not enable basetransform's
passthrough, passthrough allocation query needs to be handled
manually in order to respect downstream element's min/max buffer
requirement.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5297>
2023-09-07 16:36:25 +01:00
Stephan Seitz
d8012a0ead sdp: fix wrong error message for missing clock-rate in caps
When using `gst_sdp_media_set_media_from_caps` on `application/x-rtp` caps
without `clock-rate` it wrongly reports missing payload type even if `payload`
is present in the caps.

This seems to be a copy&paste error from the error message for missing payload
type.

When using payload=10, both `clock-rate` and some other media properties are
defined by the RTP standard so I was wondering whether I could omit `clock-rate`
and was confused about the error message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5252>
2023-08-26 19:35:32 +01:00
Seungha Yang
5f433d7ff2 nvencoder: Fix negotiation error when interlace-mode is unspecified
Use GST_PAD_SET_ACCEPT_INTERSECT() to accept caps without interlace-mode
field

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5240>
2023-08-24 16:38:48 +01:00
Seungha Yang
adea0b45f7 win32ipc: Fix pipe handle leak
Named pipe handle must be closed if it's no longer needed

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2923
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5231>
2023-08-23 18:57:44 +01:00
Seungha Yang
4740a91e00 h265parse: Allow partially broken hvcC data
Ignores parsing error on the last nalu of the array if the nalu type
is not VPS/SPS/PPS

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2905
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5220>
2023-08-23 11:20:33 +00:00
Ming Qian
551fe9c9b1 v4l2object: clear format lists if source change event is received
If decoder notify a source change event when the capture format is
changed, not the resolution changed.

then gst_v4l2_object_acquire_format will retuen false due to
unsupported format.

we need to clear the format lists in the source change flow,
and reenumerate format list

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5223>
2023-08-22 23:59:10 +01:00
Nicolas Dufresne
426bf399d4 v4l2: allocator: Don't close foreign dmabuf
Imported dmabuf are not being duped, so they should never be closed. Instead,
we ensure their live time by having strong reference on their original
buffer. This should fix potential flickering due to dmabuf being closed
too early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5217>
2023-08-21 23:52:57 +01:00
Jan Schmidt
df9482f39b audio: Make sure to stop ringbuffer on error
Add gst_audio_ring_buffer_set_errored() that will mark the
ringbuffer as errored only if it is currently started or paused,
so gst_audio_ringbuffer_stop() can be sure that the error
state means that the ringbuffer was started and needs stop called.

Fixes a crash with osxaudiosrc if the source element posts
an error, because the ringbuffer would not get stopped and CoreAudio
would continue trying to do callbacks.

Also, anywhere that modifies the ringbuffer state, make sure to
use atomic operations, to guarantee their visibility

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5216>
2023-08-21 19:22:53 +01:00
Jan Schmidt
1347f71b6d mdns: Fix a crash on context error
Make sure not to free the microdns provider context until the
device provider asks it to stop. Fixes a crash if there is
an error (such as MDNS port being busy) that makes the
mdns listener exit early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5207>
2023-08-20 17:30:11 +01:00
Tim-Philipp Müller
9bf6919f7f tools: gst-inspect: print action signals as emit_by_name() invocations
It's quite confusing to print a function callback signature for
action signals when people need to do a g_signal_by_name() invocation
in order to use this feature. Requires too much background knowledge
about how GObject works under the hood to make sense of that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5206>
2023-08-18 18:41:55 +01:00
Tim-Philipp Müller
65eb526444 tools: gst-inspect: prettify type names for strings
'gchararray' and 'GStrv' are not types used anywhere else
and are just confusing. Map that to 'const gchar *' and 'gchar *'
etc. depending on context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5206>
2023-08-18 18:41:55 +01:00
Tim-Philipp Müller
aa018007b5 tools: gst-inspect: add vertical spacing between properties and signals
Makes it easier to read and less squashed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5206>
2023-08-18 18:41:55 +01:00
Piotr Brzeziński
c2c2bc2ec2 tools: Disable fault signal handlers in gst-launch/gst-validate on macOS
By default, macOS attempts to run lldb against a misbehaving process to handle the crash. This does not play well
with the SISEGV/SIGQUIT handler we add in gst-launch/gst-validate. The 'spinning' mechanism causes the lldb
and debugserver processes ran by macOS to misbehave, taking 100% CPU and rendering both themselves and the GStreamer
instance frozen and very hard to effectively kill. macOS's Activity Monitor is also unusable while this is happening.

This patch takes the quickest possible solution of just disabling those signal handlers entirely on macOS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5201>
2023-08-18 14:40:24 +00:00
Guillaume Desmottes
c98cf346a9 rtmp2sink: fix crash if message conversion failed
The message pointer is not set so we can't display it in logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5202>
2023-08-18 14:04:14 +00:00
Jan Alexander Steffens (heftig)
d956a7e2d1 qt: Unbreak build with qt-egl enabled but viv_fb missing
Avoids an error message when the feature is explicitly enabled:

    ERROR: Feature qt-egl cannot be enabled: gstreamer-gl-viv_fb-1.0 is required

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5200>
2023-08-18 12:45:14 +00:00
Olivier Crête
79cf124631 sdpmessage: Parse zero clock-rate as default
It seems there is at least one broken RTSP server out there that returns a clock-rate of 0.
Let's just ignore it and use the default in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5199>
2023-08-18 12:43:28 +01:00
Wang Chuan
19a0463903 gstadaptivedemux: fix memory leak
GstQuery leaks when using invalid url

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5156>
2023-08-12 15:17:46 +00:00
Seungha Yang
1d7f2c2b9a hlssink2: Always use forward slash separator
g_build_filename() will insert back slash on Windows, and resulting
playlist will contain media segment path with back slash if
"playlist-root" property is specified

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5161>
2023-08-08 10:49:15 +01:00
Jan Schmidt
d710d60c40 audiolatency: Fix event refcounting bug handling latency events
Fix a refcounting bug introduced in
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5146
If upstream returns FALSE when processing a latency event, it will
be unreffed an extra time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5152>
2023-08-06 09:52:16 +01:00
Jan Schmidt
58c48bab7e audiolatency: Forward latency query and event upstream
Make sure the pipeline still configures the latency that it would configure
if audiolatency was not in the pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5152>
2023-08-06 09:51:19 +01:00
Nirbheek Chauhan
15a180189a meson: Fix searching of qt5/qt6 tools with qmake
If the pkg-config files are broken, we want to ensure that qmake is
used. This can easily happen on macOS with the official Qt binaries.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5149>
2023-08-04 16:40:21 +01:00
Ryan Pavlik
bf687544ba androidmedia: Add more null checks (of env) to JNI utilities
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5142>
2023-08-03 21:03:50 +00:00
Alicia Boya García
654ca283a7 qtdemux: Fix premature EOS when some files are played in push mode
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2771

This EOS branch exists so that if a seek with a stop is made, qtdemux
stops accepting bytes from the sink after the entire requested playback
range is demuxed, as otherwise we could keep download content that is
not being used.

This patch fixes two flaws that were present in that EOS check:

1) A comparison was made between track time and movie time without conversion.
This made the check trigger early in files with edit lists. This patch fixes
this by converting the track PTS to movie PTS (stream time) for the check.

2) To avoid sending a EOS prematurely when the segment stop is within a GOP and
B-frames are present, the check for EOS should only be done for keyframes. I
gather this was already the intention with the existing code, but because it
used `stream->on_keyframe` instead of the local variable `keyframe` the old
code was checking if the *previous* frame was a keyframe.

It's interesting to note that these two flaws in the old code mask each other
in most cases: the track PTS will have reached the movie end PTS, but EOS would
only be sent if the previous frame was a keyframe. A simple case where they
wouldn't mask each other, reproducing the bug, is a sequence of 3 frame GOPs
with structure I-B-P.

The following validateflow tests have been added to future-proof the
fix:

 * validate.test.mp4.qtdemux_ibpibp_non_frag_pull.default
 * validate.test.mp4.qtdemux_ibpibp_non_frag_push.default

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5114>
2023-08-03 20:22:51 +00:00
Philippe Normand
1ea67bdfc5 transcodebin: Fixes for upstream selectable support
The upstream selectable query was not performed in all situations where we
handle the stream-start event. This could potentially lead to unlinked pads
between decodebin3 and encodebin later on.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5141>
2023-08-03 15:06:54 +01:00
Ryan Pavlik
903e116cc5 androidmedia: Add more null checks to JNI utilities
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5136>
2023-08-02 10:23:26 +01:00
Ryan Pavlik
11595175e5 androidmedia: Fix typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5136>
2023-08-02 10:23:26 +01:00
Ryan Pavlik
8602154155 androidmedia: Clear err if we don't have an optional camera field/constant
Fixes startup on devices where those fields/constants are not found.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5136>
2023-08-02 10:23:26 +01:00
Ryan Pavlik
2e08447537 webrtc: Fix docs for create-data-channel action signal
Initial line of the doc comment was incorrect, so the nicely written
docs were not being extracted.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5134>
2023-08-02 00:07:56 +00:00
Philippe Normand
b979ca0dcc decodebin3: Ensure the slot is unlinked before linking to decoder
When switching from a raw stream to an encoded stream we need to make sure the
slot is unlinked, there is code in place for this but it wasn't triggered
because the slot being reconfigured wasn't advertised as linked beforehand.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5133>
2023-08-01 23:50:34 +01:00
Nicolas Dufresne
40311bf665 v4l2: Fix support for left and top padding
In the current implementation, we support for most pixel format left
and top padding by changing the offset in the video meta. Though, to
align driver bytesused to the offset, we recalculate the offset, which
removed the modification we did before.

Instead, save the plane size, and truncate the driver reported bytesused
to the expected size, which ensures that the offsets still match. This
should also fix issues were the buffer size ended up bigger then the
pool size due to driver introduced padding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5132>
2023-08-01 19:54:57 +01:00