Commit graph

937 commits

Author SHA1 Message Date
Sebastian Dröge dbbfc917fe flacparse: Avoid integer overflow in available data check for image tags
If the image length as stored in the file is some bogus integer then
adding it to the current byte readers position can overflow and wrongly
have the check for enough available data succeed.

This then later can cause NULL pointer dereferences or out of bounds
reads/writes when actually reading the image data.

Fixes ZDI-CAN-20775
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4894>
2023-06-20 10:02:19 +00:00
François Laignel fa30504ec2 qtdemux: parse Opus and dOps as qtdemux nodes and add size checks
This allows checking the nodes conformity and dumping parsed values.

Note: Audio Sample Entry version parsing and offset handling is handled as part
of `FOURCC_soun` common processing and in `qtdemux_parse_node`.

Also, only read `stream_count` and `coupled_count` when
`channel_mapping_family` != 0. See:

https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
2023-06-19 14:31:55 +00:00
François Laignel 439717ab65 qtdemux: fix byte order for opus extension and version field type
The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
2023-06-19 14:31:55 +00:00
François Laignel f3496ea3bf qtmux: fix byte order for opus extension
The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

In `build_opus_extension`, `gst_byte_writer_put*_le ()` variants were used,
causing audio streams conversion to Opus in mp4 to offset samples due to the
PreSkip field incorrect value (29ms early in our test cases).

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875>
2023-06-19 14:31:55 +00:00
Daniel Morin 6f43bdce49 v4l2src: adding support for bayer 10,12,14,16
- Adding bayer 10,12,14,16 bits components with 16 bits storage. These
  changes only adds capabilities. Capability format string is a complete
  description of the frame and pixels layout. Only mapping LE bayer
  formats as v4l2 only define LE bayer formats.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4852>
2023-06-15 18:41:42 +00:00
Nicolas Dufresne 42c12c9c73 doc: Update plugin cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447>
2023-06-15 10:41:26 -04:00
Nicolas Dufresne aea74db1a2 v4l2: Sync headers to current media_stage
commit d78b9d6671decdaedb539635b1d0a34f8f5934f8

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447>
2023-06-15 14:32:32 +00:00
Daniel Morin 6ece5f3b90 v4l2src: fix support for bayer format
- Define a new function that identify if the v4l2object is raw based
on pixel format
- Only consider setting delta flag on buffer if the video is not raw.

Sponsored by Living Optics Ltd.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4848>
2023-06-14 18:32:45 +00:00
Mark Hymers 1ae8af4909 matroska: Add support for more pixel formats
- Add support for GRAY16_LE (using ffmpeg fourcc mapping)
- Update documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4824>
2023-06-14 13:40:58 +00:00
Daniel Morin 00178cbd89 matroska: Add new pixels format support
- Add support for GRAY10_BE32
- Add support for RGBA64_LE and BGRA64_LE

Sponsored by Living Optics

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4824>
2023-06-14 13:40:57 +00:00
Tim-Philipp Müller 2abdfb9657 tests: rtpbin_buffer_list: fix possible unaligned read on 32-bit ARM
Fixes #2666

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4842>
2023-06-14 04:59:05 +00:00
Tim-Philipp Müller f3c126d07c matroska-demux: fix accumulated base offset in segment seeks
When doing a segment seek, the base offset in the new segment
would be increased by segment.position which is basically the
timestamp of the last packet. This does not include the duration
of the last packet though, so might be slightly shorter than the
actual duration of the clip or the requested segment.

Increase the base offset by the segment duration instead when
accumulating segments, which is more correct as it doesn't cut
off the last frame and makes the effective loop segment duration
consistent with the actual duration returned from a duration
query.

In case a segment stop was specified it's also possible that
some data was sent beyond the stop that's necessary for decoding
so the base offset increment should be based on that then and
not on the timestamp of the last buffer pushed out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4604>
2023-06-13 18:19:48 +00:00
ekwange e7cfc1f5bd v4l2: Change to query only up to V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS
Fix to prevent infinite querying.
There are devices that exceed V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS
but do not return EINVAL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4790>
2023-06-13 13:04:37 +00:00
Jonas Kvinge 513dd2c219 adaptivedemux2: Allow data dash+xml manifest for uri
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4811>
2023-06-13 11:32:23 +00:00
Jochen Henneberg fd1d208446 rtspsrc: Cleanup code for next pending command
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4792>
2023-06-07 20:30:36 +00:00
Jochen Henneberg 4790a8d2be rtspsrc: Do not try send dropped get/set parameter
If the set_get_param_q has been emptied we have to reset the cached
pending command to CMD_LOOP as we will not have the request parameters
anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4792>
2023-06-07 20:30:36 +00:00
Xabier Rodriguez Calvar bdff780fe9 qtdemux: Fix critical message on cenc sample grouping parsing
Inside qtdemux_parse_sbgp there is already a check to ensure the fragment group
properties are not null but it is being hit in some examples and it is better to
directly avoid the critical.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4576>
2023-06-07 11:01:20 +00:00
Guillaume Desmottes 9b0736c85d videoflip: update orientation tag in auto mode
The frames are flipped according to the tag orientation so it's no longer accurate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4778>
2023-06-06 19:28:09 +00:00
Hou Qi fe21b750f9 v4l2videodec: treat MPEG 1 format as MPEG 2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4770>
2023-06-06 15:41:47 +00:00
Matthew Waters c3af29db1e build/android: remove all references to gnustl
Not needed anymore with NDK R25.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4747>
2023-06-03 23:21:34 +00:00
Jan Alexander Steffens (heftig) 93699123b4 isomp4: Fix (E)AC-3 channel count handling
The muxer used a fixed value of 2 channels because the TR 102 366 spec
says they're to be ignored. However, the demuxer still trusted them,
resulting in bad caps.

Make the muxer fill in the correct channel count anyway (FFmpeg already
does) and make the demuxer ignore the value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4739>
2023-06-02 19:07:58 +00:00
Nirbheek Chauhan ca4762168f meson: Support building qml6glsink on win32
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4742>
2023-06-02 14:27:44 +05:30
Piotr Brzeziński 476d350b03 pngdec: Fix 16bit RGB images display
Due to the alpha value being inserted with _BEFORE, we were ending up
with ARGB instead of RGBA, thus displaying completely wrong colours.
According to libpng's manual, "to add an opaque alpha channel, use filler=0xff
or 0xffff and PNG_FILLER_AFTER which will generate RGBA pixels".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4756>
2023-06-02 05:38:54 +00:00
Stéphane Cerveau dd17beb681 gstreamer-full: add full static support
Allow a project to use gstreamer-full as a static library
and link to create a binary without dependencies.

Introduce the option 'gst-full-target-type' to
select the build type, dynamic(default) or static.

In gstreamer-full/static build configuration gstreamer (gst.c)
needs the symbol gst_init_static_plugins which is defined
in gstreamer-full.
All the tests and examples are linking with gstreamer but the
symbol gst_init_static_plugins is only defined in the gstreamer-full
library. gstreamer-full can not be built first as it needs to know what plugins
will be built.

One option would be to build all the examples and tests after
gstreamer-full as the tools.

Disable tools build in subprojects too as it will be built at the end of
build process.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4128>
2023-05-31 15:17:11 +00:00
Matthew Waters 74f914077d qt6/glrenderer: don't attempt to use QWindow from non-Qt main thread
Use QObject::deleteLater() to schedule deletion in the main thread.

Remove the moveToThread of the QWindow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4728>
2023-05-31 02:10:26 +00:00
Matthew Waters c64efe494d qt/glrenderer: don't attempt to use QWindow from non-Qt main thread
Use QObject::deleteLater() to schedule deletion in the main thread.

Remove the moveToThread of the QWindow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4728>
2023-05-31 02:10:26 +00:00
Hyung Song d68a7fbd94 aacparse: parse GASpecificConfig for channels
Some media have valid channel information in GASpecificConfig which is
not yet implemented in gstaacparse. Parse data according to ISO/IEC
14496-3 just enough to get channels.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4720>
2023-05-30 09:09:16 +00:00
Guillaume Desmottes 0fd3c28620 flvmux: push metadata on caps change
The metdata contains tags but also caps dependent info such as the
resolution and the framerate.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4730>
2023-05-30 09:35:43 +02:00
Guillaume Desmottes 3ae2904f3d flvmux: rename 'new_tags' to 'new_metadata'
The metadata contains more than just tags: resolution, framerate, etc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4730>
2023-05-30 08:27:18 +02:00
Guillaume Desmottes 853fad001e flvmux: add some logs when input is changing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4730>
2023-05-30 08:27:18 +02:00
Michael Olbrich 2197cdc289 flvmux: use the correct timestamp to calculate wait times
Since c0bf793c05 ("flvmux: Set PTS based on
running time") the timestamp of the output buffer is already in running
time. So using that for 'srcpad->segment.position' does not work correctly
because gst_aggregator_simple_get_next_time() will convert it again with
gst_segment_to_running_time().
This means that the timestamp returned by
gst_aggregator_simple_get_next_time() may be incorrect. For example, if
flvmux is added to a already runinng pipeline then the timestamp is too
small and gst_aggregator_wait_and_check() returns immediately. As a result,
buffers may be muxed in the wrong order.

To fix this, use the PTS of the incoming buffer instead of the outgoing
buffer. Also add the duration as get_next_time() is supposed to return the
timestamp of the next buffer, not the current one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4701>
2023-05-29 14:56:13 +00:00
Michael Olbrich 285811e7a7 jpegdec: be stricter when detecting interlaced video
There are broken(?) mjpeg videos that are incorrectly detected as
interlaced. This happens because 'info.height > height' (e.g. 1088 > 1080).

In the interlaced case info.height is approximately 'height * 2' but not
exactly because height is a multiple of DCTSIZE. Make the check more
restrictive but take the rounding effect into account.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4696>
2023-05-25 18:34:34 +00:00
Michael Olbrich 59290feca4 jpegdec: decode the correct number of lines for interlaced frames
For interlaced jpeg, gst_jpeg_dec_decode_direct() is called twice, once for each
field. In this case, stride[n] is plane_stride[n] * 2 to ensure that only every
other line is written. So the loop must stop at height / num_fields.

If the frame is really interlaced then continuing beyound this, is not harmful,
because jpeg_read_raw_data() will do nothing and return 0, so am info message is
printed.

However, if the frame is not actually interlaced, just misdetected as interlaced
then there is still data available from the second half of the frame. Now
line[0][j] is set to the scratch buffer. If the scratch buffer is not allocated
(because the height is a multiple of v_samp[0] * DCTSIZE) then the result is a
segfault due to a null-pointer dereference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4696>
2023-05-25 18:34:34 +00:00
YURI FEDOSEEV 8dd51501d0 v4l2videoenc: support force keyframe event in v4l2 encoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4663>
2023-05-24 12:42:24 +00:00
Ruben Gonzalez 059965fe53 doc: Fix newline char between authors
Found running `gst-inspect-1.0 -a |& grep -v ":" | grep @`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4682>
2023-05-20 05:48:23 +00:00
Nicolas Dufresne 0c9ab49579 v4l2: videodec: Fix stalls on empty buffer
Drivers may signal end of sequence using an empty buffer and LAST buffer
set, or just an empty buffer on certain legacy implementation. When this
occured, we'd send GST_V4L2_FLOW_LAST_BUFFER were the code expected
GST_FLOW_EOS. Stop abusing GST_FLOW_EOS and port all the code to the new
GST_V4L2_FLOW_LAST_BUFFER.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4669>
2023-05-19 23:06:06 +00:00
Sebastian Dröge d5a0cfc563 qtdemux: Add support for SpeedHQ video codec
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3982>
2023-05-19 07:16:03 +00:00
Matthew Waters 3f4bfa097a qml6: add a mixer element
Can take multiple input streams and a qml scene and layout the input
videos inside the qml scene.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4609>
2023-05-19 01:48:57 +00:00
Shengqi Yu 5da9a8e2f4 v4l2object: fix some errors in probe_caps_for_fromat
1, there is a mistake when print stepwise.max_height, fix it
2, modify the calculation of width and height under the step wise
condition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4562>
2023-05-18 13:45:11 +00:00
Ruben Gonzalez 5c0f6b88d8 README.md: fix current version
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4662>
2023-05-18 06:25:50 +00:00
Hou Qi 783ebbeecb v4l2videoenc: fix set format failure when needs reset encoder
In cases that encoder needs to reset format, there is race while draining.
v4l2videoenc finish() sends CMD_STOP command to driver, and desire to return
GST_FLOW_OK. But at this time, encoder CAPTURE may have dequeued the last
buffer and got eos. finish() return value changes to be GST_FLOW_EOS which
causes set format fail. So there is no need to check return value for finish()
when set format.

Also need to flush encoder after draining to make sure flush is finished.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4495>
2023-05-17 17:59:29 +00:00
Sebastian Dröge 99285bb566 qtmux: Fix extraction of CEA608 data from S334-1A packets
The index is already incremented by 3 every iteration so multiplying it
by 3 additionally on each array access is doing it twice and does not
work.

This caused invalid files to be created if there's more than one CEA608
triplet in a buffer, and out of bounds memory reads.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4634>
2023-05-16 11:29:45 +00:00
Jan Schmidt 131d59518e splitmuxsrc: Make PTS contiguous by preference
Make splitmuxsrc deal better with stream reordering by
making the largest observed PTS contiguous in the
next fragment. Previously, it selected DTS, but then
aligned that with the segment start of the next fragment,
which holds PTS values - leading to glitches in
streams that don't have PTS = DTS at the start.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4637>
2023-05-16 04:34:16 +00:00
Sebastian Dröge bb2c5981fe pulse: Change bitfield booleans to normal gbooleans
Assigning TRUE (1) to a signed 1 bit integer will cause truncation
from 1 to -1 because the only non-zero value that can be stored is -1
due to how two's-complement works.

As this is a proper GObject let's not bother with all this and simply
use a normal gboolean instead.

../subprojects/gst-plugins-good/ext/pulse/pulsesink.c:1490:19: warning: implicit truncation from 'int' to a one-bit
        wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
  pbuf->in_commit = TRUE;
                  ^ ~~~~

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4617>
2023-05-14 15:58:35 +00:00
Sebastian Dröge f9a3b3eacf rtpjitterbuffer: Fix uninitialized variable compiler warning
It could indeed be used uninitialized, but only if one of the
g_return_val_if_fail() caused an early return.

../subprojects/gst-plugins-good/gst/rtpmanager/rtpjitterbuffer.c: In function ‘rtp_jitter_buffer_append_query’:
../subprojects/gst-plugins-good/gst/rtpmanager/rtpjitterbuffer.c🔢10: warning: ‘head’ may be used uninitialized
      [-Wmaybe-uninitialized]
 1234 |   return head;
      |          ^~~~
../subprojects/gst-plugins-good/gst/rtpmanager/rtpjitterbuffer.c:1232:12: note: ‘head’ was declared here
 1232 |   gboolean head;
      |            ^~~~

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4616>
2023-05-14 14:26:05 +00:00
Piotr Brzeziński 5e45a1b1bd macos: Set activation policy in osxvideosink and glimagesink
Upon creating a window, glimagesink and osxvideosink now set the policy to
NSApplicationActivationPolicyRegular, which lets us show an icon in the Dock
for convenience and appear in the top menu bar like other apps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4573>
2023-05-12 01:14:44 +02:00
Piotr Brzeziński f60c87769f macos: Remove old NSApp workaround related code
This is no longer needed since the introduction of `gst_macos_main()` in 1.22.
Before that existed, we had a patch for GLib in Cerbero, which did work but made it
impossible to update GLib at all. The code being removed was a fail-safe in case of
running without said patch being applied. It's no longer needed, since for macOS
we just wrap our GStreamer with an NSApplication using `gst_macos_main()`.

Warnings will be displayed if no NSApp/NSRunLoop is found wherever needed,
pointing the user towards using the new API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4366>
2023-05-11 20:30:19 +02:00
Tim-Philipp Müller 0c4a702e82 qtdemux: add unit test for edit list regression
File is the mp4 file from #2549 with the mdat atom
zeroed out and compressed. We compress twice because
apparently compressing 5MB of zeroes effectively in
one run is too difficult for gzip.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2549

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4560>
2023-05-11 16:45:37 +00:00
Mathieu Duponchelle 3d3d2ed447 Revert "qtdemux: fix conditions for end of segment in reverse playback"
This reverts commit 9deb3c27ac.

The test case that was described in the associated MR
(https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/262)
remains adequately fixed by a related MR that was merged later
(https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/275).

It introduced incorrect logic that broke edit lists as described in
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2549

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2549
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4560>
2023-05-11 16:45:37 +00:00
Piotr Brzeziński 560d20a2c0 osxvideosink: fix deadlock upon closing output window
Invoking gst_osx_video_sink_osxwindow_destroy() can currently cause a deadlock
because showFrame() keeps trying to get the same lock as well. Moving the lock
closer to where it's actually needed seems to be enough to fix the issue for now.

Reported-by: Alexande B <abobrikovich@gmail.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4559>
2023-05-11 06:35:02 +00:00
François Laignel 6675ed9aae rtpmanager/rtsession: data race leading to critical warnings
This is a fix for a data race leading to:

> GLib-CRITICAL: g_hash_table_foreach:
>   assertion 'version == hash_table->version' failed

Identified sequence:

* `rtp_session_on_timeout` acquires the lock on `session` and proceeds with its
  processing.
* `rtp_session_process_rtcp` is called (debug log : received RTCP packet) and
  attempts to acquire the lock on `session`, which is still held by
  `rtp_session_on_timeout`.
* as part of an hash table iterator, `rtp_session_on_timeout` transitively
  invokes `source_caps` which releases the lock on `session` so as to call
  `session->callbacks.caps`.
* Since `rtp_session_process_rtcp` was waiting for the lock to be released, it
  succeeds in acquiring it and proceeds with `rtp_session_process_rr` which
  transitively calls `g_hash_table_insert` via `add_source`.
* After `source_caps` re-acquires the lock and gives the control flow back to
  `rtp_session_on_timeout`, the hash table iterator is changed, resulting in the
  assertion failure.

This commits copies `sess->ssrcs[sess->mask_idx]` and iterates on the copy so
the iterator is not affected by a concurrent change due to the lock being
released in the `source_caps` callback.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4555>
2023-05-09 16:05:29 +00:00
Philippe Normand fd194a0a2b rtpdtmfdepay: Classify as RTP element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4582>
2023-05-09 15:18:47 +00:00
Philippe Normand a51fd006e6 rtpdtmfsrc: Classify as RTP source
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4582>
2023-05-09 15:18:47 +00:00
Nirbheek Chauhan 93be699ab2 meson: Add more qt options and eliminate all automagic
The qt5 and qt6 plugins will now correctly error out if you enable the
option, and you can also now explicitly ensure that wayland, x11,
eglfs support is actually functional by enabling the options. It was
too easy to build non-functional support for these.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4537>
2023-05-09 13:18:38 +00:00
Tim-Philipp Müller 8b9f1278b2 jack: tone down log ERRORs in case no JACK server is running
jackaudiosink and jackaudiosrc have a rank and might be plugged
as part of auto-plugging inside playbin and playsink or the
autoaudiosink/autoaudiosrc elements, so we don't really want to
spew ERROR log messages in that case, which is consistent with
what alsasink and pulseaudiosink do.

This is less noticable on Linux because pulseaudiosink has a
higher and alsasink which has the same rank comes before jack
in the alphabet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4545>
2023-05-08 21:20:20 +00:00
Mathieu Duponchelle 020fd3d14d videoflip: fix setting of method property at construction time
Since c2f890ab, element properties are gathered from the parse-launch
line and passed at object construction.

This caused the following issue to happen in videoflip:

* videoflip installed a CONSTRUCT property named method, now deprecated
* videoflip now also overrides that property with a video-direction
  property

GObject construction causes method to be set first at construct time,
with the user-provided value, then video-direction with the default
value.

The user-provided value was thus overridden, causing a regression.

Fix by not installing the properties as CONSTRUCT, and explicitly
implementing constructed() instead in order to ensure that we do still
call gst_video_flip_set_method() at least once during construction.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4536>
2023-05-05 08:57:04 +00:00
Camilo Celis Guzman 0cee3cd833 rtpvp8pay: rtpvp9pay: access picture_id property atomically
Atomically set and get the picture_id. This changeset only atomically gets
the picture-id when such property is queried on the element, on every other
place where it is accessed internally it is accessed directly.

This is because there is no MT scenario where we would be modifying this value
and reading it internally in parallel.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman e4d8cda9a1 rtpvp8pay, rtpvp9pay: increment PictureID on FLUSH_START
In recent versions of Chrome (M106) a change on their jitter buffer means that
they are very susceptible to PictureID discontinuities.

Then avoid at all cost resetting the PictureID. Moreover, according to
the RFCs for VP8 and VP9 payloads; the PictureID can start off at any
random value. So there is no logical problem of incrementing it here
rather than resetting it, as long as it is a different PictureID.

WebRTC's recent corruption issue:
https://bugs.chromium.org/p/webrtc/issues/detail?id=15101

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman f159fd8568 rtpvp8pay, rtpvp9pay: expose picture-id as a property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman 38d5899eba rtpvp9pay: tests: remove unused struct and argument on test
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman 11187a81c3 rtpvp9pay: add picture-id-offset property
Bring the VP9 payloader in sync in this regard to the VP8 payloader

Allowing setting the picture id to a known value is useful when testing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman 7cffb40c2e rtpvp9pay: minor refactor of PictureID logic
This brings the logic inline with the vp8pay

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman a79616ea7a rtpvp8pay: avoid reseting PictureID if NO_PICTURE_ID mode is set
There is no logical change here, as `& (1 << nbits) - 1` would produce also 0
when NO_PICTURE_ID mode is choosen. However, this avoid computing a random
integer that is actually unused.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Camilo Celis Guzman 7dd6375c5e rtpvp8pay, rtpvp9pay: use GType like name for PictureIDMode
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
2023-05-05 07:45:19 +00:00
Xabier Rodriguez Calvar 021572de93 qtdemux: emit no-more-pads after pruning old pads
If we don't do that, clients can rely on this signal to see the final pad
topology but it won't be the real one as some of them will disappear after
emitting that signal. This can happen after injecting a different init segment.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4535>
2023-05-03 12:06:00 +00:00
Nicolas Dufresne 3bd43672ec v4l2: device provider: Fix GMainLoop leak
On very quick start/stop, the mainloop may never be run. As a side
effect, our idle stop function is not really being ran, so we can't rely
on that to free the main loop. Simply unref the mainloop when the
thread have completely stop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4521>
2023-05-03 10:04:58 +00:00
Carlos Rafael Giani 3fbcf5fcf3 qtdemux: Only set appsink sync property and check for async state changes
By keeping async to TRUE, a deadlock is avoided where the appsink is
filled with data after a flushing seek but before its PAUSED->PLAYING
state change finishes. If that happens, the appsink is stuck, because
its internal condition variable waits for the appsink to have more room
for data. The basesink's preroll lock is held during this, and it also
tries to acquire that lock during the state change -> deadlock.
By keeping async to TRUE, this flood of data does not happen.

Also, setting the max-buffers property to 1 is unnecessary - the test
runner will anyway detect excess memory usage if it happens.

Other property adjustments turned out to just be redundant.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4200>
2023-05-03 08:47:56 +00:00
Carlos Rafael Giani 0071c97128 qtdemux: Add audio clipping meta when playing gapless m4a content
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4200>
2023-05-03 08:47:55 +00:00
Carlos Rafael Giani 51ebda4df5 qtdemux: use qtdemux debug category instead of default in qtdemux_tags.c
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4200>
2023-05-03 08:47:55 +00:00
Tim-Philipp Müller 83026f6289 amrnb, amrwbdec: move AMR-NB and AMR-WB plugins to -good
Fedora ships these libraries as part of the main distribution now,
and they are decades old anyway so don't implement any of the newer
features.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4512>
2023-05-02 23:33:12 +00:00
François Laignel 5ef2ce69ff rtpmanager/rtsession: race conditions leading to critical warnings
While testing the [implementation for insertable streams] in `webrtcsink` &
`webrtcsrc`, I encountered critical warnings, which turned out to result from
two race conditions in `rtpsession`. Both race conditions produce:

> GLib-CRITICAL: g_hash_table_foreach:
>   assertion 'version == hash_table->version' failed

This commit fixes one of the race conditions observed.

In its simplest form, the test consists in 2 pipelines and a Signalling server:

* pipelines_sink: audiotestsrc ! webrtcsink
* pipelines_src: webrtcsrc ! appsrc

1. Set `pipelines_sink` to `Playing`.
2. The Signalling server delivers the `producer_id`.
3. Initialize `pipelines_src` to establish a session with `producer_id`.
4. Set `pipelines_src` to `Playing`.
5. Wait for a buffer to be received by the `appsrc`.
6. Set `pipelines_src` to `Null`.
7. Set `pipelines_sink` to `Null`.

The race condition happens in the following sequence:

* `webrtcsink` runs a task to periodically retrieve statistics from `webrtcbin`.
  This transitively ends up executing `rtp_session_create_stats`.
* `pipelines_sink` is set to `Null`.
* In `Paused` to `Ready`, `gst_rtp_session_change_state()` calls
  `rtp_session_reset()`.
* The assertion failure occurs when `rtp_session_reset` is called while
  `rtp_session_create_stats` is executing.

This is because `rtp_session_create_stats` acquires the lock on `session` prior
to calling `g_hash_table_foreach`, but `rtp_session_reset` doesn't acquire the
lock before calling `g_hash_table_remove_all`.

Acquiring the lock in `rtp_session_reset` fixes the issue.

[implementing insertable streams support]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1176

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4528>
2023-05-02 21:56:39 +00:00
Xabier Rodriguez Calvar 66c15bc753 qtdemux: Fix segfault in cenc sample grouping
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4523>
2023-05-02 11:32:01 +02:00
Nicolas Dufresne 51fa6a2656 v4l2: pool: Flush events on capture queue
Unfortunately streamoff does not flush the events, and this can cause all
sort of issues. Flush events on capture queue. We also return
GST_V4L2_FLOW_RESOLUTION_CHANGE in case a resolution change was seen.
This allow skipping streamon(capture) on flush, which could lead to a
configuration miss-match, or failure if the buffers aren't of the right
size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 15:08:10 -04:00
Nicolas Dufresne 00492234bd v4l2: videodec: Detect flushes while setting up the capture
As we missed the fact we were flushing, we could create and activate
that buffer pool, and wait on it, causing a hang. We detect that we
are flushing by checking the related pad state.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:45:39 -04:00
Nicolas Dufresne c9841a5383 v4l2: bufferpool: Don't copy buffer when flushing
Threshold handling can race with flushing operation. This can lead to
avoidable buffer copies. Simply check and return the flushing status.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:45:16 -04:00
Nicolas Dufresne c6be3d7505 v4l2: videodec: Don't forcibly drain on resolution changes
Let the driver detects the change and reconfigure the capture side
transparently from there. This avoid reallocation of the output buffers,
and eliminates the need to stop and restart the capture task. This is
only happening if the driver have support for this, otherwise the old
behaviour is maintained.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:44:53 -04:00
Nicolas Dufresne f58d5dfd30 v4l2: videodec: Remove the spurious srccaps probe
We don't need to probe the srccaps in set_format() anymore, this
handled already in the capture thread while setting up the capture
queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:44:41 -04:00
Nicolas Dufresne 4a53beeb1f v4l2: videodec: Improve few logs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:44:37 -04:00
Nicolas Dufresne fca61fad4d v4l2: videodec: Only warn of incomplete drain on success
We may have hit an error, or just flushing in order to stop the thread,
in which case, not having drain everything is expected and not a
driver bug.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:44:19 -04:00
Nicolas Dufresne 4dded20929 v4l2: bufferpool: Don't assert when orphaning is not needed
This may happen when shutting down and should not cause
any harm. This removes the associated assert when shutting
down the pipeline, notably with CTRL+C.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:43:36 -04:00
Nicolas Dufresne 66849fbdd1 v4l2: videodec: Wait for source change event
Stop doing capture buffer allocation based on guesses
and wait for the source change event when available.
Unlike stateless decoder, the stateful decoder is not aware of
the coded resolution, and this may lead to the wrong result
even when using TRY_FMT.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:43:16 -04:00
Nicolas Dufresne 5c820862fd v4l2: object: Move the GstPoll into v4l2object
Moves the GstPoll from the buffer pool into v4l2object. This will be
needed to poll for events before the pool has been created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:43:03 -04:00
Nicolas Dufresne 457dd19a90 v4l2: object: Fix bogus debug objects pointers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:42:59 -04:00
Nicolas Dufresne 52b916bdf5 v4l2: videodec: Move the capture setup into the processing loop
In previous implementation that job was split between handle_frame and
the processing loop and it wasn't clear if this mechanism was race
free. The capture setup would also be tried for every buffer, which was
not necessary.

This also simplify the handling of SRC_CH event, dropping the unneeded
atomic boolean.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:42:35 -04:00
Nicolas Dufresne 1ca7f6949e v4l2: videodec: Ensure object is inactive on failure
Sprinkle stop() calls in error case to guaranty that the capture object
is inactive on failure. Not doing so could allow some code to be called
in unexpected (and possibly undefined) conditions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4437>
2023-05-01 13:42:02 -04:00
jeri.li 2b63e30852 v4l2bufferpool: add lock as atomic operation for seek
When seek flush, gst v4l2 buffer pool flush is not atomic which will
lead double enqueue buffer (qbuf) issue, and v4l2 buffer pool qbuf is
also not atomic which will lead no free buffer found in the pool.
1. add lock for calculate enqueue number in streamon function
2. add lock for v4l2 capture end streamoff in pool flush function
3. lock the whole funciton of v4l2 buffer pool qbuf, then the buffer
   pool index and qbuf operation are atomic

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4465>
2023-05-01 15:53:02 +00:00
Haihua Hu 1c488626da v4l2src: fix cannot reuse current caps when fixate caps in negotiation
when regotiation happens, v4l2src will check if it can reuse current caps,
but we need check if current caps is subset of all query caps from downstream
instead of check it with query caps one by one.

Assuming that the current caps is not the subset of first caps from query caps,
it will go to try fmt. when try fmt success, v4l2src will make pending_set_fmt
to TRUE and going to reset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4500>
2023-05-01 15:05:26 +00:00
Jordan Petridis 8339384d3a jack: return TRUE during init when failing to dlopen
If we return FALSE, that means the plugin won't be tried again,
even if jack is available afterwards.

Followup to 689dbd1fbe

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4507>
2023-04-28 14:57:38 +00:00
Sebastian Dröge 3044b0992f Revert "splitmuxsink: Avoid assertion when WAITING_GOP_COLLECT on reference context"
This reverts commit f29c19be58. If this is
called for the reference context then we would run into an infinite
loop, which is not really better than an assertion.

By fixing up DTS to never be ahead of the PTS in the previous commit
this situation should be impossible to hit now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4498>
2023-04-28 11:00:19 +00:00
Sebastian Dröge de907c225b splitmuxsink: Catch invalid DTS to avoid running into problems later
DTS > PTS makes no sense, so we clamp DTS to the PTS. Also if there's a
PTS but no DTS, then assume that PTS=DTS to make sure we're not working
with a much older DTS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4498>
2023-04-28 11:00:19 +00:00
Sebastian Dröge ef89bac181 rtspsrc: Fix handling of * control path
Regression introduced by 7f9d689572.
Thanks to Tristan Matthews for reporting this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4497>
2023-04-27 13:47:56 +00:00
Sebastian Szczepaniak 277a9f0cef qtdemux: Add support for cenc sample grouping
Co-authored-by: Xabier Rodriguez Calvar <calvaris@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3551>
2023-04-26 18:51:56 +00:00
Thibault Saunier 7aaf2b48ef doc: Avoid shelling out to hotdoc to generate plugins config files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4479>
2023-04-25 02:57:55 +00:00
Guillaume Desmottes d4a9106499 videoflip: check that stream actually changed when resetting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4377>
2023-04-22 14:03:16 +02:00
Guillaume Desmottes 7c4e36acfd videoflip: reset orientation if not present in a tag update
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4377>
2023-04-22 14:02:13 +02:00
Guillaume Desmottes c0fa04fcaf videoflip: handle tag list scopes
STREAM taglist can now overrides the orientation from the GLOBAL
taglist, but not the other way around.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4377>
2023-04-22 14:02:13 +02:00
Guillaume Desmottes 96afec6253 videoflip: reset orientation on new stream
Fix the following use:
- upstream sends a video with a rotation tag, say 90°
- upstream switches to another video without rotation
- the second video was still rotated by videoflip

Fix this by resetting the orientation when receiving STREAM_START.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4377>
2023-04-22 14:02:13 +02:00
Guillaume Desmottes 61a5da1014 videoflip: add test rotating from tags
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4377>
2023-04-22 14:02:13 +02:00
Jordan Petridis 689dbd1fbe jack: Dynamically load libjack at runtime instead of linking
In order to provide build and provide the jack plugin with the prebuilt
binaries of gstreamer we distribute with releases, we can not depend
on an external dependency nor can we ship plugins linking to libraries
we don't provide.

We can also not provide jack ourselves, as it would likely cause a
mismatch with the jack daemon on the host.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4350>
2023-04-20 11:10:15 +03:00
Nicolas Dufresne e709e2d97c meson: Add a wrap file for libgudev
And allow fallback to it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4447>
2023-04-19 22:47:19 +00:00