Skip to content

autoconfig remake apiv2 #1677

Open
summeroff wants to merge 4 commits into
stagingfrom
auto_config_apiv2
Open

autoconfig remake apiv2 #1677
summeroff wants to merge 4 commits into
stagingfrom
auto_config_apiv2

Conversation

@summeroff
Copy link
Copy Markdown
Contributor

Description

Motivation and Context

How Has This Been Tested?

Types of changes

Checklist:

  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@summeroff summeroff force-pushed the auto_config_apiv2 branch 3 times, most recently from 9eb0914 to 42a1389 Compare May 4, 2026 20:59
@summeroff summeroff force-pushed the auto_config_apiv2 branch from f2963eb to bd7b35b Compare May 13, 2026 00:32
@summeroff summeroff force-pushed the auto_config_apiv2 branch from bd7b35b to 0887359 Compare May 13, 2026 00:37
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 exposes GetAutoConfigSummary().
  • 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.

Comment thread obs-studio-server/source/osn-streaming.cpp
Comment thread obs-studio-server/source/nodeobs_autoconfig.cpp
Comment thread obs-studio-server/source/nodeobs_autoconfig.cpp
Comment thread obs-studio-server/source/osn-video.cpp Outdated
Comment thread obs-studio-server/source/osn-video.cpp Outdated
Comment thread tests/osn-tests/src/test_nodeobs_autoconfig.ts Outdated
summeroff and others added 2 commits June 3, 2026 09:56
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants