Tell the producer what was lost

The return path. A frame still waiting is asked for by chunk after 64 ms,
then every 32 ms, three times, on the previous receiver's field-tested
cadence; a repair request never asks for a keyframe, since it exists so
that one is not needed. A frame given up on is reported late, and once
per 500 ms a keyframe is requested, because whatever depended on it
cannot be decoded either. Records are built by CultLib's
build_receiver_feedback and sent down the producer's own session on the
media channel; with nobody attached they are counted as not sent rather
than lost quietly.

The loopback test runs the whole path over real sockets: a producer
connects, loses one chunk, is asked for exactly that chunk with no
keyframe request, and when the frame ages out hears it was late and
that a keyframe is wanted.

  cargo test -p ratatoskr-core -> 28 passed

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-10 21:39:33 +02:00
commit 01e8df4072
9 changed files with 642 additions and 43 deletions

View file

@ -72,6 +72,15 @@ void ratatoskr_receiver_video_stats(RatatoskrHandle *handle,
uint64_t *out_repaired_chunks,
uint64_t *out_given_up);
/* What was said back to the producer: records sent, chunks asked for again,
* keyframes requested, and records the transport refused (usually: no producer
* attached). Any out pointer may be NULL. */
void ratatoskr_receiver_feedback_stats(RatatoskrHandle *handle,
uint64_t *out_sent,
uint64_t *out_chunks_requested,
uint64_t *out_keyframes_requested,
uint64_t *out_not_sent);
/* Last error on this thread. Returns the full length; truncates to capacity. */
size_t ratatoskr_last_error(char *buffer, size_t capacity);