badaix / snapdroid

Snapcast client for Android
GNU General Public License v3.0
127 stars 25 forks source link

SL_RESULT_MEMORY_FAILURE #14

Closed MrNuggelz closed 4 years ago

MrNuggelz commented 4 years ago

I have snapdroid running 24/7 on my android device and after some time the music stops and you can see the following error: Untitled

derWeihnachtsmann commented 4 years ago

Can you be please more specific, how many time need to be passed, before the error occurs? Which Phone do you use? What Android Version do you use?

badaix commented 4 years ago

I can reproduce this issue on my Samsung Galaxy S5, and this bug is also mentioned in Snapcast Issue #480. Problem is that when changing the stream or loosing the server connection, the client will destroy the audio player and recreate it when the stream continues. This restart of the OpenSL player engine (in my Samsung case) results in this error message, and cannot recover, until the Snapclient is restarted (stop and play pressed in the UI). There are three possibilities:

  1. Fix the bug, if possible and not a firmware issue (I failed to fix it upto now)
  2. Have a static player instance that persists during the runtime (Sample rate must be changed when switching to another stream)
  3. Add support for AAudio or Oboe, but AAudio is only available starting with Android Oreo

Regarding item 2: I plan to introduce optional resampling into Snapclient 0.19, so that Snapdroid could use the optimal samplerate for low latency playback.
Regarding item 3: Switching to Oboe is on the roadmap. It is a wrapper to OpenSL and AAudio, using AAudio preferred and, if not available, OpenSL as a fallback. Maybe that would already fix the problem also for devices using OpenSL, as I assume that Google's implementation is cleaner than mine.

badaix commented 4 years ago

Should be fixed with v0.19