Playback stops when the next track fails to resolve

Aperta
#1,738 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
perl

Direzione di ricerca

Start in Slim::Player::StreamingController::_NextIfMore (around line 1012) and _RetryOrNext, the two places counting songqueue entries, then read _getNextTrack and _nextTrackError to see how a song becomes STATUS_FAILED. Reproduce with the playlist add sequence above and player.source at INFO, watching for "streaming track not started yet". Done means entry 2 is skipped and entry 3 plays, and the large-buffer and sync-group cases the suggested grep change leaves untested are checked too.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Disclaimer:

Analysis and reproduction have been made with Claude-code.

Playback stops when the next track fails to resolve

If the next track fails while the current one plays, LMS does not skip to the track after it. It logs "streaming track not started yet" and playback stops when the current track ends. Starting the failing track directly works: LMS skips it as expected.

Steps to reproduce (no plugins needed)
  1. On one player, queue a local file, an unreachable URL and another local file, then start the first:
    playlist add file:///music/1.wav
    playlist add http://127.0.0.1:1/unreachable.mp3
    playlist add file:///music/3.wav
    playlist index 0
    
  2. Let the first track play to its end.

Expected: LMS skips entry 2 and plays entry 3.
Actual: playback stops at entry 2. server.log with player.source at INFO:

Slim::Player::Song::getNextSong (246) scanning URL http://127.0.0.1:1/unreachable.mp3
Slim::Player::StreamingController::_NextIfMore (1012) streaming track not started yet, will wait until then to try next track

A missing local file as entry 2 is skipped correctly, because it fails later, in _Stream, which removes failed songs from the queue. We hit the bug with Deezer tracks that have no streaming rights (plugin getNextTrack calls the fail callback): themmm/lms-deezer#11.

Root cause
  • _getNextTrack puts the next song at the head of songqueue before calling getNextSong (Bug 10841). Its cleanup only pops failed or finished songs from the tail.
  • When getNextSong fails, _nextTrackError marks the song STATUS_FAILED and fires NextTrackError → _NextIfMore. The failed song is still at songqueue[0], next to the playing song.
  • _NextIfMore counts 2 songs and waits for the streaming song to start. That song never starts, so nothing fetches the next track, and the player stops at the end of the current track. _RetryOrNext has the same check.

The check came with a0a62d354 (PR #985). From reading the code: until 6fea62b22f (the fix for #1214), _NextIfMore still called _getNextTrack unconditionally after the check, so this case did not stop playback; since then the check is the only path.

Affected: reproduced on 9.1.2 (Docker lmscommunity/lyrionmusicserver:stable), 4 of 4 runs. StreamingController.pm is identical in 9.1.0 and public/9.2.

Possible fix

Leave failed songs out of the count in _NextIfMore and _RetryOrNext:

-	if (scalar @{$self->{'songqueue'}} < 2) {
+	if (scalar(grep { $_->status() != Slim::Player::Song::STATUS_FAILED } @{$self->{'songqueue'}}) < 2) {

With this change on 9.1.2, LMS skips entry 2 and plays entry 3 (2 of 2 runs); the existing cleanup in _Stream (bug 12653) then drops the failed song. A song that is still streaming is not STATUS_FAILED, so the large-buffer case the check was added for should keep waiting. Not tested: that case, and sync groups.

Lingua principale
Perl
Stelle
1.8k
Fork
389
Merge medio
1g 4h
PR unite (30g)
10

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LMS-Community/slimserver

Tutte le issue di LMS-Community/slimserver

Issue simili

Altre issue su Perl

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.