Taiko2k / Tauon

The music player of today! :city_sunrise:
https://tauonmusicbox.rocks
GNU General Public License v3.0
1.76k stars 67 forks source link

Intermittently experience no sound #944

Open dannysu opened 1 year ago

dannysu commented 1 year ago

Playing music from Jellyfin. Sometimes after a track ends, the next track starts but have no sound. In the UI, the progress bar will keep progressing, but no sound coming out.

phazor gets into a condition where it thinks the buffer ran out and stops the decoder.

I added some debug logging of my own, but the key thing here seems to be that:

  1. phazor's start() gets called for the next song
  2. "pa: Buffer ran out at the end of track", which then leads to end() being called
  3. UI's state and phazor's state diverges after end(). UI thinks the song is going. Whereas phazor has stopped.

Since the UI thinks nothing is wrong, it'll continue to count time and move to next tracks. Sometimes when moving to next track phazor revives again.

The music file in the audio-cache seems to be fine. If I copy it out of the cache and play it with another player, the file works.

Not familiar with this code. Still debugging.

ph: get_audio after next_track   <--- when working correctly, after starting the next track, the code should be pumping the decoder
ph: codec - after unlock mutex, mode=0, command=0
...................
ph: refill the buffer - mode=0, codec=2
ph: pump_decode

ph: get_audio after next_track
ph: refill the buffer - mode=0, codec=2
ph: pump_decode
.
ph: refill the buffer - mode=0, codec=2
ph: pump_decode

ph: get_audio after next_track
ph: refill the buffer - mode=0, codec=2
ph: pump_decode

ph: refill the buffer - mode=0, codec=2
ph: pump_decode

ph: refill the buffer - mode=0, codec=2
ph: pump_decode

ph: get_audio after next_track
ph: refill the buffer - mode=0, codec=2
ph: pump_decode
.
ph: get_audio after next_track
ph: refill the buffer - mode=0, codec=2
ph: pump_decode
.
ph: refill the buffer - mode=0, codec=2
ph: pump_decode

pa: Reset position counter
pa: End of stream
pa: Buffer ran out at end of track, next_ready=0   <--- buffer already ran out before aud.next() is called. Not sure if related.
ph: end()
Current track almost done. Prep next track.    <--- aud.next() call in t_phazor.py
ph: next - start_ms: 0, begin: C:\msys64\tmp/TauonMusicBox/audio-cache/015aa46abb9b58fa902d44cdb
ph: next - command = NONE
ph: next - mode = STOPPED
ph: start C:\msys64\tmp/TauonMusicBox/audio-cache/015aa46abb9b58fa902d44cdb   <--- phazor start()
ph: start - command = NONE
ph: start - end command=2
ph: next - end
ph: codec = MPG
ph: mpg123_open - before
ph: mpg123_open - after
ph: mpg123_getformat - begin
ph: mpg123_getformat - after
ph: mpg123_scan - begin
ph: mpg123_scan - after
ph: codec - before lock mutex
ph: codec - after lock mutex
ph: mpg123_length - before
ph: mpg123_length - after
ph: reset_set=0, reset_set_byte=3588, low=0, high=0
ph: codec - before unlock mutex
ph: codec - after unlock mutex, mode=2, command=2
ph: Jump
pa: End of stream
pa: Buffer ran out at end of track, next_ready=0   <--- After start(), immediately gets this
ph: end()    <--- phazor end() gets called. decoder stops. mode = STOPPED
Taiko2k commented 1 year ago

Hmm, I think decoder_eos() is getting called because mpg123 isn't giving any data. You mentioned you tried the track from the cache in another player, but do they work in Tauon at all?

  1. File loaded with mpg123 (did it succeed? is the file valid at this point?)
  2. pump_decode() gets nothing out (why?)
dannysu commented 1 year ago

Yes, the same track works in Tauon. This issue only shows up some of the time. Doesn't happen deterministically. When this issue occurs, if I use the UI and seek to any location, then the sound starts to work again.

Not quite sure why yet.