SubmarinerApp / Submariner

A Subsonic client for macOS
https://submarinerapp.com
BSD 3-Clause "New" or "Revised" License
133 stars 4 forks source link

Playback stops altogether when buffer fails #139

Closed Porco-Rosso closed 1 year ago

Porco-Rosso commented 1 year ago

Describe the bug When listening to songs, sometimes the playback stops all-together. Only starting to play another song resumes playback. When playback fails, the song timer keeps counting up. I assume this is a problem with the buffer not keeping up due to server bandwidth issues. Something might be wrong with how the player recovers from the playback. Pausing and resuming playback doesn't fix the issue. This doesn't happen when I stream directly from the Navidrome webUI

This happens much more often with longer songs, such as mixtapes. Submariner cache fail.txt Here is the console log. Playback fails at the last line: <<<< FAQ TIMING SHIM >>>> FigAudioQueueTimingShimFlush: [0x600001e19ef0] Calling AudioQueueFlush(0x1140219d)

To Reproduce Steps to reproduce the behavior:

  1. Play song from Navidrome that is long (20m+)
  2. After ~1M playback stops, but the song timer keeps counting up, as if playing.
  3. pause/start does not fix playback

Expected behavior Player pauses for buffer and then resumes gracefully

Screenshots Not sure it would help.

Versions:

Additional context None.

NattyNarwhal commented 1 year ago

I have a suspicion this might be related to AVURLAssetPreferPreciseDurationAndTimingKey, without it, FLAC seeking and elapsed times can be inaccurate. Is the media you're trying to play FLAC?

I also wonder if it might be related to automatic downloads when starting playback, and the network traffic caused by that on the same server messing with the live stream happening. Do you have that option on, and are you playing tracks that aren't downloaded/have a downloaded version?

NattyNarwhal commented 1 year ago

For the latter case, I don't think the current mechanism for this is terribly clear about its intent or when it's supposed to trigger, so I'm refactoring it there. It should now do it before track start.

Porco-Rosso commented 1 year ago

I'm playing 320kbps Mp3s, no fancy FLACs. Also not downloading anything, just streaming the content.

The bandwidth to my server should be okay, I get 6-7Mbs on other transfers.

NattyNarwhal commented 1 year ago

If you're not using downloads (automatic or otherwise), then my suspicion is the precise seeking/timing option causing problems. I've made another test build, including a change that will only set that option for FLACs and the changes to automatic download behaviour.

Submariner-2.3.zip

Porco-Rosso commented 1 year ago

Sorry I was traveling and didn't have time to test. So far it seems to have fixed the problem. Thanks!