github selkies-project/selkies 14234c6

pre-releaseone hour ago

fix(webrtc): Hold the wire to a steered target over a backlog, and cut as soon as a queue stands

Over WebRTC a link that narrowed (congestion_step's 20 -> 1.5 Mbit/s for
5 s) showed a picture 2 s old through the narrow stretch, and a 1.5
Mbit/s link behind a 150 ms queue froze (#574's cell). Two causes:

  • The steer acts once a second, so for most of one the stream went on
    at the old rate into the narrower link, filling its queue and losing
    the rest. Each peer's path queue is now read every 100 ms, and a queue
    of 150 ms runs the tick at once (at most once between two, for a
    display the steer steers), on the rate the path delivered while the
    queue stood and the queue as it stands past the feedback's lag.
  • After a cut the pacer still paced at 2.5x the target, over what the
    encoder sent past it, so the wire carried about the link's rate and
    the queue stood until the link came back. While a backlog of 0.25 s,
    or a queue whose feedback shows the wire cut in several places, stands
    under a steered target, the pace is the target and the video queue
    what it sends in 120 ms: stale frames are dropped at the sender. A
    hold lasts at most 4 s until the queue clears, and gives back the pace
    it found unless a brake took it.

Measured in interleaved pairs, x264 and NVENC (a K80 on driver 470):

  • Step: picture age through the narrow stretch, median 2.2 -> 1.1-1.2 s
    (x264) and 1.8 -> 0.6-0.7 s (NVENC); NVENC's recovery at worst 0.75-1.16
    s -> 70-74 ms, without held frames shown back to back.
  • 1.5 Mbit/s, 150 ms queue: 0-1 fps -> 4-11 fps (x264), and 0-6 fps,
    1.2-2.9 s old -> 57-60 fps, 60-71 ms (NVENC).
  • A steady 5 Mbit/s link within a few ms of before; webrtc_loss_recovery
    at parity.
  • After a step's recovery the audio jitter buffer stays 20-30 ms deeper
    for the 15 s measured (54-55 vs 34-36 ms on NVENC).

Don't miss a new selkies release

NewReleases is sending notifications on new releases.