Skip to content

RTCP improvements #674

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

Open
3 of 12 tasks
gavv opened this issue Jan 20, 2024 · 3 comments
Open
3 of 12 tasks

RTCP improvements #674

gavv opened this issue Jan 20, 2024 · 3 comments
Assignees

Comments

@gavv
Copy link
Member

gavv commented Jan 20, 2024

Follow-up for #14 and #675.

  • Refine packet counter calculation. On receiver, derive it from packet_count in SR, and handle 32-bit wraps. On sender, derive it from ext_first_sn and ext_last_sn, and also handle 32-bit wraps. (add rtcp::PacketCounter)
  • Add fract_loss calculation - loss ratio since last report. (add rtcp::LossEstimator)
  • Use receive timestamp (RTS) as report time when processing RTCP report.
  • Support multiple sources on sender (for cases like RaptorQ).
  • Implement rtcp::IntervalComputer (computes packet generation interval according to algorithm from RFC 3550) and use in rtcp::Communicator instead of hard-coded 200ms report interval.
  • Add sliding window to rtcp::RttEstimator. Compute moving minimum RTT, and average clock_shift based on it. Adjust communicator RTT tests to ensure that sliding window improves RTT & clock offset estimation precision.
  • Implement RTCP BYE exchange. Handle exit by signal and ask pipeline to generate BYE. Processing of BYE is already implemented.
  • Fix RTCP multicast support. If receiver RTCP endpoint is bound to multicast address, it should use Report_ToAddress instead of Report_Back mode.
  • Always collect metrics for all receivers in FeedbackMonitor. If single-receiver mode is enabled, additionally create latency tuner, otherwise just collect metrics. Needed for Metrics API #681.
  • Implement local SSRC change in FeedbackMonitor when latency goes out of bounds (to initiate session restart on remote side).
  • Schedule pipeline refresh() according to nearest deadline returned from RTCP.
  • Handle system clock jumps in pipeline (since it breaks RTCP).
@gavv gavv changed the title RTCP support improvements RTCP improvements Jan 23, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Jan 30, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Jan 31, 2024
If receiver RTCP endpoint is bound to multicast address, it
now uses Report_ToAddress instead of Report_Back mode.
This was referenced Jan 31, 2024
gavv added a commit to gavv/roc-toolkit that referenced this issue Feb 5, 2024
- packet_count: On receiver, derive it from packet_count in SR,
  and handle 32-bit wraps. On sender, derive it from ext_first_sn
  and ext_last_sn, and also handle 32-bit wraps

- fract_loss: automatically calculate loss ratio since last report
  based on packet_count and cum_loss
gavv added a commit to gavv/roc-toolkit that referenced this issue Feb 5, 2024
- packet_count: On receiver, derive it from packet_count in SR,
  and handle 32-bit wraps. On sender, derive it from ext_first_sn
  and ext_last_sn, and also handle 32-bit wraps

- fract_loss: automatically calculate loss ratio since last report
  based on packet_count and cum_loss
@gavv gavv added this to Roc Toolkit Jul 6, 2024
@gavv gavv moved this to Frontlog in Roc Toolkit Jul 6, 2024
@gavv gavv moved this from Frontlog to In work in Roc Toolkit Dec 4, 2024
baranovmv added a commit to baranovmv/roc-toolkit that referenced this issue Dec 4, 2024
In order to be able to tune receiver's latency
relying on timestamp mapping that we get from
RTCP feedback, and UDP::Receive_timestamp,
adding these features:

* roc-streaminggh-674: Use receive timestamp (RTS) as report time
  when processing RTCP report;

* RTT dumping for debugging (csvplotter ts_offset branch);

* SCHED_RR for network io thread (run with root privs).
baranovmv added a commit to baranovmv/roc-toolkit that referenced this issue Dec 4, 2024
In order to be able to tune receiver's latency
relying on timestamp mapping that we get from
RTCP feedback, and UDP::Receive_timestamp,
adding these features:

* roc-streaminggh-674: Use receive timestamp (RTS) as report time
  when processing RTCP report;

* RTT dumping for debugging (csvplotter ts_offset branch);

