daneren2005 / Subsonic

Home of the DSub Android client fork
GNU General Public License v3.0
578 stars 162 forks source link

Audio is silent after each song change #1081

Open btouellette opened 2 years ago

btouellette commented 2 years ago

Audio is silent after each song change. Audio resumes if I seek within the song but only until the next song change at which point it goes silent again.

Android SDK: 31 Device Model: Pixel 6 Device Name: Google oriole ROM: SD1A.210817.036 Build Number: 205

sserenade commented 2 years ago

Same here on a Pixel 6 Pro. Android 12.

dSub version: 5.5.2

logs don't seem too useful, I get a "failed to save in media store" issue that may be unrelated. dSub has all permissions it asks for.

2021-11-20 17:10:26.564 22657-22747/github.daneren2005.dsub W/DownloadFile: Failed to save in media store
    java.lang.UnsupportedOperationException: Unknown or unsupported URL: content://media/external/audio/albumart/-1085193394
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:174)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
        at android.content.ContentProviderProxy.query(ContentProviderNative.java:481)
        at android.content.ContentResolver.query(ContentResolver.java:1219)
        at android.content.ContentResolver.query(ContentResolver.java:1151)
        at android.content.ContentResolver.query(ContentResolver.java:1107)
        at github.daneren2005.dsub.service.MediaStoreService.insertAlbumArt(MediaStoreService.java:172)
        at github.daneren2005.dsub.service.MediaStoreService.saveInMediaStore(MediaStoreService.java:85)
        at github.daneren2005.dsub.service.DownloadFile.saveToStore(DownloadFile.java:365)
        at github.daneren2005.dsub.service.DownloadFile.access$1400(DownloadFile.java:43)
        at github.daneren2005.dsub.service.DownloadFile$DownloadTask.doInBackground(DownloadFile.java:504)
        at github.daneren2005.dsub.service.DownloadFile$DownloadTask.doInBackground(DownloadFile.java:410)
        at github.daneren2005.dsub.util.BackgroundTask$Task.execute(BackgroundTask.java:208)
        at github.daneren2005.dsub.util.BackgroundTask$Task.access$300(BackgroundTask.java:194)
        at github.daneren2005.dsub.util.BackgroundTask$TaskRunnable.run(BackgroundTask.java:319)
        at java.lang.Thread.run(Thread.java:920)

If I let the app keep playing, the next song is shown, and the "time playing" on the left can exceed the total song time on the right. The song doesn't change for me automatically after the first. Manually skipping restarts audio.

sserenade commented 2 years ago

I did a bit more debugging, and while I'm unable to pinpoint what's wrong, in my case it seems to involve pre-caching upcoming tracks and potentially server-side transcoding. So, disclaimer, these results seem oddly inconsistent in my testing and might be difficult to replicate.

  1. In my experience, this only seems to affect files that aren't transcoded by the server. For example, .flac files are unaffected because they are transcoded to mp3 320.
  2. If I set "Songs to preload" to a non-zero value, it results in this bug. If I set it to 0, the bug doesn't happen.
  3. Separately, if I force .mp3 files to get run through ffmpeg on the server, no matter how many I cache, the bug doesn't happen.

Given all this, it's also very odd that it seems to have manifested on Android 12 for me. This did not happen on 11.

Doing a mediainfo diff on an .mp3 that has been run through ffmpeg, it looks like some metadata is added, perhaps this "fixes" the file in some way that helps with playing it?

My server is Airsonic 10.6.2-RELEASE.

resinbeard commented 2 years ago

also seeing this on my navidrome server version 0.43.0 (d9f26826), pixel 6 pro

i noticed: moving the playhead with my finger is enough to get audio back

nemogoc commented 2 years ago

Also seeing this on a pixel 6 with stock subsonic server

groumfi commented 2 years ago

Also occur on my Blackview Tab 6 Android 11 but only when using bluetooth Setting "Songs to preload" to 0 as suggested by sserenade is valid workaround However, once all songs are loaded (after being played), if I play again, the issue is back Strange thing is that it does not happen when in offline mode... Last, I've tried to downgrade Dsub to many previous versions (down to 4.x) and issue is still present Does not occur on my Samsung Note Android 10 Does not occur with Subsonic official client or Substreamer or Ultrasonic

SoSquidTaste commented 2 years ago

Chiming in that I just observed this on a Pixel 6 running the latest Android 12L Beta build

g4njawizard commented 2 years ago

Same here with Pixel 6 Pro & Navidrome. I usually have my Server offline to safe power and cache all Songs on my phone. This does not occur on my GF's Samsung Galaxy S10+ using my Navidrome Server or cached offline files. Odd is also that when I close Dsub, it doesn't stop playing. I have to "Force Shutdown" the App. @sserenade 's workaround with "disable preload" didn't work for me. I still get random silence when shuffling thru my playlists.

NewEvolution commented 2 years ago

Another confirmation on Pixel 6/Navidrome.

Of note that I haven't seen mentioned - hitting the "previous" button to restart the song, either in-app or on a connected Bluetooth device, causes playback to resume until the next song change.

e: Newer issue #1122 suggested Settings > playback > Gapless Playback > uncheck it This & a subsequent relaunch of the app resolved the issue for me.