Repository navigation
Description
Port the public obs_source_restore_filters() from libobs/obs-source.c.h into obs-source. Callers: the filters dialog's undo/redo and the paste-filters path (frontend/utility/filter-clipboard.c.h, frontend/widgets/OBSBasic_Clipboard.cpp.hpp). Its partner obs_source_backup_filters() is already Rust (obs-source::filter_backup), and the two chain decisions it uses (obs_source_filter_chain_restore_matches(), _restore_step()) are already Rust in obs-source::source_filter_chain; this entry is the C orchestration left. It is the last filter-list entry still in C apart from the by-name/by-UUID lookups and obs_source_filter_set_index(), which stay out of this unit.
Contract to keep (pinned by a new cmocka characterization against hybrid libobs and the C reference):
- Invalid
sourceor NULLarray: the usualobs_source_valid/obs_ptr_validlog (source checked first), nothing locked or changed. - Under
filter_mutex: every current filter is copied aside in order, itsfilter_parentandfilter_targetcleared, andsource->filtersfreed; then the lock is dropped. - With the lock free, for each array item in order: a current filter whose name matches (
restore_matches; a NULL current name never matches) is reused throughobs_source_get_ref(); if none matches, or the reference fails (a dying filter), the item is loaded throughrestore_step: private (obs_load_private_source()) in hybrid libobs since rust: Port the source filter chain rules to obs-source #2981, public (obs_load_source()) in the C reference; the characterization does not pin which. Each new filter becomes the previous one'sfilter_target; the item is released. - The last restored filter targets
source; then every restored filter'sfilter_parentis set tosource(only after all targets are set, libobs: A filter's size query can follow a NULL target during filter restore or removal #2172), and the new list is moved intosource->filtersunderfilter_mutex. - Afterwards each old filter is released once, in old order, and the copy freed. No signals, no logs on the success path. Duplicate names in the array reuse the same current filter each time, as today.
Stays C (reached through hidden, non-EXPORT adapters in a *-fields.c.h in the live core-source group): the lock, the filters array reads, writes and move, the name read, obs_source_get_ref, the two loaders, obs_source_release, and the obs_data_array item reads.
Plan: extract the entry verbatim into its own file in a live group, characterize, Tier 1 RED against todo!(), then the Rust swap through the field adapter, a Tier 3 differential against the original C (chains of 0 to 6 current filters, arrays reusing, loading, duplicating and dropping filters, a failed reference, NULL names), and Tier 2 unchanged. No public-header, existing-C-test, WebSocket or workflow edits. Tier 4 does not apply.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Nov 27, 2026
Claiming: I'll extract, characterize and swap it RED then GREEN, stacked on the filter_add port (#5800) so the two don't conflict in obs-source.c.h and the test graph; I'll retarget to master once #5800 merges.
libobs: extract obs_source_restore_filters verbatim (Refs #5801)
test: characterize obs_source_restore_filters (Refs #5801)
test: RED obs_source_restore_filters safe core (Refs #5801)
obs-source: port obs_source_restore_filters to Rust (Fixes #5801)
libobs: extract obs_source_restore_filters verbatim (Refs #5801)
test: characterize obs_source_restore_filters (Refs #5801)
test: RED obs_source_restore_filters safe core (Refs #5801)
obs-source: port obs_source_restore_filters to Rust (Fixes #5801)
libobs: extract obs_source_restore_filters verbatim (Refs #5801)
test: characterize obs_source_restore_filters (Refs #5801)
test: RED obs_source_restore_filters safe core (Refs #5801)
obs-source: port obs_source_restore_filters to Rust (Fixes #5801)
libobs: extract obs_source_restore_filters verbatim (Refs #5801)
test: characterize obs_source_restore_filters (Refs #5801)
test: RED obs_source_restore_filters safe core (Refs #5801)
obs-source: port obs_source_restore_filters to Rust (Fixes #5801)
obs-source: port obs_source_restore_filters to Rust (Fixes obs-rust#5801