The keyframe byte was packed as a 4-byte array to satisfy concat(), making the header 16 bytes. Client expected 13 bytes (12 + 1 kf flag), causing every frame's header parse to be misaligned by 3 bytes. Now: header is 12 bytes (w+h+size) sent via concat, then 1 byte kf flag sent separately. Total = 13 bytes, matching client.
- commit
- 4250baa31d5ff11b35b3ebef09a4bb692edb2417
- parent
- 404b0f5ba2855628de24f07a879a1508d7bb5777
- author
- dami etoile <dami.etoile@gmail.com>
| M | src-tauri/ | 6 | +++--- |
@@ -636,17 +636,17 @@ async fn stream_frames(conn: Connection) -> anyhow::Result<()> {
636636 };637637 let h264_size = h264_data.len();638638 639- // Header: width(4) + height(4) + size(4) + is_keyframe(1)640- let kf_byte = [0u8, 0u8, 0u8, if is_keyframe { 1u8 } else { 0u8 }];639+ // Header: width(4) + height(4) + size(4) + is_keyframe(1) = 13 bytes641640 let header = [642641 (w as u32).to_be_bytes(),643642 (h as u32).to_be_bytes(),644643 (h264_size as u32).to_be_bytes(),645- kf_byte,646644 ]647645 .concat();646+ let kf_byte = if is_keyframe { 1u8 } else { 0u8 };648647 649648 send.write_all(&header).await?;649+ send.write_all(&[kf_byte]).await?;650650 send.write_all(&h264_data).await?;651651 652652 frame_count += 1;