21.2 review remediation: pause-spin, OQ7 comment, rename, C2 cross-check

Skip the back-pressure interop poll while paused (UC5). Document complete()
draining the stash in full by design. Rename scheduler isProductionPaused to
evaluateProductionPause (latch-advancing); window exposure name unchanged.
This commit is contained in:
daniel-c-harvey
2026-06-23 23:28:42 -04:00
parent 518479e7ae
commit 29e8747c69
5 changed files with 42 additions and 24 deletions
@@ -487,7 +487,12 @@ public class StreamingAudioPlayerService : AudioPlayerService, IStreamingPlayerS
// no separate cancellation path, no stale read racing a reinit.
if (chunkResult.ProductionPaused)
{
while (await _audioInterop.IsProductionPaused(PlayerId))
// UC5: while the user is paused, the playhead is frozen so forward lookahead
// never shrinks and the poll would spin indefinitely. Wait here until playback
// resumes (IsPaused clears) OR the fill drains on its own. Cancellation is
// unchanged: a track switch/seek/stop while paused still throws OCE and unwinds
// through the existing drain discipline (C6) — no weakening of the cancel path.
while (IsPaused || await _audioInterop.IsProductionPaused(PlayerId))
{
cancellationToken.ThrowIfCancellationRequested();
await Task.Delay(BackpressurePollMs, cancellationToken);