* SCHED_RR for network io thread (run with root privs).
baranovmv added a commit to baranovmv/roc-toolkit that referenced this issue Dec 19, 2024
In order to be able to tune receiver's latency
relying on timestamp mapping that we get from
RTCP feedback, and UDP::Receive_timestamp,
adding these features:

* roc-streaminggh-674: Use receive timestamp (RTS) as report time
  when processing RTCP report;

* RTT dumping for debugging (csvplotter ts_offset branch);

* SCHED_RR for network io thread (run with root privs).
@gavv
Copy link
Member Author

gavv commented Dec 31, 2024

Results of first 3 tests - good wifi, bad wifi, and ethernet: https://github.com/roc-streaming/qa/tree/326e7ef46c4e9ec1c98f5af66345432732fc9983/reports/20241230_gh674_clock_offset

I think we need to try more aggressive smoothing of clock offset, which is especially notable on the second tests where RTT jitter was high.

However, even in that test, clock offset jitter was below 1ms, and 95-percentile of clock offset jitter was 60 microseconds, which I think is already cool!


Note: all these tests were done without SCHED_RR (no root) and when input & output are files.

I plan to do tests with SCHED_RR separately to see what effect does it have. (BTW we probably want SCHED_RR in both netio and sndio threads, not just netio).

PulseAudio & ALSA are to be handled separately as well (I guess not in this issue).


My next step will be to pass clock offset to e2e latency, enable latency tuning based on e2e, and build test bench to measure actual latency using signal-estimator. These experiments are going to be quite time consuming, so before I start:

  1. Do we want to try any other modifications of the algorithm?
  2. Do we want to include additional statistics in measurements and reports?

@baranovmv Let me know if you have suggestions.

@baranovmv
Copy link
Member

baranovmv commented Dec 31, 2024

Thank you for so thorough evaluation

It might be more representative to compute RTT and Clock offset statistics on data which wasn't smoothed by median

    RttOffsetPair p;
    p.rtt = rtt;
    p.offset = clock_offset;
    rtt_stats_.add(p);
    RttOffsetPair min = rtt_stats_.mov_min();
    
    //    metrics_.clock_offset = clock_offset;
    //    metrics_.rtt = rtt;
    metrics_.clock_offset = min.offset;
    metrics_.rtt = min.rtt;

To be continued...

@gavv
Copy link
Member Author

gavv commented Dec 31, 2024

It might be more representative to compute RTT and Clock offset statistics on data which wasn't smoothed by median

Indeed, though probably only rtt? Because our goal is to minimize jitter of clock offset after smoothing, not before.

baranovmv added a commit to baranovmv/roc-toolkit that referenced this issue Feb 1, 2025
In order to be able to tune receiver's latency
relying on timestamp mapping that we get from
RTCP feedback, and UDP::Receive_timestamp,
adding these features:

* roc-streaminggh-674: Use receive timestamp (RTS) as report time
  when processing RTCP report;

* RTT dumping for debugging (csvplotter ts_offset branch);

* SCHED_RR for network io thread (run with root privs).
baranovmv added a commit to baranovmv/roc-toolkit that referenced this issue Feb 9, 2025
In order to be able to tune receiver's latency
relying on timestamp mapping that we get from
RTCP feedback, and UDP::Receive_timestamp,
adding these features:

* roc-streaminggh-674: Use receive timestamp (RTS) as report time
  when processing RTCP report;

* RTT dumping for debugging (csvplotter ts_offset branch);

* SCHED_RR for network io thread (run with root privs).
baranovmv added a commit to baranovmv/roc-toolkit that referenced this issue Feb 12, 2025
In order to be able to tune receiver's latency
relying on timestamp mapping that we get from
RTCP feedback, and UDP::Receive_timestamp,
adding these features:

* roc-streaminggh-674: Use receive timestamp (RTS) as report time
  when processing RTCP report;

* RTT dumping for debugging (csvplotter ts_offset branch);

* SCHED_RR for network io thread (run with root privs).
@gavv gavv removed the enhancement label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In work
Development

No branches or pull requests

2 participants