From e856b2908700a655f078be18a0b2be7a1286187f Mon Sep 17 00:00:00 2001 From: Alexander Clawthorne <55900620+alexander-clawthorne@users.noreply.github.com> Date: Sun, 4 Oct 2026 17:25:57 -0500 Subject: [PATCH 1/2] fix(video): load the H.264 bootstrap cache without statx loadBootstrap sized the cache with File.getEndPos(), which goes through File.stat() and statx. Kernel 4.9 has no statx, so on H700 devices the call failed, the error was swallowed and the saved SPS/PPS were never loaded, although they were written after every session. Read the file into a buffer one byte larger than the limit instead, which also detects oversized files, and log read failures in debug mode. Co-Authored-By: Claude Opus 5.5 --- src/media/video/video_pipeline.zig | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/media/video/video_pipeline.zig b/src/media/video/video_pipeline.zig index 9dded60..5c0c183 100644 --- a/src/media/video/video_pipeline.zig +++ b/src/media/video/video_pipeline.zig @@ -151,10 +151,16 @@ fn loadBootstrap(pipeline: *Pipeline) c_int { return 0; }; defer file.close(); - const size = file.getEndPos() catch return 0; + // Size the cache by reading it: getEndPos() goes through File.stat(), which needs + // statx and fails on the 4.9 kernels H700 devices ship. One spare byte detects an + // oversized file. + var data: [bootstrap_capacity + 1]u8 = undefined; + const size = file.readAll(&data) catch |err| { + if (debugEnabled()) + std.debug.print("Ignoring unreadable H.264 bootstrap cache: {s}\n", .{@errorName(err)}); + return 0; + }; if (size == 0 or size > bootstrap_capacity) return 0; - var data: [bootstrap_capacity]u8 = undefined; - file.reader().readNoEof(data[0..@intCast(size)]) catch return 0; if (c.go_h264_depacketizer_set_bootstrap(pipeline.depacketizer, &data, @intCast(size)) != 0) { if (debugEnabled()) std.debug.print("Ignoring invalid H.264 bootstrap cache\n", .{}); return 0; From c07d5deee1954239524596438f5f664607e1ae97 Mon Sep 17 00:00:00 2001 From: Alexander Clawthorne <55900620+alexander-clawthorne@users.noreply.github.com> Date: Sun, 4 Oct 2026 18:24:29 -0500 Subject: [PATCH 2/2] fix(video): log when the H.264 bootstrap cache is oversized An oversized cache was rejected without a message, so in debug logs it looked the same as a missing one. Log it like the other skipped-cache cases. Co-Authored-By: Claude Opus 5.5 --- src/media/video/video_pipeline.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/media/video/video_pipeline.zig b/src/media/video/video_pipeline.zig index 5c0c183..39a7255 100644 --- a/src/media/video/video_pipeline.zig +++ b/src/media/video/video_pipeline.zig @@ -160,7 +160,12 @@ fn loadBootstrap(pipeline: *Pipeline) c_int { std.debug.print("Ignoring unreadable H.264 bootstrap cache: {s}\n", .{@errorName(err)}); return 0; }; - if (size == 0 or size > bootstrap_capacity) return 0; + if (size == 0) return 0; + if (size > bootstrap_capacity) { + if (debugEnabled()) + std.debug.print("Ignoring oversized H.264 bootstrap cache (over {d} bytes)\n", .{bootstrap_capacity}); + return 0; + } if (c.go_h264_depacketizer_set_bootstrap(pipeline.depacketizer, &data, @intCast(size)) != 0) { if (debugEnabled()) std.debug.print("Ignoring invalid H.264 bootstrap cache\n", .{}); return 0;