Commit graph

1248 commits

Author SHA1 Message Date
Shengqi Yu
7576d14762 v4l2object: append non colorimetry structure to probed caps
If the stream has a special colorimetry that is not in the colorimetry
list, it will cause negotiation to fail. We should allow passing any
colorimetry, so add an extra structure without the colorimetry field.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7029>
2024-07-31 09:28:18 +00:00
Hou Qi
5dffbd492c v4l2: Fix colorimetry mismatch for encoded format with RGB color-matrix
video-info supports encoded format to have RGB color-matrix, while
v4l2object just leave the v4l2 matrix to default when mapping
GST_VIDEO_COLOR_MATRIX_RGB. It causes gst matrix changed to be
GST_VIDEO_COLOR_MATRIX_BT601 when mapping v4l2 colorimetry.

So add support for encoded format with RGB color-matrix in v4l2object.
Note that for M2M encoders, we should in theory assume that that we can
transfer this value from OUTPUT to CAPTURE queues, though its only true
if the drivers does not do CSC. For now, we don't support any RGB
codecs, but leaving a note for the future.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3952>
2024-07-30 20:26:06 +00:00
Nicolas Dufresne
1ddb8797b5 v4l2object: SRGB colorspace is documented limited-range
Split JPEG and SRGB so that we can follow the specified difference. The
SRGB definition in V4L2 does not follow the standard, and is document
so. This is also why JPEG colorspace exists.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3952>
2024-07-30 20:26:06 +00:00
Nicolas Dufresne
20eb14b85b v4l2object: Fix size of plane_size array calculation
Due to missing parenthesys, only the first element of the array was
being cleared. As it is a staticly sized array in the object, this
code could also be simplified.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3952>
2024-07-30 20:26:06 +00:00
Nicolas Dufresne
152df21644 v4l2object: Fix translation of quantization
The V4L2_MAP_QUANTIZATION macro has been fixed to something a lot saner,
fix our replica accordingly. The new macro now simply set the quantization
to full range is the pixel formats is RGB based, or if the JPEG
colorspace is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3952>
2024-07-30 20:26:06 +00:00
Jan Schmidt
0faec707a0 adaptivedemux: Fail cleanly if parsebin is not installed
Detect a failure to construct a parsebin and error out
cleanly instead of trying to operate on a null pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6969>
2024-07-30 00:06:50 +00:00
Jan Schmidt
213726ca41 adaptivedemux2: Post a bus error when failing to start download
If a download completely fails to start, due to malformed URI or so,
post a bus error instead of just stalling out with no indication
why.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6969>
2024-07-30 00:06:50 +00:00
Jan Schmidt
f2a18ab277 adaptivedemux2: Implement file:// URI handling
Add the ability to play HLS and DASH from local files

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6969>
2024-07-30 00:06:50 +00:00
Jan Schmidt
ef0e822559 hlsng: Check caps are not null after parsing HLS CODECS tag
If the mime codec wasn't recognised, caps will be NULL and cause
a critical

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6969>
2024-07-30 00:06:50 +00:00
Loïc Yhuel
13034cc63f meson: fix SIZEOF_OFF_T when cross-compiling with Meson >= 1.3.0
https://mesonbuild.com/Release-notes-for-1-3-0.html#clarify-of-implicitlyincluded-headers-in-clike-compiler-checks

With only stddef.h, off_t is not defined, so when cross-compiling SIZEOF_OFF_T is -1.
We now use sys/types.h which should define off_t.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7217>
2024-07-23 15:32:22 +02:00
Sebastian Dröge
a786c85c4f taginject: Modify existing tag events of the selected scope
Not doing so would mean that tags would be overidden by any tag events sent by
upstream. Also only send a tag event directly if upstream never sent one.

By default use GST_TAG_MERGE_REPLACE to override tags that exist in both the
upstream event and this element with the ones from this element, but provide a
new "merge-mode" property to adjust the behaviour.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7145>
2024-07-10 13:00:34 +00:00
Sebastian Dröge
a36b3d9fcd taginject: Add getters for the properties
There's no reason why they should be write-only.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7145>
2024-07-10 13:00:34 +00:00
Sebastian Dröge
2ed84fe298 taginject: Use proper GType macro for the GstTagScope enum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7145>
2024-07-10 13:00:33 +00:00
Tihran Katolikian
cc1d978d7f qt6: explicitly specify path to QtGui private headers when including qrhi_p.h
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7131>
2024-07-04 09:52:57 +00:00
Matthew Waters
5bbeccbb65 qml/glsink: also support GLES2 needing shader 'precision' directives
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3616
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7024>
2024-07-02 12:54:59 +00:00
Shengqi Yu
1875c178cd v4l2object: use v4l2 reported width for padded_width when complex video formats
Stride means bytes per line, and padded_width means pixels. Here,
padded_width shoule be pix width reported by v4l2 instead of stride.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7076>
2024-07-01 18:53:04 +00:00
Xavier Claessens
84b3a0950d build: Add missing common options that are yielding in subprojects
- Align `glib_debug`, `glib_assert` and `glib_checks` options with GLib,
  otherwise glib subproject won't inherit their value. Previous names
  and values are preserved using Meson's deprecation mechanism.
- Add `extra-checks` and `benchmarks` options in the main project so it
  can be inherited in GStreamer subprojects.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1165>
2024-06-27 15:53:46 +00:00
Jan Schmidt
73480e60d0 adaptivedemux: Fix handling closed caption streams
Fix a typo "CLOSED_CAPTION" -> "CLOSED-CAPTION" and
a broken if statement that always bailed out for
closed captions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6985>
2024-06-26 13:44:27 +00:00
Tim-Philipp Müller
8d845d4a02 rtpdtmfsrc: minor logging clean-up
Only serialise event structure for debug logging purposes
if logging is actually enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7060>
2024-06-19 07:32:49 +00:00
Tim-Philipp Müller
62047a9f8d rtpdtmfsrc: fix leak when shutting down mid-event
.. and update rtpdtmfdepay unit test to trigger
the potential leak more reliably (without the fix).

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7060>
2024-06-19 07:32:49 +00:00
Tim-Philipp Müller
7d05af9680 rtpdtmfdepay: add unit test for caps fixation issue with downstream audioconvert
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7036>
2024-06-18 00:11:28 +01:00
Tim-Philipp Müller
ab61233f30 rtpdtmfdepay: fix caps negotiation with audioconvert
Specify "layout" field in src template to make sure it's
set and gets fixated properly if the downstream element
supports both interleaved and non-interleaved caps.

Fixes

  gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed

critical with e.g.

  gst-launch-1.0 rtpdtmfsrc ! rtpdtmfdepay ! audioconvert ! fakesink

Not that the layout really matters in our case since we always
output mono anyway, but non-interleaved requires adding AudioMeta,
so this is the easiest fix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7036>
2024-06-18 00:11:28 +01:00
Mathieu Duponchelle
a20ef245a0 rtspsrc: fix invalid seqnum assertions
Upon fatal errors the loop function will first post an error message
then push out an EOS event.

An application may react immediately to the error message by setting the
state of the pipeline to NULL, meaning by the time we push out the EOS
event PAUSED_TO_READY may have reset the seek seqnum to -1.

While this is harmless, the assertion when setting an invalid seqnum
isn't tidy, fix this by simply not resetting to INVALID as it serves no
practical purpose and the next READY_TO_PAUSED will select a new seqnum
anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7032>
2024-06-14 11:28:06 +02:00
Jakub Vaněk
0b65f667af v4l2src: Interpret V4L2 report of sync loss as video signal loss
Certain V4L2 drivers can report that a video receiver is seeing
some signal, but that it is unable to synchronize to it. IOW: the driver
can sometimes report V4L2_IN_ST_NO_SYNC and not report V4L2_IN_ST_NO_SIGNAL.

In particular, I've seen the tc358743 (HDMI-to-CSI2 converter) driver
sometimes report this when deployed to a fleet of embedded Raspberry Pis.
The relevant kernel code is in [1]. The video output is not practically
usable when V4L2_IN_ST_NO_SYNC is reported (only visually corrupted frames,
sometimes with random "snow", are received). I assume that this happens when
either the HDMI cable is poorly plugged in or damaged or when a CSI2 FFC
cable is used and is damaged.

The change in this commit is useful for detecting this working-but-not-really
condition in application code. Applications already listening for the "Signal lost"
message will gain the ability to handle this condition.

There seem to be more V4L2 error flags like this, see [2]. However, I do not
have practical experience with them and adding only V4L2_IN_ST_NO_SYNC seems
like a safer option.

[1]: https://github.com/raspberrypi/linux/blob/be8498ee21aa/drivers/media/i2c/tc358743.c#L1534
[2]: https://www.kernel.org/doc/html/v6.6/userspace-api/media/v4l/vidioc-enuminput.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7021>
2024-06-12 17:26:48 +00:00
Edward Hervey
98e4d90519 adaptivedemux2: Don't send FLUSH_{START|STOP} when losing sync
The initial goal was to support the case where we are paused watching a live
stream, and when we resume we can no longer resume from the previously
downloaded position. In that case we internally do a flushing seek back to the
"current live head position". This was also extended since to be able to
handle (utterly broken) servers when we can't really figure out where we are
anymore and therefore trigger that lost sync so we can try to get back on our
feet.

