Commit graph

348 commits

Author SHA1 Message Date
Sebastian Dröge ad6012159a matroskademux: Fix integer overflows in zlib/bz2/etc decompression code
Various variables were of smaller types than needed and there were no
checks for any overflows when doing additions on the sizes. This is all
checked now.

In addition the size of the decompressed data is limited to 120MB now as
any larger sizes are likely pathological and we can avoid out of memory
situations in many cases like this.

Also fix a bug where the available output size on the next iteration in
the zlib/bz2 decompression code was provided too large and could
potentially lead to out of bound writes.

Thanks to Adam Doupe for analyzing and reporting the issue.

CVE: CVE-2022-1922, CVE-2022-1923, CVE-2022-1924, CVE-2022-1925

https://gstreamer.freedesktop.org/security/sa-2022-0002.html

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2610>
2022-06-15 17:50:55 +00:00
Sebastian Dröge f503caad67 avidemux: Fix integer overflow resulting in heap corruption in DIB buffer inversion code
Check that width*bpp/8 doesn't overflow a guint and also that
height*stride fits into the provided buffer without overflowing.

Thanks to Adam Doupe for analyzing and reporting the issue.

CVE: CVE-2022-1921

See https://gstreamer.freedesktop.org/security/sa-2022-0001.html

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2608>
2022-06-15 16:40:48 +00:00
Adam Doupe be11a6e26b smpte: Fix integer overflow with possible heap corruption in GstMask creation.
Check that width*height*sizeof(guint32) doesn't overflow when
allocated user_data for mask, potential for heap overwrite when
inverting.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2603>
2022-06-15 14:53:50 +00:00
Piotr Brzeziński 0a2c490723 adaptivedemux2: Prevent duplicate symbols on static builds
Uses prelude header files with #defines to rename DASH and MSS
symbols duplicated in their old standalone versions.
Also redefines soup-related functions when building it for
adaptivedemux2 to prevent symbol conflicts there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2534>
2022-06-15 01:13:16 +00:00
Jan Schmidt 6e48a3ec28 adaptivedemux2: Improve reverse playback buffering.
In reverse playback, store the lowest running time in each GOP
as the input_time for buffering purposes. That means we end up
storing at least a complete GOP before declaring buffering
100%

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2510>
2022-06-14 13:06:49 +01:00
Jan Schmidt a4a805312d adaptivedemux2: reverse playback running times
Account for running time moving non-monotonically in
reverse playback by tracking the highest running time
seen at each point.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2510>
2022-06-14 13:06:49 +01:00
Tim-Philipp Müller 9d9e59622f Bump GLib requirement to >= 2.62
Can't require 2.64 yet because of
https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/323

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2568>
2022-06-10 06:01:41 +00:00
Marc Leeman 8bdf7e8ad8 fix trivial distination -> destination
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2573>
2022-06-08 14:40:09 +02:00
Ignacio Casal Quinteiro 408f37c1d9 osxaudio: remove usage of goto
It is easier to follow the code without the goto now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2251>
2022-06-08 06:28:17 +00:00
Ignacio Casal Quinteiro caa5972abd osxaudio: support hidden devices
macOS features hidden devices. These are devices that will
not be shown in the macOS UIs and that cannot be retrieved
without having the specific UID of the hidden device. There
are cases when you might want to have a hidden device, for example
when having a virtual speaker that forwards the data to a virtual
hidden input device from which you can then grab the audio.
The blackhole project supports these hidden devices and
this patch provides a way that if the device id is a hidden
device it will use it instead of check the hardware list of devices
to understand if the device is valid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2251>
2022-06-08 06:28:17 +00:00
Ignacio Casal Quinteiro 243f8e8882 osx: fix indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2251>
2022-06-08 06:28:17 +00:00
Ignacio Casal Quinteiro 57fed3c911 osxaudio: iterate device only if needed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2251>
2022-06-08 06:28:17 +00:00
Ignacio Casal Quinteiro a4a4d295a1 osxaudio: reduce scope of default device id variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2251>
2022-06-08 06:28:17 +00:00
Bastien Nocera e37c462f87 gtk: Fix double-free when OpenGL can't be initialised
gtk_gl_area_get_error() doesn't return a copy of the error, but just the
error. If initialising OpenGL fails, then GtkGstGLWidget will consume
the error, and cause GTK to try and display freed memory.

