Fix silent frame-chain corruption on EnqueueFrame rejection; revert to 720p
Root cause (found by Opus 5 second-opinion review) of the freezing that survived every prior fix tonight: openscreen's Sender caps in-flight unacknowledged media at clamp(2*RTT, 66ms, 133ms) -- on a LAN that's pinned at the 66ms floor, about two frames at 30fps. When EnqueueFrame rejects a frame under that budget, facade.cc discarded the result (`(void)video_sender->EnqueueFrame(frame)`) and moved on. But vah264enc had already encoded the *next* frame as a P-slice depending on the one that just got silently dropped -- the encoder has no idea the drop happened, since it happens downstream of encoding, at this FFI boundary. The receiver sees an unbroken frame-ID sequence (nothing here told it otherwise) and decodes a P-slice against a reference picture it never received: a stuck/corrupted frame until the next regularly-scheduled key frame (up to ~2s, longer if that key frame is itself dropped the same way -- explains the 20+s outlier). Zero "receiver reported picture loss" lines across 195s of a visibly freezing session confirms the receiver genuinely never noticed anything was wrong, which a real decode-capability or packet-loss problem would have triggered. This also explains why moving to a faster network made it *worse*: the in-flight budget is RTT-derived, not bandwidth-derived, so more throughput doesn't raise the 66ms floor at all -- while 1080p tripled the per-frame packet count, increasing how often frames missed that window. Fixed the actual corruption: both drop paths in facade.cc (the EnqueueFrame rejection, and the pre-existing non-monotonic-capture-time guard) now set a `frame_chain_broken` flag, consumed once by breadcast_caststream_sender_needs_key_frame() so frame_pump_loop forces a key frame on the very next frame instead of chaining more P-slices onto a reference that no longer exists on the receiver. A separate flag from the existing `needs_key_frame` atomic because SchedulePoll's 100ms timer unconditionally overwrites that one with the Sender's own (unrelated) NeedsKeyFrame() reading, which would have silently clobbered this signal. Also reverted the Cast Streaming pipeline from tonight's 1080p experiment back to 1280x720 (build_video_pipeline_for_streaming + VideoParams::default(), which must agree -- a mismatch there is a separate protocol-level bug fixed earlier tonight). Not the root cause, but a real contributing factor per the packet-count reasoning above, and untangling it from the frame_chain_broken fix by changing both at once would make the next test ambiguous. Kept the 6000/1500 kbps bitrate range from earlier tonight, now actually paired with 720p for the first time. The deeper real fix -- raising openscreen's 66ms in-flight floor itself, which trades latency for headroom -- is out of scope for tonight; this targets the corruption mechanism (via the sanctioned, if awkward, needs_key_frame signal) without touching vendored openscreen constants.
This commit is contained in:
parent
a058482b39
commit
22a18eee1b
4 changed files with 55 additions and 26 deletions
|
|
@ -55,12 +55,14 @@ impl Default for VideoParams {
|
|||
// a resolution other than what's actually sent is a real
|
||||
// protocol mismatch that plausibly explains a receiver decoder
|
||||
// corrupting/freezing rather than just looking soft.
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
// Reverted from a brief 1920x1080 experiment -- see
|
||||
// `build_video_pipeline_for_streaming`'s doc comment for why
|
||||
// (the freeze wasn't a resolution/bandwidth problem at all).
|
||||
width: 1280,
|
||||
height: 720,
|
||||
// Kept equal to `breadcastd::cast_mirror::MAX_BITRATE_KBPS *
|
||||
// 1000` -- see that constant's doc comment for why 8 Mbps
|
||||
// (this struct's previous value) isn't used here even though
|
||||
// 1080p can look better with more headroom: real hardware
|
||||
// (this struct's previous value) isn't used here: real hardware
|
||||
// testing showed the AIMD probe pinning to whatever this
|
||||
// ceiling is for the entire session once the estimator reports
|
||||
// (unreliably) that there's room, and 8 Mbps sustained was more
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue