fix: problems with rendering and detached threads - #1229
Open
mdydek wants to merge 6 commits into
Open
Conversation
WPT non-regression comparisonERROR — the comparison did not produce a report; the test run itself likely failed. Workflow run · this comment is updated on every push. |
mdydek
marked this pull request as ready for review
August 18, 2026 13:47
closetcaiman
requested changes
Aug 19, 2026
Comment on lines
+121
to
+129
| seekDecoderDaemon_ = std::make_unique<SeekDecoderDaemon>( | ||
| auto deamon = std::make_unique<SeekDecoderDaemon>( | ||
| std::move(daemonOptions), | ||
| decoderState_, | ||
| std::move(commandReceiver), | ||
| std::move(frameSender), | ||
| frameReceiver_); | ||
|
|
||
| seekDecoderThread_ = std::thread(std::move(*deamon)); | ||
|
|
Member
There was a problem hiding this comment.
I think SeekDecoderDaemon should own the thread, not the AudioFileSourceNode since that is an internal property of the daemon worker.
Comment on lines
185
to
203
|
|
||
| struct DeferredEmptyEvent { | ||
| double dueTime; | ||
| AudioEvent event; | ||
| uint64_t callbackId; | ||
| }; | ||
|
|
||
| /// Reserved up front so `deferEmptyEventDispatch` stays allocation-free on | ||
| /// the audio thread until this many dispatches are pending at once. | ||
| static constexpr size_t DEFERRED_EMPTY_EVENTS_CAPACITY = 16; | ||
|
|
||
| /// Render-serialized only (audio thread or the synchronous | ||
| /// `scheduleAudioEvent` path) — no lock, so no other thread may touch it. | ||
| std::vector<DeferredEmptyEvent> deferredEmptyEvents_; | ||
|
|
||
| void dispatchDueDeferredEvents(); | ||
|
|
||
| [[nodiscard]] virtual bool isDriverRunning() const = 0; | ||
| }; |
Member
There was a problem hiding this comment.
Does all this wiring belong to AudioContext? Besides can't we reuse some implementation like BoundedPriorityQueue?
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.
Closes #
Introduced changes
Checklist