This does fix the issue... but results in spurious FLUSH_{START|STOP} events
being sent downstream. While that's fine for regular playback scenarios, it's a
bit of a wild scenario since a lot of pipelines/applications don't expect such
events when it wasn't triggered by downstream/application.

Fixes #3605

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7005>
2024-06-12 06:05:24 +00:00
Sebastian Dröge
441e71d1ff flvmux: Use GDateTime instead of gmtime()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6872>
2024-06-06 08:33:51 +00:00
Corentin Damman
bdeabcc4a6 gstqsg6material: fix RGB format support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6991>
2024-06-05 16:49:06 +00:00
Chun-wei Fan
d024ee4303 GTK plugin: Support OpenGL/WGL on Windows
This attempts to implement the gtkglsink element on Windows using WGL,
as there were some more gotchas that are along the way, since we need to
juggle with libepoxy along the way, meaning that we need a recent
GTK+-3.24.x for this to work properly, i.e. the upcoming GTK+-3.24.43.

Since we are essentially using an overlay compositor only during
rendering, move its initialization and destruction into the
gtk_gst_gl_widget_render() function, so that things are safer as we are
doing things across threads between gstreamer (gst-gl) and GTK, as GL
operations, as above, have more gotchas on Windows.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4289>
2024-06-05 08:53:19 +00:00
Piotr Brzeziński
9ca8f16a3b macos: Listen for audio devices being added/removed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6981>
2024-06-01 13:21:59 +00:00
Sebastian Dröge
9b60b32cf8 rtspsrc: Only update from the Content-Base header in the initial OPTION / DESCRIBE response
Some servers send a new content base in the SETUP response, which is
just the non-aggregate control URL of the individual streams.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3563

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6926>
2024-06-01 11:30:44 +00:00
Sebastian Dröge
e65344afac rtspsrc: Handle the case of * as session-wide control URL from the SDP
Just like the comment above says this is supposed to indicate that the
same URL should be used as for the connection so far. If encountering
this case simply do nothing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6926>
2024-06-01 11:30:44 +00:00
Sebastian Dröge
e73e34fd6f rtspsrc: Also handle rtsps:// and similar URLs as absolute in other places
Previously a direct comparison with `rtsp://` was performed, which
didn't catch cases like `rtsps://`.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6926>
2024-06-01 11:30:44 +00:00
Sebastian Dröge
966c39b92e rtspsrc: Don't try the SETUP workaround for broken servers with absolute control URIs
Previously only control URIs that started with "rtsp://" were ignored
but it makes more sense to ignore all absolute URIs.

gst_uri_is_valid() conveniently checks for exactly that.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3563

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6926>
2024-06-01 11:30:43 +00:00
Seungha Yang
fd21d97060 qtdemux: Handle keyunit trick mode in case of push mode too
Skip non-keyframe video frames if trickmode-keyunit flag is set

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5900>
2024-05-31 11:21:55 +00:00
Seungha Yang
05f9eadcaf qtmux: Handle time information value > UINT32_MAX
If any duration in timescale is larger than UINT32_MAX, use version 1
atom, otherwise file header will be constructed with truncated values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6843>
2024-05-28 16:09:58 +00:00
Edward Hervey
c924e4cc1e hlsdemux2: Minor refactoring of starting segment check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
5bc9883d68 hlsdemux2: Be more tolerant when matching segments with PDT
Some servers might not provide 100% matching PDT when doing updates, or accross
variants. This would cause the code matching segments using PDT to fail if the
segment PDT was 1 microsecond (or whatever small value) before the candidate
segment. And would pick the (wrong) following segment as the matching one.

In order to be more tolerant when matching, we instead check whether the
candidate segment is within the first segment of the segment we are trying to
match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
81fd460c90 hlsdemux2: Fix failure to find a replacement segment on resync
If we end up with a segment with an internal time that varies from the supposed
one, this could be for two reasons:
* We guess-timated the wrong segment to go to when advancing or switching
  variants. In that case we try to find the actual segment to go to (just before
  this change).
* There was a complete playlist change (for whatever reason) and we can't find a
  replacement. In that case we want to carry on playback from this position but
  need to remember that we moved (by setting the stream to DISCONT, and
  resetting the new mapping).

