playback issues

This commit is contained in:
2026-06-04 17:05:58 +05:30
parent 436afcae4c
commit 85b090a8b9
7 changed files with 524 additions and 112 deletions

View File

@@ -309,6 +309,20 @@ impl Drop for DecoderSession {
}
}
/// Pack a frame for the JS wire: 8-byte little-endian i64 frame index
/// followed by the raw JPEG. The backend is authoritative on which frame
/// actually decoded — JS reads the prefix to bind paints to the real frame
/// number rather than the optimistic request, which matters when codec
/// keyframe-snap or seek-ahead returns something other than the requested
/// index. (Today our ffmpeg path is exact-seek so they always match, but
/// the prefix makes the system robust to that ever changing.)
pub fn pack_frame(idx: u64, jpeg: &[u8]) -> Vec<u8> {
let mut out = Vec::with_capacity(8 + jpeg.len());
out.extend_from_slice(&(idx as i64).to_le_bytes());
out.extend_from_slice(jpeg);
out
}
/// Pick a VAAPI render node. `SAM_TOOL_VAAPI_DEVICE` overrides; otherwise we
/// probe `/dev/dri/renderD128..199` for the first that exists. Multi-GPU
/// systems can end up with the integrated card on D128 and a discrete card