Commit graph

892 commits

Author SHA1 Message Date
Guillaume Desmottes
d9e8f4054c webrtc: allow PAR change in webrtcsink input caps
We are already allowing resolution changes which can lead to change in
pixel-aspect-ratio.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1830>
2024-09-30 14:40:48 +02:00
Sebastian Dröge
dcb072ee23 webrtc: livekit: Set connection earlier during setup
Otherwise it's not available yet when handling the initial participants
that are already in the session when joining.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1794>
2024-09-30 13:04:24 +03:00
Sebastian Dröge
cd2b641321 livekitwebrtcsrc: Add API for disabling/enabling a track
A disabled track is still negotiated but no data is sent for it
temporarily until it is enabled again.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1794>
2024-09-30 13:04:24 +03:00
Sebastian Dröge
27dc76826e livekitwebrtcsrc: Add pad properties for various LiveKit participant / track metadata
The content of the TrackInfo and ParticipantInfo structs is exposed as
gst::Structure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1794>
2024-09-30 13:04:24 +03:00
Sebastian Dröge
ceb88d960f rtpav1depay: Add wait-for-keyframe and request-keyframe properties
These behave the same as the properties in other depayloaders. Keyframe
detection is based on the N flag in the aggregation header.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/598

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1823>
2024-09-27 12:25:16 +03:00
Mathieu Duponchelle
87c6719e1d webrtcsink: add define-encoder-bitrates signal
When congestion control is used for a session with multiple encoders,
the default implementation simply divides the overall bitrate equally
between encoders.

This is not always desirable, and this patch exposes a new signal
that users can register to, with two arguments:

* The overall bitrate to allocate
* A structure with an encoder.stream_name -> bitrate mapping

Handlers should return a similar structure with a custom mapping.

An example is also provided.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1792>
2024-09-25 15:19:44 +00:00
François Laignel
f532d523b2 webrtcsink: fix RFC7273 attributes
RFC7273 related attributes are set in the SDP offer by passing them via the
transceiver `codec-preferences` signal. These attributes are intended to be set
at the media level so they must be prefixed by `a-` in the `Caps` argument to
the signal. Otherwise they end up under `a=fmtp`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1810>
2024-09-25 09:30:48 +00:00
Mathieu Duponchelle
5c66d8c107 webrtcsrc: ensure source pad has msid when added
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1800>
2024-09-24 14:50:30 +00:00
Mathieu Duponchelle
f70482d9bc webrtcsrc: fix default msid property value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1800>
2024-09-24 14:50:30 +00:00
Mathieu Duponchelle
a85b0cb72e webrtcsrc: expose MSID property on source pad
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1789>
2024-09-20 09:31:57 +03:00
Jan Schmidt
7905626a5f onvifmetadatapay: Set output caps earlier
As soon as input caps arrive, we can set output
caps. This means upstream can send gap events earlier,
before there is any actual metadata to send

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1779>
2024-09-19 20:45:43 +10:00
Mathieu Duponchelle
6a23ae168f webrtcsink: implement mechanism to forward metas over control channel
It may be desirable for the frontend to receive ancillary information
over the control channel.

Such information includes but is not limited to time code metas, support
for other metas (eg custom meta) might be implemented in the future, as
well as downstream events.

This patch implements a new info message, probes buffers that arrive at
nicesink to look up timecode metas and potentially forwards them to the
consumer when the `forward-metas` property is set appropriately.

Internally, a "dye" meta is used to trace the media identifier the
packet we are about to send over relates to, as rtpfunnel bundles all
packets together.

