Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(gst-nvdsudp): DHDS, RTP timestamp, ST 2110-40 and Rivermax 1.91 fixes - #113

Draft
garethsb wants to merge 11 commits into
NVIDIA:developfrom
garethsb:feature/h4m-contrib
Draft

garethsb wants to merge 11 commits into
NVIDIA:developfrom
garethsb:feature/h4m-contrib

Conversation

@garethsb

@garethsb garethsb commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fixes to nvdsudpsrc and nvdsudpsink for SMPTE ST 2110 streams, and a build fix for Rivermax 1.91.

  • nvdsudpsrc enables RTP Dynamic Header Data Split (DHDS) on the Rivermax device, so that ST 2110-20 streams with more than one SRD per packet are received correctly. The new enable-dhds property (default true) controls it. When DHDS is active, a header-size below the 32-byte hardware minimum is raised to 32. If an interface does not support DHDS, the element logs a warning and receives without it. With ST 2022-7, DHDS is configured on each leg.
  • nvdsudpsrc and nvdsudpsink derive RTP-timestamp PTS from an offset between the pipeline clock and UTC, so they work when the pipeline clock is not a REALTIME clock. nvdsudpsrc no longer changes the clock type of the shared system clock, which affected every pipeline in the process.
  • nvdsudpsink keeps the parity bits (b8 and b9) of the 10-bit ST 2110-40 Data Count word. It used to keep only the low 8 bits, so the RFC 8331 payload it sent had the parity bits cleared.
  • nvdsudpsink copies each field of interlaced ST 2110-20 video into the packet payload memory separately. It used to copy the frame in a single 2D copy, keeping the source row order, but the payload holds the rows of the first field followed by the rows of the second field.
  • nvdsudpsink sets the RTP timestamp 5 ticks before the media time, as the Rivermax dev kit does, instead of 1 tick.
  • nvdsudpsink uses glibc's CPU_SETSIZE instead of RMAX_CPU_SETSIZE for its thread affinity. Rivermax 1.91's rivermax_api.h no longer includes rivermax_deprecated.h, which defines RMAX_CPU_SETSIZE. Both are 1024.
  • The docs add enable-dhds to the nvdsudpsrc properties tables, state that gst-nvdsudp is tested with Rivermax 1.91.21, and note that Rivermax 1.91 needs ibverbs-providers 63 or newer. CHANGELOG.md lists the fixes.

No related issue.

Reason

These fixes are needed to receive and transmit ST 2110-20 and ST 2110-40 streams in NMOS-controlled pipelines, where the pipeline clock is not always a REALTIME clock, and to build against current Rivermax.

Validation

Item Value
Platform (x86 GPU / Jetson, GPU or board, OS) x86_64, NVIDIA RTX PRO 6000, Ubuntu 24.04
DeepStream version 9.2.0 (develop at 4cc9b11)
Tested commit 5d0f742, tested as 708f0fc, which differs only in documentation and a code comment (the next commit only changes CHANGELOG.md)
Build result (bash ./build/build.sh --package) Not run, see below

This PR only changes gst-nvdsudp, which build/build.sh does not build (see CONTRIBUTING.md). Neither the package build nor the source4 sanity test runs this code, so they have not been run for this PR.

gst-nvdsudp was built with make CUDA_VER=13.2, using the CUDA 13.2 that comes with DeepStream 9.2, against Rivermax 1.91.21, and tested with the pipelines below.

Pipelines used to exercise the changes:

Known limitations:

  • The LEGACY_API=1 build of gst-nvdsudp (legacy_api/) still uses RMAX_CPU_SETSIZE and is unchanged.
  • Built but not tested on Jetson or SBSA.

Checklist

  • My working branch is based on NVIDIA/DeepStream:develop.
  • The PR targets NVIDIA/DeepStream:develop.
  • bash ./build/build.sh --package completed successfully.
  • The source4 sanity test passed with the newly built deepstream-app on x86 or Jetson.
  • The PR records the tested platform, software version, commit, source4 configuration, test duration, and results.
  • Additional tests relevant to the change passed, where applicable.
  • My submitted commits include contributor sign-off (git commit -s).
  • Affected documentation and CHANGELOG.md are updated, where applicable.

