roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.02k stars 203 forks source link

Improve statistics of late packets in depacketizer #658

Open gavv opened 7 months ago

gavv commented 7 months ago

Problem

Depacketizer class converts sequence of network packets into stream of audio frames.

Among other things, it detects and logs late packets. If packet is missing when it's needed, depacketizer inserts zeros instead of it. If that missing packet arrives later when it's not needed anymore, depacketizer prints messages to log and drops packet.

There are two problems with these log messages:

Solution

  1. Rate-limit messages. Don't report every drop. Instead, report cumulative number of drops periodically. We have core::RateLimiter for this task. You can search code base to see how it is used.

  2. Print additional simple statistics about drops:

    • dropped packet count during period
    • processed packed count during period
    • maximum delay of dropped packet

Delay is the difference of dropped packet timestamp and current depacketizer timestamp, converted to nanoseconds (SampleSpec has a method for it).

Testing

Run roc-recv and roc-send over Wi-Fi. Use loaded or noisy networks and set --sess-latency of roc-recv low enough to observe packet drops.

Docs: https://roc-streaming.org/toolkit/docs/tools/command_line_tools.html

esseciego commented 5 months ago

I would like to work on this issue

gavv commented 5 months ago

Welcome, thanks!

gavv commented 1 month ago

@esseciego Hi! Do you have any plans on this?

esseciego commented 1 month ago

No sorry I don't ;-;;;

gavv commented 1 month ago

@esseciego No worries :)

Unassigning, so that someone could pick this up.