Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Latency measurements such as sender to receiver latency measurements using RTP header extensions abs-capture-time and video-timing #425

Merged
merged 30 commits into from
Feb 13, 2025

Conversation

lukehb
Copy link
Contributor

@lukehb lukehb commented Jan 30, 2025

Relevant components:

  • Common library
  • Frontend library
  • Frontend UI library

Problem statement:

Adds optional abs-capture-time RTP header extension to the negotiated SDP (only works with Chromium+audio as of now). Additionally use the video-timing header extension (only works in Chromium+video as of now) to get video statistics from both sender and receiver time including: encoding delay, packetizer delay, pacer delay.

Solution

  1. Adds a new config flag to enable abs-capture-time to RTP header extension
  2. Munges the extension into the SDP
  3. Adds appropriate tests to use this header extension to measure latency using captureTimestamp.
  4. Adds some more latency stats to the frontend stats panel to display the moment to moment latency using information from both abs-capture-time (if possible) and video-timing.

image

Note: these only show up in supported browsers - that is, much of this does nothing on Firefox because many of these code paths are completely skipped on Firefox.

Documentation

N/A - The flag is enabled by default and not exposed to the UI. It should be a transparent change to user and should not need configuration.

Test Plan and Compatibility

All unit tests, playwright tests, and CI have been updated accordingly (this was tricky as testing revealed Firefox refuses to connect if this flag there are too many header extensions so this is carefully skipped on Firefox).

@lukehb lukehb requested a review from mcottontensor January 30, 2025 01:15
@lukehb lukehb added auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5 labels Jan 30, 2025
@lukehb
Copy link
Contributor Author

lukehb commented Jan 30, 2025

Based on this: https://github.com/EpicGamesExt/PixelStreamingInfrastructure/actions/runs/13026995654

@mcottontensor Landing this PR would require new common and lib-pixelstreamingfrontend versions to be cut.

run: npm install && npm run build

- name: Clean build of frontend implementation as ES6
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this step to the CI, as this was actually broken and not being caught.

tag: 'minimal-streamer'
fileName: 'Minimal-PixelStreamer-5.5.7z'
tag: 'minimal-streamer-5.5'
fileName: 'Minimal-PixelStreamer-5.5-Win64-Development.7z'
Copy link
Contributor Author

@lukehb lukehb Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded to using our latest minimal streamer release, as the other one was a bit out of date now.

@lukehb
Copy link
Contributor Author

lukehb commented Feb 7, 2025

Note to self: I need to merge changes from master into here to fix CI and additionally I need to test this change on more browser and devices (iOS / Android / Safari / FF). Done!

@lukehb
Copy link
Contributor Author

lukehb commented Feb 10, 2025

Merged master in now.

Still need to test on devices/browser Done! All good.

Also want to make which capture to send method is used clearer. This is because both video-timing and abs-capture-time both can calculate it, but it is unclear to me if these are the same/similar due to Chrome not yet supporting remote-outbound-rtp stats for video. Because Chrome does not support these stats, I can't calculate capture to send for video using abs-capture-time. Therefore, the current commit falls back to using video timing to calculate capture to send time, but we should make this clearer this approach is used. Done: ee5d7bd

@lukehb lukehb changed the title Add: Optional abs-capture-time RTP header extension to enable browser-side sender to receiver latency measurements Add: Latency measurements such as sender to receiver latency measurements using RTP header extensions abs-capture-time and video-timing Feb 10, 2025
@lukehb
Copy link
Contributor Author

lukehb commented Feb 12, 2025

@mcottontensor When we go to cut a new version from this, there is some API breakages due to some changing of stats casing. So I think we have bump the major version number.

@mcottontensor
Copy link
Collaborator

Do we want to do a full release? Or just common and the frontend libs?

@mcottontensor mcottontensor merged commit 063ca4f into master Feb 13, 2025
9 checks passed
@mcottontensor mcottontensor deleted the capture-time branch February 13, 2025 00:46
Copy link
Contributor

💔 All backports failed

Status Branch Result
UE5.5 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

backport --pr 425

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

mcottontensor added a commit to mcottontensor/PixelStreamingInfrastructure that referenced this pull request Feb 13, 2025
Add: Latency measurements such as sender to receiver latency measurements using RTP header extensions abs-capture-time and video-timing
(cherry picked from commit 063ca4f)
@mcottontensor
Copy link
Collaborator

💚 All backports created successfully

Status Branch Result
UE5.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

mcottontensor added a commit that referenced this pull request Feb 13, 2025
[UE5.5] Merge pull request #425 from EpicGamesExt/capture-time
'Enables the abs-capture-time RTP header extension',
settings && Object.prototype.hasOwnProperty.call(settings, Flags.EnableCaptureTimeExt)
? settings[Flags.EnableCaptureTimeExt]
: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, is it voluntary to enable this by default ? It breaks compatiblity with not up to date Chrome/Chromium browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlamarche Thanks for reporting, I have put together a PR: #516

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants