Closed ronilaukkarinen closed 1 year ago
I cannot reproduce this behavior, but I also don’t have a Mac. Can you build pianobar with debug info and run PIANOBAR_DEBUG=2 ./pianobar
? It’ll spit out alot of debug messages regarding the audio playback. Perhaps there’s anything suspicious in there rigth before the cutoff.
This is what I see when the song cuts off:
av_read_frame failed with code -54, sending NULL frame
decoder is done, waiting for ao player
ao player got EOF, exiting
ao player is done
If I see correctly error code 54 is ECONNRESET on MacOS. Can you confirm that?
Confirmed. I used av_err2str()
to get more information about the error code.
av_read_frame failed with code -54, sending NULL frame
[DBG] error code -54 gives: Connection reset by peer <<<<<
decoder is done, waiting for ao player
ao player got EOF, exiting
ao player is done
Maybe something like this might help already? In theory it should re-open the stream where it stopped.
diff --git a/src/player.c b/src/player.c
index 875f473..ebcbeea 100644
--- a/src/player.c
+++ b/src/player.c
@@ -533,7 +533,8 @@ void *BarPlayerThread (void *data) {
if (openFilter (player) && openDevice (player)) {
changeMode (player, PLAYER_PLAYING);
BarPlayerSetVolume (player);
- retry = play (player) == AVERROR_INVALIDDATA &&
+ int ret = play (player);
+ retry = (ret == AVERROR_INVALIDDATA || ret == -ECONNRESET) &&
!player->interrupted;
} else {
/* filter missing or audio device busy */
edit: Should be -ECONNRESET
obviously.
With the patch, the song completes. There is a slight blip in the audio, but the patch is a definite improvement. On one occasion, I saw the remaining time flip to the song duration and then back to where it was, but this doesn't happen all the time.
Thanks for testing! The blip and time flipping probably happen for all reconnects, not just this one.
I’m still curious why this happens, because I’ve never seen this issue before. Is your network particularly unstable?
No, the network is fine. I have a newer MacBook Pro running Ventura
and the problem doesn't happen. The problem happens on an older MacBook Pro running Monterey
(with all of the latest OS and homebrew
updates). When I was actively using the older laptop a couple/few years ago I didn't run into any pianobar
problems. I noticed the problem when I recently started using the laptop again.
Subject of the issue
In the end of every song about 10 seconds gets cut off before starting the next song in queue.
Your environment
Steps to reproduce
Play any station.
Expected behaviour
Songs should play through.
Actual behaviour
Songs get cut off about 10 seconds before they are ending.