Player: auto mode fails over between Spotify and HLS

No Spotify session (or paused, with failover_on_pause) for failover_delay_s
switches to HLS; Spotify playing switches back within ~1 s. Switches fade
out/in over 30 ms and flush the ring. HLS is suspended while Spotify plays.
cspot is held back instead of drained while it isn't Spotify's turn: it keeps
decoding on pause, so dropping its frames let it race through the queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 22:36:11 +10:00
parent 78c480a7c2
commit c6ecbbeb25
6 changed files with 202 additions and 34 deletions
+7 -3
View File
@@ -36,11 +36,15 @@ static media_pl_t *s_pl; // parsed media playlist (PSRAM)
static char s_url[URL_MAX]; // configured URL
static char s_media_url[URL_MAX];
static uint8_t *s_seg; // current segment (PSRAM)
static volatile bool s_suspended;
static volatile unsigned s_suspended; // HLS_SUSPEND_* bits
void hls_suspend(bool suspend)
void hls_suspend(unsigned reason, bool suspend)
{
s_suspended = suspend;
if (suspend) {
__atomic_or_fetch(&s_suspended, reason, __ATOMIC_SEQ_CST);
} else {
__atomic_and_fetch(&s_suspended, ~reason, __ATOMIC_SEQ_CST);
}
}
// hls_url when source.mode needs HLS, else "".