Audio quality drops when phone is off

Description

When my phone turns off the audio quality going to my computer is lowered and the audio is extremely choppy.

Steps to reproduce

Turn off your phone while listening to music on Spotify and connect through IP no cords.

Devices

Let us know which devices you used, it’ll probably help.

Device A:
Windows 10
AudioRelay 1.0

Device B:

Ulefone armor 7e
AudioRelay 1.0

The same happens when streaming audio from PC to Android. A few moments after the screen is off packet loss occurs and audio becomes choppy (latency on the graph also increases a lot).

Tweaking energy saving settings doesn’t seem to help (I’ve already allowed AudioRelay to work in the background, but the issue persists). Maybe there’s a way to prevent the device from sleeping when streaming is active? When screen is on (and app is opened) everything works great.

Device A:

Windows 11 (connected using Ethernet cable)

Device B:

Honor Pad 10, Android 16 (connected using WiFi 5Ghz)

AudioRelay 1.0 alpha 9

@Kaalam_Hughes

Please try the instructions from Ulefone | Don’t kill my app! to disable battery optimizations.

@Oneline

I know you’ve already tried to tweak the battery optimization settings, but please ensure that you’ve tried all the ones listed here.

I suspect that disabling PowerGenie will help.

As for notification suggestion, the app should already display one. If you don’t see it, please ensure that you’ve enabled the notification permission for AudioRelay.

For some reason there are no notifications. Option is greyed out.

Android only shows that there’s an active audio playback and allows me to switch between speaker and headphones. It’s a different thing.

I’ve disabled power saving, but can’t disable PowerGenie, unfortunately (adb doesn’t allow me to freeze application, and uninstall seems too risky).

Right, the app no longer prompted users for the permission. It’s fixed in 1.0.0-alpha11, thanks for the report.
I don’t think it’ll help in your case, though. (That’d be great if it does!)

Also, the new version is using a low-latency audio system (AAudio). With some luck, it’ll hint your device to not throttle AudioRelay.

True, but in theory, you should be able to reinstall it if it causes any issues by using adb shell pm install-existing xxx as specified here.


To investigate further, we could check the device’s logs to see if there’s any clue there

  • Run adb logcat > logcat.log
  • Reproduce the issue in AudioRelay
  • Stop the command
  • Send logcat.log by email or PM

Alright, I think I found one of the reasons why this happens and a half-working workaround.

Period of inactivity is the culprit. Not only it ignores Hosting and Auto stop after inactivity checkboxes (which I have unticked), it interrupts an active stream with fixed interval causing packet loss and latency spikes. Yesterday I had it set to 10 minutes, and problem occurred every 10 minutes. Today I set it to 5 minutes, the problem started occurring every 5 minutes (I even used stopwatch).

Following this logic if I set period of inactivity to 24 hours, the problem gets solved. Unfortunately it still happened, but in at least 1 hour, then started repeating every few minutes until I restarted the stream (nothing in the log by the way). Still a good find I guess, something is not right with that option.

I’ll move on to testing AudioRelay on another device.

I was able to reproduce this behaviour on Motorola Edge 50 Fusion: I set Period of inactivity to 5 minutes and had packet loss/latency spikes every 5 minutes when screen is off. After that I set it to 24 hours and had no issues for 1.5 hours.