autoconfig remake apiv2 #1677
Open
summeroff wants to merge 4 commits into
Open
Conversation
3 tasks
9eb0914 to
42a1389
Compare
f2963eb to
bd7b35b
Compare
bd7b35b to
0887359
Compare
Resolved conflicts: - obs-studio-client/source/video.cpp: keep staging's ValidateResponse check in Video::set; do not reintroduce the lastVideo cache (removed on this branch). - obs-studio-server/source/osn-simple-streaming.cpp: keep this branch's reconnect guard plus staging's GetCanvasVideo and encoder-compatibility guards. - js/module.js: regenerated from merged module.ts via build:javascript. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Ports the autoconfig pipeline to an APIv2-style contract by passing explicit streaming targets from the client, applying results directly to live OBS objects (instead of persisting to basic.ini), and adding structured telemetry (resource usage + summary JSON) with a new v2-focused test suite.
Changes:
- Reworks autoconfig initialization to accept
IStreaming[], adds new autoconfig event types (with optional JSON payloads), and exposesGetAutoConfigSummary(). - Implements multi-target bandwidth testing + “apply results” that updates live services/encoders/video contexts, plus resource-usage sampling.
- Adds a mock RTMP server and a new autoconfig-v2 mocha test suite; skips the legacy autoconfig test suite as deprecated.
Reviewed changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/osn-tests/util/obs_handler.ts | Updates autoconfig test harness to pass streaming targets and handle payload-bearing events. |
| tests/osn-tests/util/mock_rtmp.ts | Adds node-media-server-backed RTMP mock for bandwidth tests. |
| tests/osn-tests/src/test_osn_autoconfig_v2.ts | New autoconfig v2 tests covering bandwidth, apply, cancellation, dual-target, and resource telemetry. |
| tests/osn-tests/src/test_nodeobs_autoconfig.ts | Marks legacy suite deprecated and skips it; adjusts to new autoconfig signature. |
| package.json | Adds node-media-server + typings for RTMP mock tests. |
| obs-studio-server/source/util-crashmanager.cpp | Adds nodeobs_service include (build dependency adjustments). |
| obs-studio-server/source/osn-video.cpp | Comments out legacy stopConnectingOutputs guard (needs safe replacement). |
| obs-studio-server/source/osn-streaming.hpp | Adds test-mode state + autoconfig hooks (start/checkOutput/testBandwidth/CleanTestMode). |
| obs-studio-server/source/osn-streaming.cpp | Implements testBandwidth/CleanTestMode; adds testQuery and testMode Query behavior. |
| obs-studio-server/source/osn-streaming-helpers.hpp | New helper to select output type from a service without legacy OBS_service API. |
| obs-studio-server/source/osn-simple-streaming.hpp | Refactors streaming start pipeline into overrides used by autoconfig hooks. |
| obs-studio-server/source/osn-simple-streaming.cpp | Implements SimpleStreaming::start/checkOutput and output-type selection via new helper. |
| obs-studio-server/source/osn-simple-replay-buffer.cpp | Updates to new SimpleStreaming encoder update method name. |
| obs-studio-server/source/osn-simple-recording.cpp | Updates to new SimpleStreaming encoder update method name. |
| obs-studio-server/source/osn-advanced-streaming.hpp | Adds start/checkOutput overrides for autoconfig hooks. |
| obs-studio-server/source/osn-advanced-streaming.cpp | Adds start/checkOutput and switches output-type selection to new helper. |
| obs-studio-server/source/osn-advanced-replay-buffer.cpp | Minor include fix for std::replace usage. |
| obs-studio-server/source/nodeobs_autoconfig.h | Updates IPC surface (binary InitializeAutoConfig, summary IPC, v2 bandwidth thread decls). |
| obs-studio-server/source/nodeobs_autoconfig.cpp | Major autoconfig v2 rewrite: per-run context, multi-target bandwidth test, apply-to-live-objects, telemetry, summary JSON. |
| obs-studio-server/source/nodeobs_autoconfig_resource_sampler.h | Adds CPU/RAM/GPU telemetry sampler API for autoconfig phases. |
| obs-studio-server/source/nodeobs_autoconfig_resource_sampler.cpp | Implements percentile-based resource sampling with optional DXGI VRAM stats on Windows. |
| obs-studio-server/source/nodeobs_api.h | Comments out nodeobs_service include (impacts transitive dependencies). |
| obs-studio-server/source/nodeobs_api.cpp | Re-adds nodeobs_service include in cpp (dependency wiring). |
| obs-studio-server/CMakeLists.txt | Adds new resource sampler sources to server build. |
| obs-studio-client/source/video.hpp | Adds canvasId accessor to expose server-side canvas id to JS. |
| obs-studio-client/source/video.cpp | Implements canvasId accessor and removes cached GetVideoContext behavior. |
| obs-studio-client/source/streaming.hpp | Adds helper to unwrap streaming UID from various streaming JS wrapper types. |
| obs-studio-client/source/streaming.cpp | Implements UID unwrap helper by InstanceOf checks across streaming variants. |
| obs-studio-client/source/nodeobs_autoconfig.hpp | Extends autoconfig event struct with optional JSON payload and adds summary API decl. |
| obs-studio-client/source/nodeobs_autoconfig.cpp | Changes InitializeAutoConfig JS API to accept IStreaming[] + callback; propagates payload; adds GetAutoConfigSummary(). |
| js/module.ts | Adds types for canvasId and typed resource-usage telemetry + summary shape. |
| js/module.d.ts | Updates TS declarations to match new canvasId + telemetry typings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- osn-streaming: drop extra obs_data_addref on originalServiceSettings; obs_service_get_settings already returns an owned ref (was a leak). - osn-video: restore the connecting-outputs guard with an APIv2 helper (iterate IStreaming manager, force-stop connecting outputs) in place of the commented-out OBS_service::stopConnectingOutputs() in Set/RemoveVideoContext. - nodeobs_autoconfig: drive bandwidth connect-wait off obs_output_active() instead of drained signals so a target that hasn't signalled yet isn't treated as connected (avoids totalBytes == 0). - nodeobs_autoconfig: wait for outputs to deactivate in applyResults before obs_set_video_info (obs_output_stop is async; avoids OBS_VIDEO_CURRENTLY_ACTIVE). - test_nodeobs_autoconfig: fix stale comment (startAutoconfig takes IStreaming[]; error string is no_streaming_targets_provided). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Join wrapped ThrowAsJavaScriptException calls (client) and wrap the InitializeAutoConfig register_function call (server) to satisfy the clang-format-13 CI check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Description
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: