Skip to content

Commit 987c449

Browse files
committed
review: address Copilot feedback on ProRes encoder integration
video.h: is_known_video_format() now uses `< SUNSHINE_FORMAT_COUNT` instead of the hardcoded `<= SUNSHINE_FORMAT_PRORES` upper bound. Future codecs are now a one-enum-bump change. video.cpp: require_prores binds to the immutable config::video.prores_mode rather than the mutable active_prores_mode. adjust_encoder_constraints() may demote active_prores_mode to 0; reading the immutable source keeps the "user explicitly asked for forced ProRes" intent intact so we fail loudly instead of silently picking a non-ProRes encoder. cmake/dependencies/macos.cmake: Pull in the SCREEN_CAPTURE_KIT_LIBRARY REQUIRED change too — this PR stacks on the SCK backend PR and needs the same SDK enforcement. Addresses Copilot inline feedback from the closed upstream PR cycle.
1 parent f6ebe21 commit 987c449

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/video.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2968,7 +2968,14 @@ namespace video {
29682968
active_hevc_mode = config::video.hevc_mode;
29692969
active_av1_mode = config::video.av1_mode;
29702970
active_prores_mode = config::video.prores_mode;
2971-
const bool require_prores = active_prores_mode >= 2;
2971+
// Bind `require_prores` to the user-configured value, NOT to the
2972+
// mutable `active_prores_mode` global. `adjust_encoder_constraints`
2973+
// below may demote `active_prores_mode` to 0 when no encoder supports
2974+
// ProRes; reading from the immutable config source keeps the
2975+
// "user explicitly asked for forced ProRes" intent intact across that
2976+
// demotion, so we can fail loudly instead of silently picking a
2977+
// non-ProRes encoder.
2978+
const bool require_prores = config::video.prores_mode >= 2;
29722979
last_encoder_probe_supported_ref_frames_invalidation = false;
29732980

29742981
auto adjust_encoder_constraints_hevc = [&](encoder_t *encoder) {

src/video.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ namespace video {
3131
static_assert(SUNSHINE_FORMAT_PRORES == 3);
3232

3333
inline bool is_known_video_format(int video_format) {
34-
return video_format >= SUNSHINE_FORMAT_H264 && video_format <= SUNSHINE_FORMAT_PRORES;
34+
// Express the upper bound via SUNSHINE_FORMAT_COUNT so adding a future
35+
// codec is purely a matter of bumping the enum — no need to remember
36+
// to update this predicate.
37+
return video_format >= SUNSHINE_FORMAT_H264 && video_format < SUNSHINE_FORMAT_COUNT;
3538
}
3639

3740
inline bool is_video_format_enabled_by_prores_gate(int video_format, int prores_mode) {

0 commit comments

Comments
 (0)