Conversation
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.
Problem and behavior
Presenter currently supplies PCM and renders on the same host tick. A blocked
render call therefore stops PCM delivery even though decoding and the audio device
can continue. This PR gives audio delivery its own owner so rendering stalls do
not interrupt an otherwise running audio stream. Video remains scheduled against
the shared playback clock when rendering becomes available again.
Dependency and review scope
Validated clock observations and foreground audio continuity are provided by
#131, which is now merged into
main. This PR targetsmainand contains onlythe audio ownership refactor and its tests/documentation. There are no changes to
core.rs,playback.rs, Metal, or clock-validity rules in this diff.This remains a draft for independent architecture review.
Implementation
erika-audiothread creates, calls and destroys the backend. Afactory creates the platform object inside that thread, so no unsafe backend
Sendimplementation is required. It owns the bounded PCM receiver, SoundTouch,clock/device reports, and pending playback-rate commits.
the producer, reset/drain after both ACKs, then resume producer before consumer.
Expired queued commands do not execute later; failed resets return errors.
No shared snapshot lock spans a backend operation or an ACK wait.
background opt-in and foreground video recovery contracts remain in force.
A successful video present for the current generation releases the audio-start
gate. Natural EOF hands remaining PCM to the device and parks the feeder without
cutting off the hardware tail; explicit stop/close still release output.
Pending rates commit even while rendering is blocked, and mixed-rate feedback
remains suppressed.
Japanese explains that hosts use pause/stop/close to stop audio; stopping a
display timer alone no longer starves it.
audio_only_tickretains its videosuspension/foreground recovery role.
Validation
The integration harness uses real FFmpeg fixture decoding, Player worker,
Presenter, the production audio owner and BufferedAudioOutput ring. Only render
stalls and the wall-time device callback are simulated; there is no extra feeder.
wgpu: 557 passed. Includes the render-stall/rate tests,pause/seek/stop/replay/close, natural EOF, track changes/open, foreground recovery,
quiesce during an in-flight push, command expiry, failed reset and device events.
warnings. Tests were rerun on the exact head after incorporating the Windows
changes from 修复 Windows 扫描线视频 DWM 崩溃、铺满尺寸及 D3D11VA 帧复用 #129 through the updated fix(playback): recover audio clock drift after render stalls #131 base.
longer occurs after incorporating 修复 Windows 扫描线视频 DWM 崩溃、铺满尺寸及 D3D11VA 帧复用 #129.
These measurements concern core/ring clocks, not physical DAC/display latency or
macOS native fullscreen animation. See this PR's checks for platform build results.