Repository navigation
rtmp-services: Ingest refresh waits on an event instead of polling (#1284) - #1326
Merged
Merged
Conversation
zackees
enabled auto-merge
October 17, 2026 19:19
This was referenced Oct 17, 2026
chriscoveries
pushed a commit
to chriscoveries/obsrust-fork
that referenced
this pull request
Oct 17, 2026
… ms (obs-rust#1338) test_ingest_refresh_wait (obs-rust#1326) required a 50 ms refresh to end the wait within 150 ms; a loaded macOS runner overslept it (failed_refresh_ends_wait, line 66, Tier 2 macos-26 on obs-rust#1336). What the test proves is that the wait ends at the refresh and not at the 5000 ms timeout, so bound it at 1000 ms. Refs obs-rust#1284, obs-rust#838
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.
Fixes #1284 (parent #1273).
Callers and threads
service_ingests_refresh(Twitch / Amazon IVS) is reached from:rtmp_common_url("auto" server), called throughobs_service_get_url/ connect info, mainly on the output's start/connect thread (rtmp-stream), and from frontend code that reads the service URL.twitch_ingests_refresh/amazon_ivs_ingests_refreshproc handlers, called byAutoConfig::AutoConfig(frontend/wizards/AutoConfig.cpp.hpp) on the UI thread withseconds = 5.dacast_ingests_load_datais called fromrtmp_common_urlfor Dacast (output connect thread, or any caller reading the URL), with a 3 s timeout.single_file_thread, which callsingest_update/dacast_ingest_updatewhen a download arrives.Cause
Both waits polled a flag every 10 ms until a timeout.
service-ingestwaits only whileingests_loadedis false (no cached or downloaded list), then pollsingests_refreshed. That flag is set only when the download parsed, so a download that arrived but failed to parse kept the caller waiting the full timeout, even though the refresh had already ended. Dacast had the same problem withingests_loaded.What the flags mean:
ingests_loadedmeans a usable list exists (from the cache or a download).ingests_refreshedmeans this session's download succeeded, and it setsloadedas well. The intended rule is "wait only when there is no list at all, until the refresh attempt ends". It is now written out asingest_refresh_needs_wait(refreshed, loaded) = !refreshed && !loaded.Fix
plugins/rtmp-services/service-specific/ingest-refresh-wait.hwraps a manual-resetos_event_t:resetruns when a refresh starts.completeruns from the update callback whatever the outcome.wait_forisos_event_timedwait(timeout).service-ingestanddacastboth use the helper. It is included throughservice-ingest.h, which is already in the rtmp-services PCH.Tests
New
test/cmocka/test_ingest_refresh_wait.c(+tests.d/test_ingest_refresh_wait.cmake, links only libobs + cmocka). It uses the same helper as the plugin:needs_waittruth table over (refreshed, loaded).RED (
c602060c9, the stub keeps the old polling and flag semantics):rust/tools/linux-validate/run.shgave99% tests passed, 1 tests failed out of 284, and the only failure wastest_ingest_refresh_wait. It failedfailed_refresh_ends_wait(waited the full timeout),completed_wait_returns_at_once_until_resetandneeds_wait_only_without_any_list.GREEN:
100% tests passed, 0 tests failed out of 284, andtest_ingest_refresh_waitpassed in 0.48 s, including the repeat run../lintpasses.There were no existing rtmp-services tests. The validator does not build the plugin itself, and this host has no jansson for a local compile, so PR CI's
plugins/rtmp-servicesLinux build lane is the compile check for the plugin changes.Tiers: this is a C plugin bug fix with no Rust port involved, so Tiers 1, 3 and 4 do not apply. Tier 2 is the new cmocka test.