Skip to content

Harden DoP playback transitions - #512

Merged
kode54 merged 1 commit into
losnoco:mainfrom
markojurkovic:feat/harden-dop-playback-transitions
Jul 19, 2026
Merged

Harden DoP playback transitions#512
kode54 merged 1 commit into
losnoco:mainfrom
markojurkovic:feat/harden-dop-playback-transitions

Conversation

@markojurkovic

Copy link
Copy Markdown
Contributor

Summary

This PR hardens DoP playback transitions and Core Audio output preparation.

  • Stops playback cleanly if the output device cannot prepare the next track’s format.
  • Clears stale DoP seek, marker, and fader state when transitioning back to PCM.
  • Enables DoP fader mode only after output preparation succeeds.
  • Preallocates integer-output scratch space outside the real-time render callback, avoiding memory allocation during rendering.
  • Restores the output reset state when format preparation fails.

Motivation

Failed output preparation or a DoP-to-PCM transition could leave stale DoP state active. This could cause PCM data to be handled as a DoP carrier, replace output with DoP silence, or leave playback in an inconsistent state.

The integer-output path could also resize its scratch buffer inside the Core Audio render callback, which is unsafe for real-time audio processing.

Test plan

  • Build Cog in the Debug configuration.
  • Test transitions from DoP playback to PCM.
  • Test consecutive DoP tracks and DoP seeking.
  • Verify playback stops cleanly when output format preparation fails.
  • Verify integer DoP output continues without render-buffer allocation.

Stop playback when queued output format preparation fails.
Reset stale DoP seek and fader state when returning to PCM.
Preallocate integer-output scratch space outside the render callback.
@kode54
kode54 merged commit c2d5ac7 into losnoco:main Jul 19, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants