From 1fa346fd1f280bccde6dde94b92cc7274a83e160 Mon Sep 17 00:00:00 2001 From: VallierDev <49166112@qq.com> Date: Wed, 21 Oct 2026 21:29:23 +0800 Subject: [PATCH] device_capability: list every supported format with its size, not 0x0 (#79) The official viewer (libstreamer, Mac 4.43) treats a video_codec_capability entry with width or height 0 as unsupported. The 4.37 Windows host we copied in #49 ran on a GTX 660 without HEVC/4:4:4, so its 0x0 entries meant exactly that. Evidence by @ferstar in #77. Co-authored-by: VallierDev <24893073+VallierDev@users.noreply.github.com> Co-authored-by: ferstar <2854276+ferstar@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- src/capability.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/capability.rs b/src/capability.rs index 7484034..6d1ed90 100644 --- a/src/capability.rs +++ b/src/capability.rs @@ -35,12 +35,13 @@ pub fn h264_device_capability( /// The payload sits under `data.device_capability` with `type` beside it. The earlier flat shape /// (`type` at the top, fields directly in `data`) was not recognised by the iPhone client, which /// then kept quality and chroma locked at their defaults (#49). Only 8-bit and the chroma formats -/// the encoder really produces are listed; the first entry carries the maximum size as officially. +/// the encoder really produces are listed, each with its maximum size: the official viewer treats a +/// 0x0 entry as unsupported (#77; the 4.37 host we copied had a GTX 660 without HEVC/4:4:4). pub fn device_capability(client_id: &str, ice_id: &str, display_id: i32, fps: i32, codec_impl: i32, hevc: bool, full_chroma: bool) -> Value { let mut codecs = Vec::new(); for codec in [VIDEO_CODEC_H264].into_iter().chain(hevc.then_some(2)) { for chroma in [1].into_iter().chain(full_chroma.then_some(3)) { - let (width, height) = if codecs.is_empty() { (3840, 2160) } else { (0, 0) }; + let (width, height) = (3840, 2160); codecs.push(json!({"video_codec": codec, "chroma_sampling": chroma, "codec_impl": codec_impl, "bit_depth": 8, "width": width, "height": height})); } @@ -86,7 +87,7 @@ mod tests { let caps = &payload["data"]["device_capability"]["video_codec_capability"]; assert_eq!(caps.as_array().unwrap().len(), 4); assert_eq!(caps[0], json!({"video_codec":1,"chroma_sampling":1,"codec_impl":5,"bit_depth":8,"width":3840,"height":2160})); - assert_eq!(caps[3], json!({"video_codec":2,"chroma_sampling":3,"codec_impl":5,"bit_depth":8,"width":0,"height":0})); + assert_eq!(caps[3], json!({"video_codec":2,"chroma_sampling":3,"codec_impl":5,"bit_depth":8,"width":3840,"height":2160})); assert_eq!(payload["data"]["device_capability"]["display_info"][0]["hdr"], -1); let h264_420 = device_capability("c", "i", 0, 60, 5, false, false); assert_eq!(h264_420["data"]["device_capability"]["video_codec_capability"].as_array().unwrap().len(), 1);