This repository has no description

webrtc: pace and stamp playback with real per-sample durations master

PacketizedSegment carried only frame bytes and a segment total, so the sender divided the total evenly across the frames: every sample got the same synthesized duration and the same tick. That respaces non-uniform video — an encoder shedding frames under bandwidth pressure sends bursts and gaps — into a smear: frames display at the wrong times, rubber-banding against the audio. Carry each demuxed sample's real duration instead, derived from successive decode timestamps (so gaps from dropped frames survive, and B-frame decode order stays monotonic), with the buffer's own duration as fallback. The final sample stretches to the segment's end when the track would otherwise finish early, so a single-keyframe segment holds its frame for the full segment rather than letting the video timeline fall behind the audio's. The sender now also waits for both tracks on every segment (previously a segment with no audio left the video writer running unwaited, overlapping the next segment's writes), and catch-up speed only affects pacing — stamped durations stay real, since the receiver's clock is authoritative for playout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>