==50914== Invalid read of size 8
==50914==    at 0x4C4CB8A: gtk_gl_area_draw_error_screen (gtkglarea.c:663)
==50914==    by 0x4C4CB8A: gtk_gl_area_draw (gtkglarea.c:687)
==50914==    by 0x4E061CA: gtk_widget_draw_internal (gtkwidget.c:7084)
==50914==    by 0x4BAEFB1: gtk_container_propagate_draw (gtkcontainer.c:3854)
==50914==    by 0x4D4B6BF: gtk_stack_render (gtkstack.c:2207)
==50914==    by 0x4BB4B03: gtk_css_custom_gadget_draw (gtkcsscustomgadget.c:159)
==50914==    by 0x4BBA4C4: gtk_css_gadget_draw (gtkcssgadget.c:885)
==50914==    by 0x4D4D780: gtk_stack_draw (gtkstack.c:2119)
==50914==    by 0x4E061CA: gtk_widget_draw_internal (gtkwidget.c:7084)
==50914==    by 0x4BAEFB1: gtk_container_propagate_draw (gtkcontainer.c:3854)
==50914==    by 0x4BAF0C3: gtk_container_draw (gtkcontainer.c:3674)
==50914==    by 0x4E061CA: gtk_widget_draw_internal (gtkwidget.c:7084)
==50914==    by 0x4BAEFB1: gtk_container_propagate_draw (gtkcontainer.c:3854)
==50914==  Address 0x187a0818 is 8 bytes inside a block of size 16 free'd
==50914==    at 0x48480E4: free (vg_replace_malloc.c:872)
==50914==    by 0x49A5B8C: g_free (gmem.c:218)
==50914==    by 0x49C1013: g_slice_free1 (gslice.c:1183)
==50914==    by 0x4990DE4: g_error_free (gerror.c:870)
==50914==    by 0x4990FE9: g_clear_error (gerror.c:1052)
==50914==    by 0x1A489780: _get_gl_context (gtkgstglwidget.c:540)
==50914==    by 0x1A4863CB: gst_gtk_invoke_func (gstgtkutils.c:39)
==50914==    by 0x49A3834: g_main_context_invoke_full (gmain.c:6137)
==50914==    by 0x1A486450: gst_gtk_invoke_on_main (gstgtkutils.c:59)
==50914==    by 0x1A48A29E: gtk_gst_gl_widget_init_winsys (gtkgstglwidget.c:632)
==50914==    by 0x1A4887E7: gst_gtk_gl_sink_start (gstgtkglsink.c:267)
==50914==    by 0x6579810: gst_base_sink_change_state (gstbasesink.c:5662)
==50914==  Block was alloc'd at
==50914==    at 0x484586F: malloc (vg_replace_malloc.c:381)
==50914==    by 0x49A9278: g_malloc (gmem.c:125)
==50914==    by 0x49C1BA5: g_slice_alloc (gslice.c:1072)
==50914==    by 0x49C3BCC: g_slice_alloc0 (gslice.c:1098)
==50914==    by 0x499096B: g_error_allocate (gerror.c:708)
==50914==    by 0x4990AF1: UnknownInlinedFun (gerror.c:722)
==50914==    by 0x4990AF1: g_error_copy (gerror.c:892)
==50914==    by 0x4C4B9F9: gtk_gl_area_set_error (gtkglarea.c:1036)
==50914==    by 0x4C4BAF7: gtk_gl_area_real_create_context (gtkglarea.c:346)
==50914==    by 0x4B21B28: _gtk_marshal_OBJECT__VOIDv (gtkmarshalers.c:2730)
==50914==    by 0x4920B78: UnknownInlinedFun (gclosure.c:893)
==50914==    by 0x4920B78: g_signal_emit_valist (gsignal.c:3406)
==50914==    by 0x4920CB2: g_signal_emit (gsignal.c:3553)
==50914==    by 0x4C4B927: gtk_gl_area_realize (gtkglarea.c:308)

Reproduced by running:
MESA_GL_VERSION_OVERRIDE=2.7 totem

See https://gitlab.gnome.org/GNOME/totem/-/issues/522

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2565>
2022-06-07 17:36:26 +02:00
Sebastian Dröge 47aab6c832 flvdemux: Make use of the streams API if used in a streams-aware bin
This allows adding audio/video streams after 6s.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2559>
2022-06-07 10:52:46 +00:00
Jan Alexander Steffens (heftig) 637406cdb1 aacparse: Avoid mismatch between src_caps and output_header_type
If our downstream caps didn't intersect, we attempted to convert between
raw and ADTS stream formats, if possible. If the caps still did not
intersect, we then used the modified `src_caps` but left the
`output_header_type` unmodified.

This caused a mismatch between caps and actual stream format.

Avoid this by first copying the `src_caps` to `convcaps` for the
additional intersection tests, replacing `src_caps` if we succeed.

While we're here, clean up the code a bit and remove the `codec_data`
field from outgoing ADTS caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2550>
2022-06-06 15:09:09 +00:00
Sebastian Dröge e5f9bb973f flvdemux: Actually make use of the debug category
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2552>
2022-06-06 14:36:41 +00:00
Stéphane Cerveau c3bb04f779 soup: fix soup debug category
Use soup debug category in souploader
for soup plugin element load.

Inititalize properly soup utils category.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2535>
2022-06-02 12:55:13 +00:00
Seungha Yang 238ce301b6 hlsdemux2: Adjust debug log level
HLS manifest might not be represented by a single common caps
when different codecs are mixed in a playlist, but it
does not seem to be a critical issue we need to warn.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2516>
2022-06-01 14:32:55 +00:00
Stéphane Cerveau 6b55f97529 adaptivedemux2: fix plugin/element init
In case of per features registration such as the
customizable gstreamer-full library, each
element should check that the soup library can be loaded to
facilitate the element registration.

Initialize the debug categories properly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2348>
2022-05-30 13:13:48 +00:00
Jan Schmidt a8f18aef18 rtpptdemux: Don't GST_FLOW_ERROR when ignoring invalid packets
https://bugzilla.gnome.org/show_bug.cgi?id=741398 changed
rtpptdemux in 2014 to not post a GST_ELEMENT_ERROR on the
bus when dropping an invalid (non-RTP) packet, but still
returned GST_FLOW_ERROR upstream - so the pipeline still
stops, but now without a useful bus error.

Return GST_FLOW_OK instead, so the pipeline keeps
running. Some old telephony equipment can send invalid
packets before the real RTP traffic starts.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2520>
2022-05-29 20:27:38 +10:00
Nirbheek Chauhan a6db1a4c81 jack: Always use jack_free as specified by the docs
Fixes a crash on Windows due to a CRT mismatch. The JACK installation
still uses MSVCRT, and we the Universal CRT for both MinGW and MSVC.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2497>
2022-05-28 11:34:23 +00:00
Nirbheek Chauhan 4865f36344 jack: Add support for detecting libjack on Windows
No source code changes were necessary to get the plugin working on
Windows with MSVC.

Run QJackCtl and audiotestsrc ! jackaudiosink just works.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2497>
2022-05-28 11:34:23 +00:00
Hou Qi 7f2fb3b783 v4l2: Reset transfer in gst_v4l2_object_acquire_format()
get_colorspace() checks input caps transfer when mapping V4L2_XFER_FUNC_709
back to V4L2_COLORSPACE_BT2020 and GST_VIDEO_TRANSFER_BT2020_12. After
receiving source change event, decoder will G_FMT and S_FMT again. So need
to reset transfer when acquiring format to avoid using the old transfer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2475>
2022-05-26 17:09:28 +00:00
Piotrek Brzeziński 5490189b9b cutter: Include running/stream-time in messages
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2490>
2022-05-25 12:27:10 +00:00
Stéphane Cerveau 39b13fcdbd soup: Fix plugin/element init
In case of per features registration such as the
customizable gstreamer-full library, each
element should check that the soup library can be loaded to
facilitate the element registration.

Initialize the debug category properly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2349>
2022-05-25 09:33:56 +02:00
Eli Schwartz 79c3bbc2ed meson: use better zlib dependency fallback
zlib is required, and if it isn't found it is checked several ways and
then forced via subproject(). This code was added in commit
b93e37592a, to account for systems where
zlib doesn't have pkg-config files installed.

But Meson already does dependency fallback, and also, since 0.54.0, does
the in-between checks for find_library('z') and has_header('zlib.h') via
the "system" type dependency. Simplify dependency lookup by marking it
as required, which also makes sure that the console log doesn't
confusingly list "not found".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2484>
2022-05-24 19:39:29 +00:00
Nicolas Dufresne 6d6ebbbb36 v4l2videodec: Fix missing handling of resolution-change
The pool process function may poll and get the resolution-change event
whenever it is not possible to share our buffers. This typically happen
when downstream does not support GstVideoMeta.

Not handling this would cause the decoder thread to exit silently and the
pipeline to stall.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2457>
2022-05-24 18:02:12 +00:00
Nicolas Dufresne 4e441417b8 v4l2videodec: Downgrade to info resolution-change trace
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2457>
2022-05-24 18:02:12 +00:00
Tim-Philipp Müller e64c6f0b93 shout2: fix compiler warnings and bump req to libshout >= 2.4.2
Fix compiler warnings with latest libshout version (2.4.6).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2473>
2022-05-23 20:23:38 +01:00
László Károlyi fedb48c68f shout2send: Adding send-title-info and user-agent options
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2420>
2022-05-23 16:01:48 +00:00
Sebastian Dröge 7273024ae5 qtdemux: Add support for ONVIF XML Timed MetaData
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2453>
2022-05-20 13:01:44 +00:00
Sebastian Dröge 365a9af9c5 qtdemux: Add parsing/dumping of nmhd / metx boxes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2453>
2022-05-20 13:01:44 +00:00
Sebastian Dröge 04f6258863 qtdemux: Parse styp box for informational purposes
And include some more details in the debug logs for the ftyp box too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2453>
2022-05-20 13:01:44 +00:00
Hou Qi 85b53bb65d v4l2: set default resolution if caps has no such information
Output may attemp to set the width and height to zero values if
caps has no such information, which will cause capture get invalid
dimensions. Then decoder reports negotiation failure.

So need to set default resolution if caps has no such information.
Real values can be set again until source change event is signaled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2400>
2022-05-20 12:23:40 +00:00
Jan Schmidt 7322a6d004 splitmuxsrc: Re-queue sticky events after probing.
When processing the first event after probing the
file and being activated, requeue sticky events
as there's no requirement that demuxers send tag
and other events again after a seek - that's
why they're sticky.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2432>
2022-05-17 11:55:40 +00:00
Jan Alexander Steffens (heftig) d0fdfa76ae deinterlace: Clean up error handling in chain and _push_history
- Consistently unref the chained buffer at the end of the chain
  function, if we're not handing it off to `gst_pad_push`. This avoids a
  few buffer leaks in the error paths in `_chain` and `_push_history`.
- When mapping the video frame fails, return a flow error instead of
  crashing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2428>
2022-05-17 10:56:23 +00:00
Jan Alexander Steffens (heftig) 718d31fe63 splitmuxsink: When flushing, exit handle_mq_input quickly
If we just break the loop, we might run into the `gop != NULL` assert
that follows it. Rather, exit immediately with flushing flow.