The example frontend code also gets a minor update and now logs info
messages to the console.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1749>
2024-09-19 08:41:47 +00:00
Mathieu Duponchelle
db026ad535 gstwebrtc-api: expose API on consumer-session for munging stereo
We cannot do that by default as this is technically non-compliant,
so we need to expose API to let the user opt into it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1754>
2024-09-19 07:37:23 +00:00
Seungha Yang
1675e517b3 hlscmafsink: Add playlist-root-init property
Adding a property to allow setting base path for init fragment to be
written in manifest file

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1773>
2024-09-11 03:36:08 +09:00
Sebastian Dröge
c505d9a418 Update to async-tungstenite 0.28
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1772>
2024-09-10 09:19:18 +03:00
Sebastian Dröge
24003a79f6 mpegtslivesrc: Make sure to use the object as context for all debug logs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1767>
2024-09-09 13:29:14 +00:00
Sebastian Dröge
c32cb20906 mpegtslivesrc: Check if old compared to new PCR clock estimation is too far off
It the difference between the two estimations is more than 1s then
consider this a discontinuity too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1767>
2024-09-09 13:29:14 +00:00
Sebastian Dröge
c5b1ebc7d8 mpegtslivesrc: Fix order of parameters passed to add_observation()
The first one should be the internal time, i.e. the monotonic clock time
in our case, and the second one the external time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1767>
2024-09-09 13:29:14 +00:00
Sebastian Dröge
44f64fb3f6 mpegtslivesrc: Scale monotonic time on PCR disconts to allow for continuous clock times
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1767>
2024-09-09 13:29:14 +00:00
Sebastian Dröge
453b3014e6 mpegtslivesrc: Set DISCONT flag on buffers at PCR discontinuities
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1767>
2024-09-09 13:29:14 +00:00
Sebastian Dröge
a709eb96d9 Fix new Rust 1.81 clippy warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1768>
2024-09-05 22:01:01 +03:00
Sebastian Dröge
295b9f01c2 ndisrc: Use correct receive time to re-initialize time tracking on disconts
The base receive time should not be the monotonic system clock time, but
the monotonic system clock time adjusted by the current clock calibration.
For the first time this is equivalent as the clock calibration is the default,
but for further discontinuities it is not and would cause a
discontinuity in the clock times at this point.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1766>
2024-09-05 10:18:48 +00:00
Mathieu Duponchelle
bfc32cc692 net/aws: fix spurious dispatch failures
Since https://github.com/awslabs/aws-sdk-rust/discussions/956, the AWS
SDK errors out HTTP streams that do not transfer data for more than 5
seconds.

This probably should be an opt-in bhevior as it clearly not generically
useful, but as it is we need to opt out.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1760>
2024-09-05 07:43:23 +00:00
Mathieu Duponchelle
65508cfe75 net/aws: don't discard errors from transcribe loop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1760>
2024-09-05 07:43:23 +00:00
Arun Raghavan
e72db57179 webrtc: Fix whipclientsink name in README
The element name was changed, but the documentation wasn't updated to
match.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1764>
2024-09-03 16:44:19 -04:00
Sebastian Dröge
871756bb70 ndisrc: Reset timestamp tracking if remote time goes backwards
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 20:53:13 +03:00
Sebastian Dröge
ee4416ee5f ndisrc: Add a clocked timestamp mode that provides a clock that follows the remote timecodes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 20:53:13 +03:00
Sebastian Dröge
ab3db748be ndisrc: Get rid of unnecessary AtomicRefCell dependency
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 16:32:51 +00:00
Sebastian Dröge
0c4ec370cf ndisrc: Remove slope workaround in timestamping code
This was needed for an old version of the NDI HX Camera iOS application
and is fixed since quite a while. Let's get rid of unnecessarily
complicated code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 16:32:51 +00:00
Sebastian Dröge
57821cade4 ndisrc: Only calculate timecode/timestamp mappings if necessary
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 16:32:51 +00:00
Sebastian Dröge
04da3b2047 ndisrc: receiver: Improve debug message when receiving frames
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 16:32:51 +00:00
Sebastian Dröge
84fef267b5 ndisrc: receiver: Remove some code duplication
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 16:32:51 +00:00
Sebastian Dröge
f2658eb773 ndisrc: Move from start/stop to change_state for slight code simplification
All state change related code is in a single place now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
2024-08-29 16:32:51 +00:00
Sebastian Dröge
fc29ff7d8b hlssink3: Update to sprintf 0.2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1757>
2024-08-27 21:06:52 +03:00
Mathieu Duponchelle
2f9bb62b6b gstwebrtc-api: create control data channel when offering
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1755>
2024-08-27 07:52:12 +02:00
Sanchayan Maity
f3206c2e1a aws: Add next-file support to putobjectsink
Add `next-file` support to `awss3putobjectsink` on similar lines to
the `next-file` support in `multifilesink`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1550>
2024-08-26 19:56:34 +00:00
Sanchayan Maity
d274caeb35 whepsrc: Fix incorrect default caps
add-transceiver needs application/x-rtp caps and not raw caps. We were
providing raw caps which is incorrect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1748>
2024-08-26 19:44:37 +05:30
Mathieu Duponchelle
66727188cf net/aws: fix sanity check in transcribe loop
When we receive a new alternative we want to avoid iterating out of
bounds, but the comparison between the current index and the length of
the alternative should not log an error when partial_index == length, as
Vec::drain(length..) is valid, and it is completely valid for AWS to
send us a new alternative with as many items as we have already
dequeued.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1751>
2024-08-26 11:37:08 +02:00
Sanchayan Maity
320f36a462 hlssink3: Use fragment duration from splitmuxsink if available
splitmuxsink now reports fragment offset and duration in the
splitmuxsink-fragment-closed message. Use this duration value
for the MediaSegment when available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1728>
2024-08-22 15:13:21 +00:00
Mathieu Duponchelle
4cf93ccbdb net/webrtc: Add missing npm command to README
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/589

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1746>
2024-08-22 15:46:28 +02:00
Jerome Colle
dee0e32dde webrtcsink: add nvv4l2av1enc support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1735>
2024-08-22 06:41:52 +00:00
Mathieu Duponchelle
8ad882bed5 gstwebrtc-api: address issues raised by mix matrix support
1c48d7065d was mistakenly merged too
early, and there were concerns about the implementation and API design:

The fact that the frontend had to expose a text area specifically for
sending over a mix matrix, and had to manually edit in floats into the
stringified JSON was suboptimal.

Said text area was always present even when remote control was not
enabled.

The sendControlRequest API was made more complex than needed by
accepting an optional stringifier callback.

This patch addresses all those concerns:

The deserialization code in webrtcsink is now made more clever and
robust by first having it pick a numerical type to coerce to when
deserializing arrays with numbers, then making sure it doesn't allow
mixed types in arrays (or arrays of arrays as those too must share
the same inner value type).

The frontend side simply sends over strings wrapped with a request
message envelope to the backend.

The request text area is only shown when remote control is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1725>
2024-08-22 05:54:46 +00:00
Piotr Brzeziński
c4bcdea830 hlscmafsink: Add new-playlist signal
Allows you to switch output between folders without having to state change to READY to close the current playlist.
Closes the current playlist immediately and starts a new one at the currently set location.
Should be used after changing the relevant location properties.
Makes use of the send-headers signal in cmafmux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1692>
2024-08-22 02:06:51 +00:00
Mathieu Duponchelle
5dc2d56c0e webrtcsink: store mids per-session instead of globally
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1730>
2024-08-21 21:20:40 +00:00
Mathieu Duponchelle
16ee51621e webrtcsink: fix segment format mismatch with remote offer
webrtcsink was starting the negotiation process on Ready and concurrently
moving the consumer pipeline to Playing, but when answering the remote
description was set so fast that input streams were connected (and the time
format set on appsrc) before the state change to Paused had completed.

This meant gst_base_src_start was happening after that and setting the format
back to bytes, the time segment that was next coming in then caused:

basesrc gstbasesrc.c:4255:gst_base_src_push_segment:<video_0> segment format mismatched, ignore

And the consumer pipeline errored out.

The same issue existed in theory when webrtcsink was creating the offer,
but was much harder to trigger as it required that the remote answer
came in before the state change to Paused had completed.

This commit fixes the issue by simply waiting for the state to have
changed to Paused before negotiating.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1730>
2024-08-21 21:20:40 +00:00
Piotr Brzeziński
b6406013c5 hlssink3: Fix racy test by separating events (signals) from bus messages
Was regularly failing on the CI. Bus messages are handled async here, so they need to be tracked separately.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1737>
2024-08-21 19:49:09 +00:00
Piotr Brzeziński
982a9a9aea hlssink3: Post hls-segment-added message
Posts a simple 'hls-segment-added' message with the segment location, start running time and duration.
With hlssink2, it was possible to catch 'splitmuxsink-fragment-closed', but since hlssink3 doesn't forward that message
(and hlscmafsink doesn't even use that mux), the new one was added to allow for listening for new fragments being added.

I extended the existing tests to check whether this message is posted correctly.
They theoretically only cover hlssink3, but hlscmafsink uses the same base class so it should be alright for now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1677>
2024-08-20 18:32:59 +00:00
Sebastian Dröge
eb0a44fe67 ndisrc: Move timestamp handling from demuxer to source
This allows putting correct timestamps on buffers coming out of the
source already instead of leaving them unset until the demuxer.

And also calculate timestamps for metadata buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1718>
2024-08-16 06:07:35 +00:00
Mathieu Duponchelle
1c48d7065d gstwebrtc-api example: add support for requesting mix matrix
This is one example of how a consumer might send over custom upstream
event requests to the producer.

As webrtcsink will deserialize numbers in priority as integers, we need
a custom stringifying function to ensure members of the matrix array are
indeed serialized with the floating point.

An optional stringifier parameter is thus added to the
sendControlRequest API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1711>
2024-08-15 15:42:04 +00:00
Mathieu Duponchelle
01e28ddfe2 webrtcsink: implement generic data channel control mechanism ..
.. and deprecate data channel navigation in favor of it.

A new property, "enable-data-channel-control" is exposed, when set to
TRUE a control data channel is offered, over which can be sent typed
upstream events.

This means further upstream events will be usable, for now only
navigation and custom upstream events are handled.

In addition, send response messages to notify the consumer of whether
its requests have been handled.

In the future this can also be extended to allow the consumer to send
queries, or seek events ..

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1711>
2024-08-15 15:42:04 +00:00