Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c9f5d00
rust: RED obs-fallback-warning, the shared fallback warning (#2218)
vpacher Oct 24, 2026
75e0c51
rust: obs-fallback-warning, the shared fallback warning (#2218)
vpacher Oct 24, 2026
3958e33
rust: Rename obs-gpu-status-frontend to obs-frontend (#2218)
vpacher Oct 24, 2026
0af49b7
frontend: Build obs-frontend whenever the frontend is built (#2218)
vpacher Oct 24, 2026
5338a06
frontend: RED OBSFallbackWarning, the fallback warning window (#2218)
vpacher Oct 25, 2026
04ae04e
frontend: OBSFallbackWarning, the fallback warning window (#2218)
vpacher Oct 25, 2026
1da1a52
frontend: RED FallbackWarning, the fallback warning glue (#2218)
vpacher Oct 25, 2026
ed7d262
frontend: FallbackWarning, the fallback warning glue (#2218)
vpacher Oct 25, 2026
c113d57
frontend: RED obs_frontend_warn_fallback(), the fallback warning API …
vpacher Oct 25, 2026
0cab603
frontend: obs_frontend_warn_fallback(), the fallback warning API (#2218)
vpacher Oct 25, 2026
4ead6f5
frontend: Show fallback warnings on the main window, and document the…
vpacher Oct 25, 2026
075262d
test: Don't name the fallback warning crate in the dialog test's CMak…
vpacher Oct 25, 2026
4cf8d38
frontend: RED fallback warnings wait for another modal dialog (#2218)
vpacher Oct 25, 2026
b5add4d
frontend: Fallback warnings wait for another modal dialog (#2218)
vpacher Oct 25, 2026
0558c89
frontend: RED the fallback warning countdown pauses under a modal dia…
vpacher Oct 25, 2026
41a5471
frontend: Pause the fallback warning countdown under a modal dialog (…
vpacher Oct 25, 2026
4bb2d8a
docs: Standard wording for fallback warnings (#2218)
vpacher Oct 25, 2026
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
14 changes: 10 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ issue = "https://github.com/obs-rust/obs-studio/issues/962"
expires = "2027-04-15"
[[exceptions]]
rule = "RUST-018"
path = "rust/obs-gpu-status-frontend/Cargo.toml"
path = "rust/obs-frontend/Cargo.toml"
reason = "No workspace complexity lint configured yet."
issue = "https://github.com/obs-rust/obs-studio/issues/962"
expires = "2027-04-15"
Expand Down
2 changes: 1 addition & 1 deletion ci/test_rust_cargo_build_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_application_launcher_uses_the_native_rust_cache_safeguard(self):
def test_every_corrosion_import_joins_the_cargo_build_order(self):
imports = {
"libobs/cmake/rust.cmake": "libobs-rust",
"frontend/cmake/feature-gpu-status.cmake": "obs-gpu-status-frontend",
"frontend/cmake/frontend-rust.cmake": "obs-frontend",
"plugins/obs-nvenc/CMakeLists.txt": "obs-nvenc-plugin",
}
for path, crate in imports.items():
Expand Down
93 changes: 93 additions & 0 deletions docs/fallback-warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Fallback warning

Some features of OBS-Studio-Rust have a safe mode and a less safe fallback
mode. When the safe mode cannot work, the feature uses the fallback, so that
the user does not lose the feature. Examples:

| Feature | Safe mode | Fallback |
|---|---|---|
| Browser source (#1092) | Chromium sandbox | No sandbox |
| Streaming (#2205) | RTMPS | RTMP |

The fallback must never be silent (decision on #1092). This document gives
the rules for every fallback, and the shared code that applies them
(obs-rust/obs-studio#2218).

## Rules

1. Log the fallback at error level, once for each time it occurs. The log
line also goes to stderr.
2. Warn the user in a dialog. The dialog shows what fell back and why, and a
countdown. When the countdown ends after 3 seconds, the dialog accepts the
fallback. The countdown pauses while another modal dialog is open, so the
dialog never accepts unseen.
3. The dialog has an "Accept anyway" button. It has a Cancel button only when
the caller can stop instead of using the fallback. Then Cancel is the
default button.
4. Each fallback shows its dialog once in an OBS session. The log line comes
every time.
5. Do not show a dialog when the user cannot see it: before the main window
has loaded, and while another modal dialog is open (for example the
first-run wizard), the warning waits; with a hidden main window (OBS
started to the tray), the warning accepts at once.
6. Each dialog says: "This may become an error in a future version of OBS."
A fallback is a temporary help, not a supported mode.
7. Do not fall back when a security check fails. For example, a certificate
that does not verify is an error, not a reason to use RTMP.

## Wording

Every fallback uses the same words, so the user knows the case at once:

- **Title:** what runs, and without what. For example "Browser source
without the sandbox", "Streaming unencrypted (RTMP)".
- **Message:** what failed, what OBS does instead, and what the user can do
about it, in this order. One or two short sentences each.
- **Terms:** "sandbox" for the Chromium sandbox, "unencrypted" for a
connection without TLS. Do not use "insecure" or "unsafe mode".
- **Buttons:** "Accept anyway" and "Cancel". The frontend supplies them.
- **Id:** `<plugin>.<fallback>`, for example `browser.sandbox`,
`rtmp.unencrypted`. It is in the log line.

A new fallback uses this helper, not a dialog of its own. Existing
warnings change to this wording case by case.

## How to use it

A plugin calls `obs_frontend_warn_fallback()` from `obs-frontend-api.h`:

```c
static void sandbox_answer(void *param, bool accepted)
{
/* accepted: continue in the fallback mode. */
}

obs_frontend_warn_fallback("browser.sandbox", obs_module_text("SandboxFallback.Title"),
obs_module_text("SandboxFallback.Message"), false, sandbox_answer, data);
```

- `id` is a stable name. Use `<plugin>.<fallback>`.
- The caller translates `title` and `message`.
- `cb` is called once, on the UI thread, never inside the call. Keep `param`
valid until then. `cb` can be NULL.
- Without the OBS frontend (another host of the plugin), the call logs and
calls `cb` with `true` inside the call.

The API reference is in
[reference-frontend-api.rst](sphinx/reference-frontend-api.rst).

## Code

| Part | Location |
|---|---|
| Decisions: show or accept, what each end means, the countdown, the log line | `rust/obs-fallback-warning` (Rust, tested in its crate) |
| C ABI of the decisions | `frontend/utility/obs-fallback-warning.h`, linked through `rust/obs-frontend` |
| Queue: log at once, wait for the main window, one dialog at a time | `frontend/utility/FallbackWarning` |
| Dialog | `frontend/dialogs/OBSFallbackWarning` |
| API | `obs_frontend_warn_fallback()` in `frontend/api` and `OBSStudioAPI` |

Without the frontend's Rust (the C rollback build), the frontend logs and
accepts, and shows no dialog.

Tests: `test_fallback_warning_dialog`, `test_fallback_warning_queue` and
`test_frontend_warn_fallback` in `test/cmocka` (Linux).
8 changes: 8 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ not get a line.
item opens the OBS Rust Discord, where this build's bugs and questions
belong, instead of upstream OBS Studio's server. *All*, 2026-10-24.
Issue [#2097](https://github.com/obs-rust/obs-studio/issues/2097).
- **Fallback warning.** When a feature falls back to a less safe mode so
that it keeps working (for example a browser source without the Chromium
sandbox), OBS logs it at error level and shows a warning with a 3-second
countdown that accepts the fallback, once per session. Plugins call
`obs_frontend_warn_fallback()` ([fallback-warning.md](fallback-warning.md)).
*All*, pending merge. Issue
[#2218](https://github.com/obs-rust/obs-studio/issues/2218), PR
[#2238](https://github.com/obs-rust/obs-studio/pull/2238).
- **No upstream release notes or donor list downloads.** The What's New
dialog, which showed upstream OBS Studio's release notes from
obsproject.com, is off by default (`ENABLE_WHATSNEW=OFF`); a build that
Expand Down
4 changes: 2 additions & 2 deletions docs/rust-port/cc-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ configuration is Linux with browser panels disabled; other feature/platform
configurations and release paths remain under conversion.

Build the GPU archive with
`soldr cargo build -p obs-gpu-status-frontend --release`, then enable the integration
`soldr cargo build -p obs-frontend --release`, then enable the integration
check with `OBS_BUILD_APP=1` and `OBS_BUILD_GPU_ARCHIVE` pointing to the resulting
`target/release/libobs_gpu_status_frontend.a`. The executable runs and reports
`target/release/libobs_frontend.a`. The executable runs and reports
`--version` identifies the OBS-Studio-Rust application version as `0.1.0`,
based on OBS `33.0.0-cc-build`.
This establishes compilation, linking and CLI execution; GUI startup, runtime
Expand Down
3 changes: 2 additions & 1 deletion docs/rust-port/naming.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ One name per thing, so releases, crates and tags can't be confused (#320).
| `libobs/obs-audio-controls.c.h` | `rust/obs-audio-controls` |
| `libobs/obs.c.h` and the units extracted from it (`obs-video-plan.c.h`, `obs-context-names.c.h`, `obs-source-load.c.h`), and those extracted from `libobs/obs-module.c.h` (`obs-module-paths.c.h`, `obs-module-names.c.h`, `obs-module-locale.c.h`, `obs-module-source-rules.c.h`, `obs-module-type-rules.c.h`), `libobs/obs-view-api.c.h`, and `obs-video-copy-plan.c.h` and `obs-video-output-step.c.h`, extracted from `libobs/obs-video.c.h`, and `obs-canvas-draw.c.h`, extracted from `libobs/obs.c.h` and `libobs/obs-display.c.h` | `rust/obs-core` |
| `plugins/obs-nvenc/` (CUDA/NVENC loader) | `rust/obs-nvenc`, linked through `rust/obs-nvenc-plugin` |
| GPU acceleration status (frontend, #846) | `rust/obs-gpu-status`, linked through `rust/obs-gpu-status-frontend` |
| GPU acceleration status (frontend, #846) | `rust/obs-gpu-status`, linked through `rust/obs-frontend` |
| all libobs ports, as one C ABI drop-in | `rust/libobs-rust` |

A new libobs area gets a new `obs-<area>` row here in the PR that starts it.
Expand All @@ -75,6 +75,7 @@ A new libobs area gets a new `obs-<area>` row here in the PR that starts it.
| libobs port | `obs-<area>`, named after the libobs directory | `obs-util`, `obs-graphics`, `obs-media-io`, `obs-codec` |
| libobs staticlib (C ABI drop-in) | `libobs-rust` | |
| Plugin staticlib | `obs-<plugin>-plugin` | `obs-nvenc-plugin` |
| Frontend staticlib (the C ABI of the frontend's Rust crates) | `obs-frontend` | |
| Test oracle (dev-only) | `obs-c-oracle` | |
| Product binary | `obs-studio-rust` | |

Expand Down
40 changes: 40 additions & 0 deletions docs/sphinx/reference-frontend-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,11 @@ Structures/Enumerations

Undo redo callback

.. type:: void (*obs_frontend_fallback_cb)(void *param, bool accepted)

Fallback warning callback: *accepted* is *true* when the caller continues
in the fallback mode. See :c:func:`obs_frontend_warn_fallback()`.


Functions
---------
Expand Down Expand Up @@ -1000,3 +1005,38 @@ Functions
:return: *true* if OBS was launched in Safe Mode, *false* otherwise

.. versionadded:: 33.0

---------------------------------------

.. function:: void obs_frontend_warn_fallback(const char *id, const char *title, const char *message, bool can_cancel, obs_frontend_fallback_cb cb, void *param)

Tells the user that a feature fell back to a less safe mode, so that it
keeps working (for example a browser source without the Chromium sandbox).
OBS logs *message* at error level at once, from any thread. Then, on the
UI thread, it shows a warning with a countdown that accepts the fallback
after 3 seconds, and calls *cb* once with the result.

A warning shows once per *id* in each OBS session, and only one shows at
a time. Warnings wait until the main window has loaded, and while another
modal dialog is open. With a hidden
main window, or when the same *id* already showed, the warning accepts at
once (after the log line). At exit, an open warning closes and queued
warnings accept.

*cb* is never called inside this call when OBS runs. In a host without
the OBS frontend, this call logs, then calls *cb* with *true* inside the
call.

See ``docs/fallback-warning.md`` in OBS-Studio-Rust
(obs-rust/obs-studio#2218).

:param id: A stable name for the fallback, for example
``"browser.sandbox"``. It is in the log line.
:param title: The window title, translated by the caller
:param message: What fell back and why, translated by the caller
:param can_cancel: *true* if the caller can stop instead. The warning
then has a Cancel button.
:param cb: Called once with *accepted*: *true* for the countdown
and "Accept anyway"; *false* for Cancel or a closed
warning if *can_cancel*, else *true*. Can be NULL.
:param param: Passed to *cb*. Keep it valid until *cb* is called.
2 changes: 2 additions & 0 deletions frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ include(cmake/feature-restream.cmake)
include(cmake/feature-youtube.cmake)
include(cmake/feature-whatsnew.cmake)
include(cmake/feature-idian-playground.cmake)
include(cmake/frontend-rust.cmake)
include(cmake/feature-fallback-warning.cmake)
include(cmake/feature-gpu-status.cmake)

configure_file(cmake/templates/ui-config.h.in ui-config.h)
Expand Down
6 changes: 6 additions & 0 deletions frontend/OBSStudioAPI.cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,12 @@ bool OBSStudioAPI::obs_frontend_is_safe_mode_enabled()
return safe_mode;
}

void OBSStudioAPI::obs_frontend_warn_fallback(const char *id, const char *title, const char *message, bool can_cancel,
obs_frontend_fallback_cb cb, void *param)
{
FallbackWarning::Warn(id, title, message, can_cancel, cb, param);
}

void OBSStudioAPI::on_load(obs_data_t *settings)
{
for (size_t i = saveCallbacks.size(); i > 0; i--) {
Expand Down
3 changes: 3 additions & 0 deletions frontend/OBSStudioAPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ struct OBSStudioAPI : obs_frontend_callbacks {

bool obs_frontend_is_safe_mode_enabled(void) override;

void obs_frontend_warn_fallback(const char *id, const char *title, const char *message, bool can_cancel,
obs_frontend_fallback_cb cb, void *param) override;

void on_load(obs_data_t *settings) override;

void on_preload(obs_data_t *settings) override;
Expand Down
24 changes: 24 additions & 0 deletions frontend/api/obs-frontend-api.cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,5 +691,29 @@ bool obs_frontend_is_safe_mode_enabled(void)
return !!callbacks_valid() ? c->obs_frontend_is_safe_mode_enabled() : false;
}

void obs_frontend_warn_fallback(const char *id, const char *title, const char *message, bool can_cancel,
obs_frontend_fallback_cb cb, void *param)
{
if (c) {
c->obs_frontend_warn_fallback(id, title, message, can_cancel, cb, param);
return;
}

/* No frontend, so nobody to warn: log and accept. The line of
* rust/obs-fallback-warning's log_line(), which the frontend logs. */
const char *future_error = "This may become an error in a future version of OBS.";
if (!id) {
id = "";
}
if (message && *message) {
blog(LOG_ERROR, "[fallback] %s: %s %s", id, message, future_error);
} else {
blog(LOG_ERROR, "[fallback] %s: %s", id, future_error);
}
if (cb) {
cb(param, true);
}
}

/* File-local macros (BUILD.md): out of the next file in the unity group. */
#undef callbacks_valid
7 changes: 7 additions & 0 deletions frontend/api/obs-frontend-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ EXPORT void obs_frontend_paste_sceneitem(obs_scene_t *scene, bool duplicate);

EXPORT bool obs_frontend_is_safe_mode_enabled(void);

/* A feature fell back to a less safe mode (obs-rust/obs-studio#2218). Logs
* at error level, warns the user with a countdown, and calls `cb` once on the
* UI thread with whether to continue in the fallback mode. */
typedef void (*obs_frontend_fallback_cb)(void *param, bool accepted);
EXPORT void obs_frontend_warn_fallback(const char *id, const char *title, const char *message, bool can_cancel,
obs_frontend_fallback_cb cb, void *param);

/* ------------------------------------------------------------------------- */

#ifdef __cplusplus
Expand Down
3 changes: 3 additions & 0 deletions frontend/api/obs-frontend-internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ struct obs_frontend_callbacks {
virtual bool obs_frontend_can_paste_sceneitem(bool duplicate) = 0;
virtual void obs_frontend_paste_sceneitem(obs_scene_t *scene, bool duplicate) = 0;
virtual bool obs_frontend_is_safe_mode_enabled(void) = 0;

virtual void obs_frontend_warn_fallback(const char *id, const char *title, const char *message, bool can_cancel,
obs_frontend_fallback_cb cb, void *param) = 0;
};

EXPORT void obs_frontend_set_callbacks_internal(obs_frontend_callbacks *callbacks);
1 change: 1 addition & 0 deletions frontend/build/frontend-app-obsstudioapi.pch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "frontend/OBSStudioAPI.hpp"

#include <models/SceneCollection.hpp>
#include <utility/FallbackWarning.hpp>
#include <widgets/OBSBasic.hpp>
#include <widgets/OBSProjector.hpp>

Expand Down
21 changes: 21 additions & 0 deletions frontend/build/frontend-dialogs-obsfallbackwarning.pch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Precompiled header (BUILD.md) for the frontend unity groups
* frontend.dialogs-obsfallbackwarning. C++. Every implementation file in them includes this header and
* nothing else: the includes and macro setup below are theirs, in group and
* file order. */

#pragma once

/* dialogs/OBSFallbackWarning.cpp */
#include "frontend/dialogs/OBSFallbackWarning.hpp"

#include <QApplication>
#include <QCloseEvent>
#include <QDialogButtonBox>
#include <QLabel>
#include <QProgressBar>
#include <QPushButton>
#include <QTimer>
#include <QVBoxLayout>

#include <algorithm>
#include <limits>
25 changes: 25 additions & 0 deletions frontend/build/frontend-fallback-warning.pch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Precompiled header (BUILD.md) for the frontend unity groups
* frontend.fallback-warning. C++. Every implementation file in them includes this header and
* nothing else: the includes and macro setup below are theirs, in group and
* file order. */

#pragma once

/* utility/FallbackWarning.cpp */
#include "frontend/utility/FallbackWarning.hpp"
#include "frontend/dialogs/OBSFallbackWarning.hpp"

#ifdef OBS_FRONTEND_RUST
#include "frontend/utility/obs-fallback-warning.h"
#endif

#include <util/base.h>

#include <QApplication>
#include <QPointer>
#include <QTimer>
#include <QWidget>

#include <deque>
#include <memory>
#include <string>
1 change: 1 addition & 0 deletions frontend/build/frontend-widgets.pch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#if defined(_WIN32) || defined(WHATSNEW_ENABLED)
#include <utility/WhatsNewInfoThread.hpp>
#endif
#include <utility/FallbackWarning.hpp>
#include <utility/GpuStatus.hpp>
#include <utility/product-name.h>
#include <utility/profile-activate.h>
Expand Down
5 changes: 5 additions & 0 deletions frontend/build/frontend.dialogs-obsfallbackwarning+.hpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Unity group (BUILD.md): OBSFallbackWarning.cpp on its own (#2218: the Qt test builds it without the frontend). */

#include "frontend/build/frontend-dialogs-obsfallbackwarning.pch.hpp"

#include "frontend/dialogs/OBSFallbackWarning.cpp.hpp"
5 changes: 5 additions & 0 deletions frontend/build/frontend.fallback-warning+.hpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Unity group (BUILD.md): frontend fallback-warning (cpp). */

#include "frontend/build/frontend-fallback-warning.pch.hpp"

#include "frontend/utility/FallbackWarning.cpp.hpp"
Loading
Loading