Commit graph

19081 commits

Author SHA1 Message Date
Alba Mendez
20e80f1473 rtspsrc: Fix more signals
Behaviour change in GLib causes select-stream signal to discard
the value returned by handlers. See !909 for more info.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/912>
2021-03-19 07:23:42 +00:00
Matthew Waters
612102fdbc gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/911>
2021-03-18 19:52:53 +11:00
Nirbheek Chauhan
95ef0a1df8 Update docs cache and fix before-send signal doc syntax
The docs for before-send were missing because of this

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/909>
2021-03-17 15:55:30 +05:30
Nirbheek Chauhan
73fb107a85 rtspsrc: Fix accumulation of before-send signal return values
Since glib 2.62, the accumulated return values in RUN_CLEANUP override the
accumulated return values in RUN_FIRST. Since:

1. We have a default handler that always returns TRUE, and
2. User handlers are only run in RUN_FIRST, and
3. Our accumulator just takes the latest return value

We were discarding the return value from the user handler and always
sending messages even if the user handler said not to. See
https://gitlab.gnome.org/GNOME/glib/-/issues/2352 for more details.

This signal does not need RUN_CLEANUP or RUN_FIRST, so just change it
to RUN_LAST so that it's emitted exactly once and accumulated once.

With this fix, this signal can now be used to intercept PAUSE when
going to GST_STATE_NULL so that the server does a TEARDOWN (if
necessary) and not a PAUSE, which will confuse other RTSP clients when
playing shared media.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/909>
2021-03-17 14:05:44 +05:30
Nirbheek Chauhan
55edd59f48 Revert unusable workaround for PAUSE being sent when going NULL
Directly setting rtspsrc to the NULL state before putting the pipeline
in the NULL state usually works, but it can cause a deadlock in some
cases, so it's not a reliable mechanism to fix this.

This reverts commit f37afdafff:
"rtspsrc: Fix state changes from PAUSED to PLAYING"

and commit 76d624b2df:
"rtspsrc: Do not send PAUSE command when going to GST_STATE_NULL"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/908>
2021-03-17 14:04:16 +05:30
Sebastian Dröge
00e73e1657 rtpjitterbuffer: Fix parsing of the mediaclk:direct= field
Due to an off-by-one when parsing the string, the most significant digit
or the clock offset was skipped when parsing the offset.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/907>
2021-03-16 18:02:48 +00:00
Nirbheek Chauhan
f37afdafff rtspsrc: Fix state changes from PAUSED to PLAYING
This was accidentally broken in the last commit that touched this
because I missed the fall-through in the case immediately above this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/906>
2021-03-16 00:10:24 +05:30
Sebastian Dröge
242f3cae6d matroskademux: Fix extraction of multichannel WavPack
The old code had a couple of issues that all lead to potential memory
safety bugs.

  - Use a constant for the Wavpack4Header size instead of using sizeof.
    It's written out into the data and not from the struct and who knows
    what special alignment/padding requirements some C compilers have.
  - gst_buffer_set_size() does not realloc the buffer when setting a
    bigger size than allocated, it only allows growing up to the maximum
    allocated size. Instead use a GstAdapter to collect all the blocks
    and take out everything at once in the end.
  - Check that enough data is actually available in the input and
    otherwise handle it an error in all cases instead of silently
    ignoring it.

Among other things this fixes out of bounds writes because the code
assumed gst_buffer_set_size() can grow the buffer and simply wrote after
the end of the buffer.

Thanks to Natalie Silvanovich for reporting.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/859

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/902>
2021-03-15 12:34:49 +00:00
Sebastian Dröge
6c461e90bc matroskademux: Initialize track context out parameter to NULL before parsing
Various error return paths don't set it to NULL and callers are only
checking if the pointer is NULL. As it's allocated on the stack this
usually contains random stack memory, and more often than not the memory
of a previously parsed track.

This then causes all kinds of memory corruptions further down the line.

Thanks to Natalie Silvanovich for reporting.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/858

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/902>
2021-03-15 12:34:04 +00:00
Nirbheek Chauhan
76d624b2df rtspsrc: Do not send PAUSE command when going to GST_STATE_NULL
This usually doesn't matter, but it is disruptive when streaming from
a shared media since it will pause all other clients when any client
exits.

This new behaviour is opt-in and should be safe because you need to
set the NULL state on rtspsrc directly, instead of just on the
pipeline. See the updated documentation for an explanation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/901>
2021-03-15 12:59:09 +05:30
Philipp Zabel
78dec1e403 v4l2object: handle GST_VIDEO_TRANSFER_BT601
V4L2 makes no difference between the BT.601 and BT.709 transfer
functions [1], but GStreamer does since 1.18 [2].

Adapt gst_v4l2_object_get_colorspace() and
gst_v4l2_object_set_format_full().

[1] https://linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/v4l/colorspaces-details.html#colorspace-smpte-170m-v4l2-colorspace-smpte170m
[2] https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/724

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/856>
2021-03-12 16:57:50 +00:00
Mathieu Duponchelle
f2d909eb4e rtspsrc: fix title of a few properties docstrings
GstRtspSrc -> GstRTSPSrc

This would have been noticed by the since checker, but those
properties were introduced prior to that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/899>
2021-03-11 22:22:15 +01:00
Vladimir Menshakov
4de3ddad15 wavpackdec: Add floating point format support
This commit negotiate F32 audio format if MODE_FLOAT used in wavpack file.
Wavpack float mode is always in 32-bit IEEE format.

The following pipeline plays distorted audio if source file is encoded in float mode:
gst-launch-1.0 filesrc ... ! wavpackparse ! wavpackdec ! pulsesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/894>
2021-03-08 15:19:57 +02:00
Matthew Waters
e73559f815 matroska: also support push-mode from seek events sent to the element
Otherwise sending seek events would fail to actually seek.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/891>
2021-03-04 13:28:55 +00:00
Marc Leeman
c7356c70ee gstrtspsrc: 551 should not result in an unhandled error
Some cameras (e.g. HikVision DS-2CD2732F-IS) return "551 Option
not supported" when a command is sent that is not implemented
(e.g. PAUSE). Instead; it should return "501 Not Implemented".

This is wrong, as previously, the camera did announce support for PAUSE
in the OPTIONS.

In this case, handle the 551 as if it was 501 to avoid throwing errors
to application level. */

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/885>
2021-03-04 13:07:49 +01:00
Hou Qi
fc5a1e468b v4l2videodec: Do not expose profiles/levels in vp8/vp9 template caps
Vp8/vp9 supported profiles/levels are listed in decoder sink caps, but
there is no parser for these two formats and the demuxers also don't have
these information. It causes negotiation fail between demuxers and decoder
when check caps "accept = gst_caps_is_subset (caps, template_caps);".
To fix this, need to remove profiles/levels for vp8/vp9 formats in decoder
sink caps.

Fix #854

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/887>
2021-03-03 15:17:58 +00:00
Seungha Yang
614f4ec5b5 rtpmanager: Fix an MSVC compile warning
We don't expect this object is a part of public library.

gstrtphdrext-twcc.c(45): warning C4273: 'gst_rtp_header_extension_twcc_get_type': inconsistent dll linkage

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/889>
2021-03-03 18:30:39 +09:00
Philipp Zabel
e885e0e1d7 v4l2videodec: fix src side frame rate negotiation
Negotiating v4l2h264dec ! v4l2h264enc transcoding pipelines fails in
case the encoder does not accept framerate=(fraction)0/1.
The acquired caps used for downstream negotiation are determined from
gst_v4l2_object_acquire_format(), which sets the GstVideoInfo::fps_n
and ::fps_d fields to 0.
To fix this, copy the frame rate from the sink side.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/882>
2021-02-24 17:15:49 +01:00
Jordan Petridis
1257e50d49 rpicamsrc: depend on posix threads and vchiq_arm
Could only test on rpi 3b+

Close #839

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/875>
2021-02-21 00:18:34 +00:00
Nicolas Dufresne
bb29b8f8d2 v4l2bufferpool: Silence traces around unsupported source change
Don't be too spamy about unsupported source change flags as these will be
commonly extended in the future.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
409ea3ac84 v4l2src: Move preferred resolution query before the probe
As we lock the DV_TIMINGS (and standards in the future), we need to probe the
caps after, otherwise, we may endup fixating to an unsupported resolution,
which would lead to a not-negotiated error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
b530c0ef4e v4l2src: Calculate framerate from DV timings
And use this framerate in our preference. Note that we also flush
the probed caps as it seems that the format enumeration may change
when a new source change event get triggered.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
25696203c3 v4l2rc: Add DV_TIMINGS query and locking
This adds support to DV_TIMINGS query and locking. The timing width and
height is then used as a preference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
b750fb2d5b v4l2src: Force renegotiation on resolution change
As mandated by the specification, make sure to cycle through streamoff
/ streamon regardless if the caps have changed or not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
7b8fe18d06 v4l2object: Remove unused streaming member
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
afb412b75d v4l2src: Refactor to use PreferredCapsInfo structure
Avoid passing around a bare structure for the preference, this removes
the need to copy and free that structure and simplify the code. Also
fix a type in the structure name, Prefered -> Preferred.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
c0fdaffc55 v4l2src: Stub preferred resolution support
This stubs the ability to use preferred resolution from digital
video timings, analog TV standards or driver reported native
resolution.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
1b21c1b15b v4l2: Subscribe source_change for the current input
When we subscribe for source-change event, we need to specify for which
input. Make sure we subscribe for the current input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
c386aa43cc v4l2src: Add input signal status detection
As part of the support to select a preferred size, we can also
detect the signal status. This is a split patch so that feature
is separated to ease review.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
293abe0675 v4l2: Add helper to query input status
This is a wrapper around ENUM_INPUT renamed for readability.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
ba3eddebc8 v4l2: Fix input/output index sign
This is an unsigned integer in the kernel API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
1094e2548e v4l2src: Add source resolution change support
This patch adds support for source resolution change detection.
Resolution change is signaled by drivers when a change in the detected
signal have been detected. This is notably seen on HDMI receivers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
bb1d9b398e v4l2bufferpool: Handle resolution change event
This patch adds the detection, dequeuing and reporting of the SOURCE_CHANGE
event when the CH_RESOLUTION flag is set. The acquire function will now return
a new custom success called GST_V4L2_FLOW_RESOLUTION_CHANGE. In order to use
this new feature, elements must enable it by calling:

  gst_v4l2_buffer_pool_enable_resolution_change (pool);

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
4be9bf4085 v4l2object: Add event helpers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne
954e38a6b9 v4l2bufferpool: use FLOW_LAST_BUFFER
This uses the GST_V4L2_FLOW_LAST_BUFFER alias instead of
GST_FLOW_CUSTOM_SUCCESS to make the code more readable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 15:22:47 -05:00
Lucas Stach
1b1ad32b90 v4l2object: prefer NV12 over I420
Considering NV12 an 'odd' format is a historical artifact. This format
is now quite common, and usually preferable to I420 due to more memory
friendly access patterns.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/857>
2021-02-19 13:12:54 -05:00
Guillaume Desmottes
1796f3f5e4 wavparse: fix seeking in READY state
wavparse claims to be able to support seeking in the READY state by
saving the pending seek event and actually seeking later after having parsed the
header.
Problem was that this seek event was reset on the READY to PAUSED
transition, making all this code useless. Fixing it by stop resetting
on READY to PAUSED transition as we already reset on PAUSED to READY
and when initiating the element.

Note that DTS marker detection isn't support in such scenario as
gst_type_find_helper_for_buffer() needs a buffer containing the
beginning of the stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/879>
2021-02-18 16:32:24 +01:00
Guillaume Desmottes
4aa39da2d3 tests: wavparse: factor out create_pipeline()
No semantic change.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/879>
2021-02-18 10:38:18 +01:00
Mathieu Duponchelle
f07fe93202 docs: update plugins cache with new h264 / vp8 depay properties
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/834>
2021-02-18 01:54:03 +00:00
Mathieu Duponchelle
49de1e6679 rtph264depay: expose request-keyframe property
When set, the depayloader will request new keyframes on packet
loss

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/834>
2021-02-18 01:54:03 +00:00
Mathieu Duponchelle
20fc6da913 rtpvp8depay: expose request-keyframe property
When set, the depayloader will request new keyframes on packet
loss

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/834>
2021-02-18 01:54:03 +00:00
Mathieu Duponchelle
69a43dd00b rtph264depay: expose wait-for-keyframe property
Similar to rtpvp8depay, when packet loss occurs, the depayloader
starts waiting for a keyframe.

We try to only stop waiting when all the packets for the new keyframe
have been received, by only resetting waiting_for_keyframe when
encountering the first packet of a keyframe, this is slightly
fragile because there is no bit that explicitly marks the start
of an access unit, so we rely on the existing picture_start
detection code.

As a consequence, the property is only meaningful when outputting
access units, and is ignored when outputting NALs directly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/834>
2021-02-18 01:54:03 +00:00
Mathieu Duponchelle
e71648e214 videomixer: document as deprecated
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/878>
2021-02-18 01:48:24 +01:00
Ashley Brighthope
2a4c63036b wavenc: Fixed INFO chunk corruption, caused by odd sized data not being padded. Code style was updated.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/873>
2021-02-17 09:54:40 +02:00
Jakub Adam
5fe0aa03eb rtpopuspay: add info regarding (non-standard) multichannel support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/832>
2021-02-11 07:46:04 +00:00
Jakub Adam
748a1866af docs: update plugins cache for rtpopus
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/832>
2021-02-11 07:46:04 +00:00
Jakub Adam
b105797163 tests: add rtpopus multichannel test cases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/832>
2021-02-11 07:46:04 +00:00
Jakub Adam
8f6969429d rtpopusdepay: support libwebrtc-compatible multichannel payload
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/832>
2021-02-11 07:46:04 +00:00
Jakub Adam
b9ed5c7fa0 rtpopuspay: support libwebrtc-compatible multichannel payload
When the audio has more than 2 channels, add optional fields to output
caps from which webrtcbin can generate SDP in the syntax recognized by
"multiopus" codec present in libwebrtc [1].

e.g. for 5.1 audio:

a=rtpmap:96 multiopus/48000/6
a=fmtp:96 num_streams=4;coupled_streams=2;channel_mapping=0,4,1,2,3,5

[1] https://webrtc-review.googlesource.com/c/src/+/129768

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/832>
2021-02-11 07:46:04 +00:00
Jakub Adam
8b4147c757 rtpopuspay: make use of gst_rtp_base_payload_set_outcaps_structure()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/832>
2021-02-11 07:46:04 +00:00