diff --git a/crates/pyrowave-sys/vendor/pyrowave/pyrowave_encoder.cpp b/crates/pyrowave-sys/vendor/pyrowave/pyrowave_encoder.cpp index f5ac6dcc..ad4e9746 100644 --- a/crates/pyrowave-sys/vendor/pyrowave/pyrowave_encoder.cpp +++ b/crates/pyrowave-sys/vendor/pyrowave/pyrowave_encoder.cpp @@ -187,8 +187,13 @@ void Encoder::Impl::init_block_meta() meta_buffer = device->create_buffer(info); device->set_name(*meta_buffer, "meta-buffer"); - // Worst case estimate. - info.size = aligned_width * aligned_height * 2; + // Worst case estimate. PUNKTFUNK PATCH (patches/0001-payload-data-444-sizing.patch): + // 4:4:4 carries 3 samples per pixel vs 4:2:0's 1.5 — the same per-sample headroom + // needs twice the bytes, or busy 4:4:4 content overruns this buffer on the GPU and + // corrupts the adjacent meta/bucket allocations (nondeterministic bad bitstreams and + // crashes at ANY target bitrate). Validated on RTX 5070 Ti @1080p/4K, 8/16-bit. + info.size = VkDeviceSize(aligned_width) * aligned_height * + (chroma == ChromaSubsampling::Chroma444 ? 4 : 2); payload_data = device->create_buffer(info); device->set_name(*payload_data, "payload-data");