Repository navigation
frontend: Add Enhanced Broadcasting encoder overrides - #162
Conversation
|
Thanks, and the manual run evidence is good. Before this can merge, the project needs RED→GREEN automated tests (docs/rust-port/coordination.md section 4; same approach as #112 and #109). Most of this is pure logic that doesn't need a GPU or a live Twitch session:
Commit order: the tests first, failing against stubs or the current code, then the implementation. New cmocka tests go in |
8f7dd9c to
4628a06
Compare
|
The mapping is now plain C, with the tests committed first. RED GREEN
Rebased onto master. The replaced head was The read-only ladder preview is still in this PR. Splitting it can be a follow-up. |
|
Reviewed head 8b1494a. Base is master. The helper split and the test layout are what I asked for, but there is one build break to fix first. Must change before merge:
Non-blocking:
Optional: none. Not ready to merge until item 1 is fixed and CI is green. |
8b1494a to
61eb664
Compare
|
The preview-removal commit is squashed into Please rebase this onto master and stamp it. The replaced head is |
Twitch's Go Live config sets B-frames, lookahead, preset, and tuning. Apply local overrides after that config is loaded. An explicit NVENC lookahead off stays off.
The preset, tune, B-frame, and lookahead table, the Go Live opts filter, and the NVENC lookahead and UHQ decisions are cmocka tests linked to plain C files. Those files return empty results, so test_nvenc_preset_and_tune_table stops on a null preset key and test_explicit_off_beats_preset_lookahead stops because nvenc_lookahead_force_off(true, false) is false. Refs obs-rust#19
mtv_translate_encoder_override maps one UI choice onto NVENC, legacy NVENC, Quick Sync, AMF, x264, SVT-AV1, and AOM. Encoders outside that table keep the service value. obs-nvenc uses nvenc_lookahead_enabled, nvenc_lookahead_force_off, and nvenc_bframes_for_uhq when it programs the session. The cmocka tests added in the previous commit pass: seven multitrack cases and two NVENC cases, including a tune with no equivalent and UHQ forcing at least 4 B-frames. Refs obs-rust#19 Local-Gate: v1 tree=d8043dcdfb165a854609413e95d47c1b9787925c secs=177 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791684336,"gate":"rust/all/fmt","host":"linux-x86_64","key":"72bd0d455d8c5d446e418f551d500b30782f29eb9dd6abb408583a0043fa3859","lane":"lint","parents":["25bfb8ae60ba4d12a6277ce7b4554432e82c9c48"],"secs":93,"stamp":"1e4cd47a13478d94ca8daf16c111cd83","tree":"d8043dcdfb165a854609413e95d47c1b9787925c","v":1,"via":"run"} Ci-Attestation: {"at":1791684336,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"72bd0d455d8c5d446e418f551d500b30782f29eb9dd6abb408583a0043fa3859","lane":"lint","parents":["25bfb8ae60ba4d12a6277ce7b4554432e82c9c48"],"secs":93,"stamp":"f69ce2e3c4863fc51e9db00e36c6bf77","tree":"d8043dcdfb165a854609413e95d47c1b9787925c","v":1,"via":"run"} Ci-Attestation: {"at":1791684336,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"33485dc3078001d9470d1d04eb699382a8abf25acf82763fdcd69a66c05f56a7","lane":"rust-test","parents":["25bfb8ae60ba4d12a6277ce7b4554432e82c9c48"],"secs":36,"stamp":"61b1343643a3bb1cc519c698c43e1cca","tree":"d8043dcdfb165a854609413e95d47c1b9787925c","v":1,"via":"run"} Ci-Attestation: {"at":1791684336,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"f392b4bde3d95281e58453f6b1a042cf05525eec56e03480a70cb24e05ed9767","lane":"tier2-linux","parents":["25bfb8ae60ba4d12a6277ce7b4554432e82c9c48"],"secs":48,"stamp":"05957d5d9606842543c4727f91a5e672","tree":"d8043dcdfb165a854609413e95d47c1b9787925c","v":1,"via":"run"}
61eb664 to
e55ea8d
Compare
|
Verified head
Non-blocking nit: the GREEN |
Fixes #19
@AscendancyDotA this is for the Enhanced Broadcasting lag you reported in obsproject/obs-studio#13933 (Sunshine + Moonlight, NVENC, B-frames and lookahead forced by Twitch). Twitch still chooses the ladder. These controls change the encode on this machine after that config is loaded, and the service does not see them.
The read-only ladder preview is now #181. That PR is independent of this one. It does not change encoder creation.
What changed
lookaheadDepthandenableLookaheadare stripped from Go Liveoptswhen lookahead is disabled. Ultra High Quality still forces at least 4 B-frames, and both the frontend and obs-nvenc log that.Testing
Windows, RTX 4090, this branch. Twitch Enhanced Broadcasting, H.264 ladder, five rungs. Each stream connected and was stopped by the user.
hq: every rung loggedb-frames: 0andlookahead: false (0 frames). The two rungs that asked forlookaheadDepth=4had that option removed.preset: p7andtuning: uhq, thenForcing number of b-frames to 4 for UHQ tune. Lookahead stayed off.preset: p1,tuning: ull,b-frames: 0, andlookahead: false (0 frames). No B-frame force line.Custom RTMP, one rung, connection to localhost refused after the encoder was created:
obs_x264:veryfast/film/bf3 becameultrafast,zerolatency, andbf0. x264 loggedpreset: ultrafastandtune: zerolatency.h264_texture_amfwhile OBS was rendering on the RTX 4090: presetqualitybecamespeed,bf2 became 0, pre-analysis turned off, and theulltune was skipped. Texture init loggedWrong adapterand the AMF fallback encoder loggedpreset: speed,b-frames: 0, andpre-analysis: false.Review follow-up
The preset, tune, B-frame, and lookahead decisions are plain C, committed tests first. The RED stubs return empty:
mtv_translate_encoder_overridezeroes its output,mtv_filter_lookahead_optsclears the destination and returns false, and the NVENC helpers return false or 0.b7edaf098.test_multitrack_encoder_overrideandtest_nvenc_overridelink those stub C files and do not link libobs.test_nvenc_preset_and_tune_tablefails because the preset key is null.test_explicit_off_beats_preset_lookaheadfails becausenvenc_lookahead_force_off(true, false)returns false.61eb66469. Those tests pass: seven multitrack cases and two NVENC cases. They cover the NVENC, legacy NVENC, Quick Sync, AMF, and x264 tables, a tune with no equivalent, UHQ forcing at least 4 B-frames, and strippinglookaheadDepth=/enableLookahead=only when lookahead is disabled.mtv_translate_encoder_overridechooses the setting from the encoder id. Current NVENC writespresetand keepsuhq. Legacy NVENC writespreset2and mapsuhqtohq. SVT-AV1 and AOM keep their integer presets. Any other id keeps the service value. A tune other thanhq,ll,ull, oruhqis skipped. The settings page only stores those four.The ladder-preview removal is squashed into the first commit,
f15525e99, so this history does not add the preview and then delete it. #181 remains its own branch. Replaced head of this rewrite:8b1494afc. This machine has no Docker, so the cmocka CI lane and the local-gate stamp were not run here. The two C tests were compiled and run locally with VS 2022/W4 /WX(nine tests, exit 0).