Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,12 +1134,16 @@ namespace video {
},
{
// Common options
// Note: max_ref_frames is intentionally omitted for H.264 because
// VideoToolbox on Apple Silicon produces all-IDR output when
// ReferenceBufferCount=1 is set for H.264, causing massive bandwidth
// inflation (~3x) and frame drops. HEVC and AV1 are unaffected and
// retain max_ref_frames=1. See LizardByte/Sunshine#5013.
Comment on lines +1137 to +1141

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Also suppress ctx->refs for H.264 VideoToolbox

For macOS H.264 streams where the client requests numRefFrames=1, this still sets VideoToolbox ReferenceBufferCount=1 through the generic ctx->refs = config.numRefFrames path: validate_encoder() will mark H.264 REF_FRAMES_RESTRICT true after the max-ref probe succeeds, and FFmpeg's VideoToolbox encoder maps avctx->refs > 0 to kVTCompressionPropertyKey_ReferenceBufferCount (per the upstream videotoolboxenc refs patch). So removing only the max_ref_frames AVOption does not avoid the all-IDR Apple Silicon behavior described here; H.264 VideoToolbox needs to opt out of the REF_FRAMES_RESTRICT/ctx->refs path too.

Useful? React with 👍 / 👎.

{
{"allow_sw"s, &config::video.vt.vt_allow_sw},
{"require_sw"s, &config::video.vt.vt_require_sw},
{"realtime"s, &config::video.vt.vt_realtime},
{"prio_speed"s, 1},
{"max_ref_frames"s, 1},
},
{}, // SDR-specific options
{}, // HDR-specific options
Expand Down