Repository navigation
OBS mode: the game waits for OBS to record before each clip, and a late-started take isn't counted captured (#1109) - #1185
Merged
Conversation
…late start isn't captured (#1109) The hook's batch pauses the demo at every AUDIO_SYNC (a `ds_capture_batch wait_for_recording` line Studio writes in OBS mode) and tells Studio; Studio starts OBS on that marker as before and sends `ds_capture_batch recording` once OUTPUT_STARTED is in. No go-ahead in 20 s: the clip plays on; Studio gone for 10 s: the batch ends as the space hold does (#885). Safety net: OUTPUT_STARTED's arrival is held against the clip's START_RECORD marker's, both stamped when read. A take OBS started after the clip did is not captured, Render While Capturing skips it, and Last Batch says by how many ms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Studio hears the wait only over the events pipe; without it the lead-in plays on as before and the late-start check stays the net. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The wait line follows the clip's AUDIO_SYNC echo, the marker OBS starts on, rather than the sys_sound beside it, so a clip chained to the one before (no sound flush, #1169) waits for its recording too once it has its own AUDIO_SYNC. - ds_capture_batch stop puts the demo's pause back, so a batch stopped while it waited for OBS (or held, #861) never leaves the demo paused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Review (review-night)Verdict: ready to merge, with the dev merge and the two fixes in 7fd2f42 (pushed). Merged dev (9764f04)dev merged in with no conflicts, including #1167's split of
Fixes pushed (7fd2f42)
Checked: can the wait hang or leave the demo paused?
Checked: the late-start timestamps
Checked: Render While Capturing and #1171
LiveAn OBS batch on POST with a chained pair, run on this branch plus #1186, goes in a results comment on #1186 (the game was busy with another test when this was posted). 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release note: Fixed: In OBS mode the game now waits for OBS to start recording before each clip plays, and a take OBS started late is no longer counted as captured.
Closes #1109.
What changes
Prevent it (the user's idea on the issue). With the hook running the batch (Seek Between Clips) in OBS mode, Studio writes a
ds_capture_batch wait_for_recordingline at every clip'sAUDIO_SYNC(native::patch::runtime_batch). There the hook (goldsrc-hooks/src/batch.rs, newWaitingForRecordingphase beside #885's hold):BATCH_WAITING_FOR_RECORDINGon the events pipe;AUDIO_SYNCmarker as before and waits forOBS_WEBSOCKET_OUTPUT_STARTED;ds_capture_batch recording(capture_engine::RecordingGoAhead); the hook plays on.The lead-in then plays its full second with OBS already recording, however slow the start.
studio_gone,batch_end::batch_ended).GOLDSRC_HOOKS_EVENTS=0): no wait, since Studio couldn't hear it.The safety net (the issue body). Every
Markernow carries when its reader read it (at), andObsClient::start_recordreturns whenOUTPUT_STARTEDwas read. At a clip'sSTART_RECORD,ObsSessionchecks the two. If OBS started after the clip did, the engine sendsEngineEvent::ObsStartedLate, and then:started_late_ms,mark_started_late);This net covers a hook DLL without the wait, a patched batch, and a wait that timed out.
Decisions
start_recordgives up after about 16 s (750 ms + one retry with 15 s), and when it does, the batch already ends onObsSession::refused/dead. So 20 s only trips when Studio's answer got lost. Playing on keeps the rest of the batch, and the safety net marks that one take. Ending the batch is kept for "Studio gone", as the issue comment says.atline running ads_capture_batchsubcommand, not a new batch-file keyword. A new keyword would make an older hook DLL refuse the whole batch file ("unknown line"). An unknown subcommand only prints the usage.AUDIO_SYNCmarker. A go-ahead that is late after a timeout is harmless: entering the next wait clears it.cut_short.cut_shortmeans the batch's end cut a clip (cut_by), so reusing it would have read "Cut short by Cancel".recordingandwait_for_recordingare subcommands ofds_capture_batch. Commands.txt's usage line anddocs/dodstudio_commands.mdsay so, andconsole_commands_data.jsis unchanged.Test done
Unit tests:
recording_wait(go / gone / timeout) and the wait line's text;cargo test -p goldsrc-hooks --target i686-pc-windows-msvc;runtime_batchwrites the line only in OBS mode atsys_sound;RecordingGoAheadcounting, including a hook DLL that never asks;ObsSessionreports a late start once and not an early one;mark_started_late;resultsOfshowslate;takesFoundMissingnames late takes.Runs: workspace tests (minus hooks and web-analyzer), clippy on host and i686, rustfmt, vitest (127 files), and e2e
app-boot,batch-resultsandfinish-clips.Some failures are not from this PR.
obs::provisionfake-OBS tests and onepipe_tailtest failed only intermittently here, with connect timeouts (os error 10060) and a pipe-name clash under load from parallel agents. They passed in the final full workspace run after merging dev, and those files are untouched.Live, Brain account, game lock held, own Studio (Vite 5192, CDP 9232, settings in a scratch folder), OBS 32 on this PC, 120 fps, 1280x720, demo
wsod25_grp5_h1_m00cat.dem(m00cat's POV):The checks the issue asked for:
local\review-images\1109\head_b0.pngin the main checkout.Not tested live: Studio closing mid-wait (the "Studio gone" ending). It is the #885 space hold's
studio_gonewith the same 10 s, unit-tested inrecording_wait.Found on the way
#1169: in OBS mode a clip chained to the one before it has no
AUDIO_SYNC, so OBS never records it, and later clips land in the wrong take folders. Read from the code; it is out of scope here.🤖 Generated with Claude Code