Also use this flushing mechanism when we release a pad. This avoids
having an extra flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1030>
2022-05-17 09:24:10 +00:00
Jan Alexander Steffens (heftig) fd27ee1537 splitmuxsink: Avoid deadlock on release, harder
Unlock after broadcasting and wait for the pad to be free before
relocking the muxer, giving the input probe a chance to react to our
broadcast.

Improves the fix from
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/838.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1030>
2022-05-17 09:24:10 +00:00
Shingo Kitagawa 92c0a462ae wavparse: fix typo in debug message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2425>
2022-05-16 19:31:18 +09:00
Thibault Saunier 1cb4c050d0 rtpbin: Avoid holding lock GST_RTP_BIN_LOCK when emitting pad-added
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2411>
2022-05-13 06:25:03 +00:00
Sebastian Dröge 1223324246 qtdemux: Don't use tfdt for parsing subsequent trun boxes
The timestamp in the tfdt refers to the first trun box and if there are
multiple trun boxes then the distance between the first timestamps will
grow.

At some point this distance reaches a threshold and triggers the
resetting of the first sample's timestamp of this trun box to be reset
to the tfdt.

This threshold is implemented for files where there is a jump in the
timeline between fragments and where this can be detected via a jump
between the end timestamp of the previous fragment and the tfdt of the
next. This behaviour is preserved.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2409>
2022-05-13 04:19:36 +00:00
Guillaume Desmottes aa3b6a11e0 vpxenc: enforce strictly increasing pts
From vpx_codec_encode() documentation:
  "The presentation time stamp (PTS) MUST be strictly increasing."

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2405>
2022-05-12 13:00:53 +02:00
Guillaume Desmottes 10b837ae5e vpxenc: conver input pts to running time
The input pts needs to be strictly increasing, see vpx_codec_encode() doc, so convert it to
running time as we don't want to reset the encoder for each segment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2405>
2022-05-12 13:00:53 +02:00
Guillaume Desmottes 1e829696e8 vpxenc: fix crash if encoder produces unmatching ts
If for some reason the encoder produces frames with a pts higher than
the input one, we were dropping all the video encoder frames and ended
up crashing when trying to access the pts of a NULL pointer returned by
gst_video_encoder_get_oldest_frame().

I hit this scenario by feeding a decreasing timestamp to vp8enc which
seem to confuse the encoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2405>
2022-05-12 13:00:53 +02:00
Nicolas Dufresne 522f19e013 v4l2videoenc: Setup crop rectangle if needed
Hantro H1 and Rockchip VEPU2 drivers will pad the width/height to a
multiple of 16. In order to obtain the right JPEG size, the image needs
to be cropped using the S_SELECTION API. This support is added as best
effort since older drivers may emulate this by looking at the capture
queue width/height.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2329>
2022-05-07 11:35:14 +00:00
Sebastian Dröge d2c6f21fc1 mp4mux: Disable aggregator's default negotiation
mp4mux can't negotiate caps with upstream/downstream and always outputs
specific caps based on the input streams. This will always happen before
it produces the first buffers.

By having the default aggregator negotiation enabled the same caps
would be pushed twice in the beginning, and again every time a
reconfigure event is received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2372>
2022-05-05 17:41:58 +00:00
Sebastian Dröge 841cba4182 flvmux: Disable aggregator's default negotiation
flvmux can't negotiate caps with upstream/downstream and always outputs
specific caps based on the input streams. This will always happen before
it produces the first buffers.

By having the default aggregator negotiation enabled the same caps
would be pushed twice in the beginning, and again every time a
reconfigure event is received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2372>
2022-05-05 17:41:58 +00:00
Matthew Waters f4f342aa78 wavparse: ensure that any pending segment is sent before an EOS event is sent
Specifically fixes seqnum handling when an aggregator-based element
(audiomixer et al) is downstream and a seek is performed that
immediately causes an EOS from wavparse.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2356>
2022-05-04 08:00:02 +00:00
Sebastian Dröge 7466444b63 rtpjitterbuffer: Free CNAME/SSRC mappings on finalize and PAUSED->READY
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2336>
2022-04-29 23:33:47 +03:00