Repository navigation
XERK-2159: Keep a lobby switch made while a stream is starting - #60
Merged
Merged
Conversation
interpipesrc decided whether a new listen-to must switch the live listener from basesrc's started flag, which basesrc sets only after start() returns and clears only after stop() returns. A listen-to set in the first gap was only stored (the consumer stayed on the old producer), one in the second listened on a stopped source. A new gst-interpipe patch tracks started under the listeners lock. Also pins the teardown patch's dispose ordering with a deterministic test (the existing stress test caught a regression only ~1 run in 4), and documents why block=true consumers can hang a producer.
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.
Summary: A player switching lobbies while their stream is still starting now gets the lobby's picture and sound, instead of sometimes staying on their own desktop.
Part of XERK-2159
Why
A stream's video and audio consumers are switched from one producer to another when a player joins or leaves a lobby. gst-interpipe decided whether to switch the live listener from GStreamer's "started" flag. That flag is set only after the consumer's own start code returns, and cleared only after its stop code returns. A switch landing in the first gap was only stored, so the consumer stayed on the old producer. A switch in the second gap attached a listener to a stopped consumer. A race rig hit the lost switch 329 times in 2000 starts on the old plugin.
What changed
docker/patches/gst-interpipe-x-listen-to-start-gap.patch: interpipesrc keeps its own started flag, set and cleared under the listeners lock that the switch already takes..claude/rules/gst-interpipe.mddocuments both. It also explains whyblock=trueconsumers can hang a producer: that is inherent toblock=true, and Wolf's defaults useblock=false.Risk
Low. The patch touches only gst-interpipe's consumer, and reads the new flag under the lock already taken there. It ships with the next image build. Roll back by reverting this commit, which drops the patch.
Testing
QA result: PASS — the patch glob applied to a fresh
GST_INTERPIPE_REFcheckout; old/new/mutant plugins; race rig; full suite ×3.Not tested: TSan/ASan/clang CI legs (left to CI); the GStreamer 1.26 image runtime (tested on 1.24.2); a live Moonlight lobby switch.
Test evidence
2 == 1).[GSTPlugin]×3,streaming:*/sessions:*/control:*/[GSTREAMER], the full wolftests suite ×3, and 8000 race iterations under a watchdog: no failures, no hangs.Follow-ups
block=trueconsumers): accepted. I couldn't reproduce it with a rig on the old or new plugin. The producer waiting on a consumer that doesn't drain is whatblock=trueasks for. Documented in the rules file.