By submitting this pull request, you agree to follow our code of conduct and our contribution guidelines. See the pull request guidelines for details.

Co-authored-by: Gareth's 🤖 buddy

@tony-fw

tony-fw commented Nov 5, 2026 •

Copy link
Copy Markdown

Test pipelines for this PR added in a public gist:

The full test plan, with pass criteria and the expected PR vs develop (A/B) result for each test, is the first file. Capture checker scripts and SDP templates are included (git clone https://gist.github.com/d17e07747b3ed515198d46a99f61610d.git).

@garethsb

garethsb commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator Author

I've added three more nvdsudpsink fixes. 2c744ef and 0fe9baf are about TAI and UTC times, and 158e4c3 is about segments that do not start at 0:

  • 2c744ef nvdsudpsink with ptp-src set no longer subtracts the leap seconds from the send times of ANC and RTP packet input. Rivermax compares send times with the PTP clock, which counts TAI, so it used to get send times 37 seconds in the past. The raw video and audio path already made this check.
  • 0fe9baf nvdsudpsink with pass-rtp-timestamp set and no GstRTPTimestampMeta sends RTP timestamps in TAI time, as it does by default. It added the leap seconds to the send time but not to the RTP timestamp, so each packet was sent at TAI time T and stamped with UTC time T. A receiving nvdsudpsrc now needs adjust-leap-seconds=1. When GstRTPTimestampMeta is present, its timestamp is still sent unchanged.
  • 158e4c3 nvdsudpsink with pass-rtp-timestamp set converts the first buffer's PTS to running time before using it for the first RTP timestamp and send time. A buffer is due at the base time plus its running time, not its PTS, so when the segment did not start at 0 the stream was stamped and sent early or late by the difference. This happens, for example, with a demuxer whose segment starts at the first media timestamp. If the first buffer has no valid running time, the sink warns and generates the timestamps from the clock.

0fe9baf also updates the docs: the sink page's RTP time formula, the sink and source pages' description of when the timestamps are in TAI time, and adjust-leap-seconds=1 in the ST 2110-40 receiver examples. 158e4c3 updates the sink page's formula to use the running time. CHANGELOG.md lists all three fixes.

(These three commits have not been built or tested yet. The Validation section above still refers to 5d0f742.)

@garethsb
garethsb force-pushed the feature/h4m-contrib branch 3 times, most recently from b6170c9 to 158e4c3 Compare November 11, 2026 11:05
@tony-fw

tony-fw commented Nov 12, 2026

Copy link
Copy Markdown

Updated the test gist for the current head (158e4c3).

Test plan: https://gist.github.com/tony-fw/d17e07747b3ed515198d46a99f61610d#file-0-st2110-pr113-tests-md
All pipelines: https://gist.github.com/tony-fw/d17e07747b3ed515198d46a99f61610d#file-2-pipelines-md

What changed:

  • Leap seconds (0fe9baf): every receiver with use-rtp-timestamp=1 now uses adjust-leap-seconds=1, including the ST 2110-40 caption receiver and the receivers of pass-rtp-timestamp=1 senders. adjust-leap-seconds=0 is kept only as a negative control: the receiver and the relay should come out 37 s late (T4).
  • clockselect (T5): Run A (with clockselect clock-id=2) and Run B (without), with an automated PTS check on the receiver. If Run B matches Run A, clockselect can come out of the ST 2110-40 sender examples.
  • ptp-src (2c744ef, T9): checks that ANC sent with ptp-src is paced on schedule.
  • Running time (158e4c3, T10): a pass-rtp-timestamp=1 sender started at a 10 s seek (seek_sender.py), so PTS and running time differ.
  • Known gaps outside this PR (T11): ST 2110-40 frames with no ANC data aren't sent (§5.5 keep-alive), and the ANC frame counter advances per packet, not per frame.

New check: st2110_pcap_check.py rtp-offset compares capture time with RTP time. It tells TAI from UTC (37 s) or not-wall-clock, and shows drift, pacing jitter and frame periods with no packet.

garethsb and others added 11 commits November 19, 2026 08:42
nvdsudpsink kept only the low 8 bits of the 10-bit Data Count word when
it parsed ST 2038 input, so the RFC 8331 payload it sent had b8 and b9
cleared instead of the parity bits required by SMPTE ST 291-1 section 6.
Keep the full word, and use its low 8 bits as the number of User Data
Words.

Co-authored-by: Johan Jino <jjino@nvidia.com>
Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
Enable RTP Dynamic Header Data Split on Rivermax devices for correct
ST 2110-20 multi-SRD header data handling. Adds enable-dhds property
(default true), device capability checks, and payload size aggregation.

Co-authored-by: Anthony Walasik <awalasik@nvidia.com>
Co-authored-by: Simon Therriault <stherriault@nvidia.com>
Co-authored-by: Johan Jino <jjino@nvidia.com>
Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
…idance

Subtract 5 from the timestamp as recommended by the Rivermax team.

Co-authored-by: Harsh Sinha <hasinha@nvidia.com>
Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
…dpsrc/sink work on non-REALTIME clocks

The nvdsudpsrc documentation now describes the offset instead of saying
that nvdsudpsrc provides a REALTIME pipeline clock.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
Rivermax 1.91's rivermax_api.h no longer includes rivermax_deprecated.h,
which defines RMAX_CPU_SETSIZE. Use glibc's CPU_SETSIZE from <sched.h>
instead. Both are 1024, so builds against older Rivermax are unaffected.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
Add enable-dhds to the nvdsudpsrc properties tables. State in the
nvdsudpsrc and nvdsudpsink pages and the plugin README that gst-nvdsudp
is tested with Rivermax 1.91.21, and note in the README that Rivermax
1.91 needs ibverbs-providers 63 or newer. Add the gst-nvdsudp fixes to
CHANGELOG.md.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
For interlaced ST 2110-20 video, nvdsudpsink copied the frame into the
packet payload memory in a single 2D copy, keeping the source row order.
The payload holds the rows of the first field followed by the rows of
the second field, so copy each field separately, taking every other
source row.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
…et-list send times with ptp-src

nvdsudpsink computes each send time in TAI. Rivermax compares a send
time with its own clock, which counts TAI when the sink uses the PTP
clock (ptp-src) and UTC otherwise. The raw video and audio path
therefore subtracts the leap seconds only when ptp-src is unset. The
packet-list path, which ANC and RTP packet input use, subtracted them
always, so with ptp-src set it gave Rivermax send times 37 seconds in
the past. Make the same check there.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
With pass-rtp-timestamp set and no GstRTPTimestampMeta on its input,
nvdsudpsink generates each RTP timestamp from the buffer PTS and the
pipeline base time converted to UTC. It added the leap seconds to the
send time but not to the RTP timestamp, so each packet was sent at TAI
time T and stamped with UTC time T. That put the stream 37 seconds off
any ST 2110 receiver, and off a sink with the default
pass-rtp-timestamp=0 in the same pipeline. Add the same offset to the
RTP timestamp, so it is in TAI time, as in the default mode.

When GstRTPTimestampMeta is present, its timestamp is still sent
unchanged.

A receiving nvdsudpsrc now needs adjust-leap-seconds=1, so the ST
2110-40 receiver examples set it. The sink and source pages now name
the remaining case where the timestamps may not be in TAI time: meta
from upstream that is not in TAI time.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
With pass-rtp-timestamp set, nvdsudpsink computes the first packet
time, which sets both the RTP timestamp and the send time, as the
wall-clock time at the pipeline's base time plus the first buffer's
PTS. A buffer is due at the base time plus its running time, not its
PTS, so the stream was stamped and sent early or late by the difference
between the two. They differ when the segment does not start at 0, for
example with a demuxer whose segment starts at the first media
timestamp, or a pipeline started at a seek position. A PTS of
GST_CLOCK_TIME_NONE gave a meaningless time.

Convert the PTS with gst_segment_to_running_time. If the first buffer
has no valid running time, warn and generate the RTP timestamps from
the clock, as with pass-rtp-timestamp=0.

With the render thread, do this before queueing the buffer, so that the
conversion uses the segment the buffer arrived in, not a later one.

Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
@garethsb
garethsb force-pushed the feature/h4m-contrib branch from 158e4c3 to ebdcd39 Compare November 19, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants