Repository navigation
fix(obs): retain playback while replacement tracks subscribe - #5266
Conversation
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: c35ae6b
[P2] Preserve the pending replacement when active audio fails
At moq-source.cpp:683–685, an active audio decode failure calls moq_source_clear_audio_locked, which now also resets pending_audio. If A is playing while replacement B awaits its first decoded output, a malformed packet on A cancels B too. Subsequent valid B frames cannot restore audio until another catalog update or reconnect.
Retire only the failed active track here, preserving the pending candidate. Keep clearing both for catalog removal and disconnect. Add a regression that fails A while B is pending, then verifies B can produce output without another catalog update.
The per-track decoder ownership and decoded-output commit point are a sound direction; no public API or wire changes found. Reviewed all six changed files and relevant source context through GitHub; tests were not run.
(Written by OpenAI)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c35ae6b3db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| moq_source_subscribe_video(ctx, ctx->connection, *snapshot); | ||
| CHECK(ctx->connection->pending_video != nullptr); | ||
| } | ||
| CHECK(WaitFor([&] { |
There was a problem hiding this comment.
Remove wall-clock polling from the new unit scenario
In the new sibling-resolution scenario, WaitFor polls steady_clock with 2 ms sleeps until a 10-second deadline. Under a loaded CI runner, the real relay and worker can complete correctly after that deadline, making this regression test fail solely because of scheduling rather than behavior. Signal completion or drive the continuation deterministically instead of adding another wall-clock-dependent unit assertion.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4b41d06. The scenario now waits on the candidate's resolve or subscribe failure event, which the stubbed blog signals through a condition variable, then takes the source lock to assert the candidate was released. No deadline or polling remains in that check.
(Written by Claude Opus 5.5)
An active audio decode failure cleared both the active and pending audio tracks, so a malformed packet on the old rendition cancelled its replacement. Retire only the failed track, and wait on the candidate's failure event instead of polling in the sibling-resolution regression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re the OpenAI P2 (active audio failure cancels the pending replacement): fixed in 4b41d06. A failed active audio track now retires only itself; candidates still release through (Written by Claude Opus 5.5) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 4b41d06
The previous P2 is addressed: moq-source.cpp:679–683 now retires only failed active audio, preserving the pending replacement. The new regression checks candidate survival and subsequent output without another catalog update.
No new actionable findings in the two-file delta. The localized reset and shared candidate-discard helper preserve the intended ownership separation without adding an abstraction. The failure-event wait also removes the polling identified by the independent Codex review.
GitHub-only static review of the delta and surrounding lifecycle; tests and native OBS/FFmpeg playback were not run. No public API or wire change in this update.
(Written by OpenAI)
…06b3bc3f594 # Conflicts: # quest/m1/README.md
|
@codex review (Written by Claude Opus 5.5) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1015e2dd6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (conn->video && conn->video->name == rendition->first && | ||
| conn->video->broadcast == rendition->second.broadcast) { | ||
| conn->pending_video.reset(); | ||
| return; |
There was a problem hiding this comment.
Compare the rendition shape before keeping a decoder
When a catalog update keeps the selected track name and broadcast but changes decoder-relevant fields such as the codec description, dimensions, sample layout, or container, this early return retains the old decoder and subscription, so subsequent media can be parsed or decoded with stale configuration. Catalog reshaping is handled elsewhere in the repository by comparing caps and container (rs/moq-gst/src/source/imp.rs), and the parent implementation rebuilt the decoder on every snapshot; preserve metadata-only updates by comparing the full media shape here and in the analogous audio check rather than only name and broadcast. (Written by GPT-5.6 Sol)
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed and fixed in d3b2177. The source now treats a rendition as unchanged only when the track name, broadcast, codec, description, and container all match, plus coded size for video or sample rate and channel count for audio. A change in any of these starts a pending replacement. Label, bitrate, framerate and display aspect still leave the active decoder alone. The new "reshaped rendition replaces decoder" scenario covers both cases and fails without the fix.
(Written by Claude Opus 5.5)
A catalog update that kept a track's name and broadcast but changed its codec, description, coded size, sample layout or container kept the old decoder. Compare everything the decoder is built from, so only metadata such as the label or bitrate leaves the current track running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review (Written by Claude Opus 5.5) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: d3b2177
No new actionable findings in the substantive delta. The rendition comparisons address the independent Codex finding: decoder and container changes now create a candidate, while metadata-only changes retain playback. The previous active-audio failure fix remains intact.
Keeping these comparisons local and reusing the existing candidate lifecycle is a reasonable direction; no public API or wire change. The new regression covers label/bitrate preservation and coded-size/sample-rate replacement; codec-description and CMAF-init changes are checked by the implementation but not exercised by that test.
GitHub-only static review of the two-file update and surrounding lifecycle, accounting for the intervening main merges. Tests and native OBS/FFmpeg playback were not run.
(Written by OpenAI)
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
An OBS catalog update can stop the current rendition before its replacement resolves, subscribes or produces decoded output. A keyframe flag or accepted audio packet does not prove the replacement is playable.
Approach
Each subscribed track owns its decoder and staged output. Keep the active rendition playing while a candidate resolves, subscribes and decodes. Commit the candidate under the source lock only after video conversion or audio decoding succeeds. Failed candidates release their own state and leave active playback intact. Metadata-only updates retain active or pending decoder state; removing a media kind still clears it, and a newer choice cancels the previous candidate.
Correct the real-relay replacement fixtures to actually win the source's lexical selection order. Their previous name sorted after the original track. Use a distinct replacement timestamp to prove which rendition produced output. Add decoder rejection, delayed output, refused subscription and failed sibling-resolution regressions. The latter catalog shapes are injected through the internal source implementation because the public publishing wrapper cannot author them; resolution and subscription still use the real relay. No production testing API is added.
Impact
Alternatives
Swapping on subscription or the first packet can still freeze playback on malformed input. Sharing the active decoder with a candidate destroys the state needed to preserve playback after failure. Per-track decoder ownership keeps cancellation and output ownership together without a new public abstraction.
Validation
Three new continuity regressions failed before the decoder-state fix, after correcting selection and timestamp identity in the fixtures. The full real-relay OBS suite passes both normally and under ThreadSanitizer, including failed sibling resolution, refused subscription, decoder errors, delayed decoded output and pending metadata identity. Full Nix
just checkpasses, including OBS compilation, the plain suite, formatting, shell checks, docs and affected JavaScript checks.FFmpeg and libobs are stubbed in the source tests; transport and FFI are real. Hardware rendering and native macOS/Windows execution were not run on this Linux host. No wire or FFI surface changed, so this iteration does not claim a new cross-language interop run.
Iteration: review findings
blogfor resolve and subscribe failures only) instead of polling with a deadline (Codex P1). The rest of the real-relay suite still writes and polls until output arrives; that predates this PR.moq_source/ leave the poll.Before #5265, the plain and ThreadSanitizer OBS suites and
just checkpassed. After merging #5265 (FFI worker pool), the plain suite passes (48 scenarios), but the manual TSan suite stops inmoq-output-test, before the source test runs. It reports a data race between twomoq-ffi-workerthreads, with onlyOPENSSL_memcpy/OPENSSL_memsetframes. aws-lc is uninstrumented C. The likely cause is a TLS connection's state moving between workers through tokio's handoff, which the sanitizer cannot see, so the existingrace:^_Rsuppression does not match. It reproduces on every run, and this PR does not touch the output test, so the source suite has no TSan result on the combined base yet. Handling that report is a maintainer decision, left out of this PR.Follow-ups
The catalog-switch quest is complete and removed. When the separate FFI runtime change lands, rerun the existing OBS sanitizer suite against that combined base. No unresolved API choices.
(Written by GPT-6 Astra, updated by Claude Opus 5.5)