Fixes playback on several broken stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
3e810a6721 hlsdemux2: Refactor update of GstHLSTimeMap values
This was also missing transferring the PDT if present

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
9a7f455aea hlsdemux2: Fix parsing of EXT-X-DISCONTINUITY-SEQUENCE:0
Since the default value of `m3u8->discont_sequence` (before parsing of the
playlist data) was 0 .. we would never properly detect the presence of that
field if it was present with a value of 0.

This would later on cause havoc in playlist synchronization where we would
assume it didn't have a discontinuity sequence specified (whereas it did, and it
was 0).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
d2b3262b71 hlsdemux2: Increase tolerance for discontinuity detection
A lot of streams will do a poor job of estimating proper duration of fragments
in the playlist, but over several fragments have it correct.

Instead of constantly trying to realign the estimated stream time, allow for a
more realistic tolerance of 3-4 video frames

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
8b6e7a018c hlsdemux2: Ensure a discont will be set when resetting for lost sync
This is to ensures we inform the demuxer/parsers that what follows is not contiguous

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
836bca461a hlsdemux2: Fix handling of variant switching and playlist updates
When updating playlists, we want to know whether the updated playlist is
continuous with the previous one. That is : if we advance, will the next
fragment need to have the DISCONT buffer set on it or not.

If that happens (because we switched variants, or the playlist all of a sudden
changed) we remember that there is a pending discont for the next fragment. That
will be used and resetted the next time we get the fragment information.

Previously this was only partially done. And it was racy because it was set
directly on `GstAdaptiveDemux2Stream->discont` when a playlist was updated,
instead of when the next fragment was prepared.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
7d49b1cc51 adaptivedemux2: Only set DISCONT on beginning of fragments
This avoids accidentally setting it in the middle of a fragment, which could
cause havoc in demuxer/parsers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Edward Hervey
81c42ee14b hlsdemux2: Fix getting starting segment on live playlists
When dealing with live streams, the function was assuming that all segments of
the playlist had valid stream_time. But that isn't TRUE, for example in the case
of failing to synchronize playlists.

Fixes losing sync due to not being able to match playlist on updates

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
2024-05-28 14:00:57 +00:00
Sebastian Dröge
9156b373e6 rtpbin: Regularly emit the sync signal
Even if no new synchronization information is available.

This is necessary because the timestamp offset logic in rtpbin depends
on the base RTP time that is determined by the jitterbuffer, but this
changes all the time (especially in mode=slave) and the timestamp
offsets have to be updated accordingly. Doing so is especially important
if they're only determined by the RTP-Info, which never changes from the
very beginning.

The interval can be configured via the new min-sync-interval property.
Synchronization happens at least that often, but at most as often as the
old sync-interval property allows.
Both intervals are now based on the monotonic system clock.

Additionally, clean up synchronization code a bit, only emit either
inband NTP or RTCP SR synchronization at the same time, based on which
one has the more recent time information, and only emit RTP-Info
synchronization if it wasn't provided previously at the same time as the
NTP-based synchronization information.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:31 +00:00
Sebastian Dröge
df8c29e340 rtpjitterbuffer: Set max-rtcp-rtp-sync-time to -1 (disabled)
There is generally no requirement to ignore RTCP SR if the RTP time of
the SR differs a lot from the last received RTP packet. The mapping
between RTP and NTP time stays valid until there was a stream reset, in
which case we wouldn't use that information anyway.

When using rtcp-sync-send-time=false the default of 1s difference can
easily be exceeded, e.g. if encoding of the stream after capture adds
more than 1s of latency.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge
95a0649945 rtpbin: Allow synchronizing against RTP-Info without having received any RTCP
Previously the information was provided from rtpjitterbuffer to rtpbin
only once the first RTCP SR was received, which is not necessary at all
as all required information is available from the caps already.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge
8bfba72ea4 rtpbin: Add new never/ntp RTCP sync modes
Never is useful for some RTSP servers that report plain garbage both via
RTCP SR and RTP-Info, for example.

NTP is useful if synchronization should only ever happen based on RTCP
SR or NTP-64 RTP header extension.

Also slightly change the behaviour of always/initial to take RTP-Info
based synchronization into account too. It's supposed to give the same
values as the RTCP SR and is available earlier, so will generally cause
fewer synchronization glitches if it's made use of.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00
Sebastian Dröge
158f12b5da rtpbin: Handle switches between RTP-Info and NTP-based stream association better
Instead of switching on the very first stream, require that all streams
have switched before switching to the different synchronization
mechanism.

Without this there will be a noticeable gap during the switch. E.g. when
going from RTP-Info to NTP-based association, first the first stream
only would get an offset, then the first two, ... then all of them.
Depending on the order of streams this will cause a lot of changes in
ts-offset during the transition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>
2024-05-28 11:52:30 +00:00