oboe icon indicating copy to clipboard operation
oboe copied to clipboard

Glitches on Samsung S8 (Pie) when WiFi enabled

Open paulorrfilho opened this issue 5 years ago • 16 comments

Android version(s): 9 Android device(s): Samsung Galaxy S8 Oboe version: 1.5 App name used for testing: Drumthumper (built locally or Play Store version)

Short description Glitches consistently

Steps to reproduce Easier way: Just download the drumthumper app from the Play Store Or just run the stock project from Github I also tried various different kBufferSizeInBursts sizes that had no impact.

There is another glitch bug reported for a Galaxy S10, not sure whether they are related, or this something wrong with Samsung devices.

Expected behavior No glitches

Actual behavior Consistent glitches

Device Galaxy S8

Any additional context Glitch Test === STARTED at Wed Mar 10 11:05:47 CST 2021 AutoGlitch OboeTester (44) v 1.6.2, Oboe v 1.5.1 samsung, SM-G950U1, dreamqlteue PPR1.180610.011.G950U1UES8DTJ1 ========================== #1 Requested: INP-L, ID = 0, SR = 0, Perf = LL, EX, ch = 1[0] OUT-L, ID = 0, SR = 0, Perf = LL, EX, ch = 2[0] Actual: INP-L, ID = 10, SR = 48000, Perf = NO, SH, ch = 1[0] OUT-L, ID = 3, SR = 48000, Perf = LL, SH, ch = 2[0] Did not get requested sharing mode. SKIP - share ========================== #2 Requested: INP-L, ID = 0, SR = 0, Perf = LL, EX, ch = 2[0] OUT-L, ID = 0, SR = 0, Perf = LL, EX, ch = 1[0] Actual: INP-L, ID = 10, SR = 48000, Perf = NO, SH, ch = 2[0] OUT-L, ID = 3, SR = 48000, Perf = LL, SH, ch = 1[0] Did not get requested sharing mode. SKIP - share ========================== #3 Requested: INP-L, ID = 0, SR = 48000, Perf = LL, SH, ch = 1[0] OUT-L, ID = 0, SR = 48000, Perf = LL, SH, ch = 2[0] Actual: INP-L, ID = 10, SR = 48000, Perf = NO, SH, ch = 1[0] OUT-L, ID = 3, SR = 48000, Perf = LL, SH, ch = 2[0] Result: #glitches = 587, #resets = 7, max no glitch = 1.419 secs SNR = 30.1 db, #locked = 174752, xruns = 0/0, FAIL !!!!, glitch ========================== #4 Requested: INP-L, ID = 0, SR = 48000, Perf = LL, SH, ch = 2[0] OUT-L, ID = 0, SR = 48000, Perf = LL, SH, ch = 1[0] Actual: INP-L, ID = 10, SR = 48000, Perf = NO, SH, ch = 2[0] OUT-L, ID = 3, SR = 48000, Perf = LL, SH, ch = 1[0] Disable background test thread. Tests finished without exception. == TEST STOPPED ==

paulorrfilho avatar Mar 10 '21 17:03 paulorrfilho

@paulorrfilho - Thanks for this report. Also thanks for running the AutoGlitch test.

I suspect the bufferSize is too low on the S8. Can you please run the OboeTester TEST OUTPUT. Tap OPEN then START. Do you hear glitches? What is the burst size? What happens if you change the bufferSize? You can select 1,2,3 bursts or use the fader to get arbitrary sizes.

philburk avatar Mar 10 '21 17:03 philburk

Tried various possibilities and it is still glitching. Tests: buffer size = 1, 2, 3 and 100% (1536) API=Unspecified Performance= Low Latency

Testing with "Performance = None" obviously there are no glitches.

paulorrfilho avatar Mar 10 '21 17:03 paulorrfilho

Thanks for the quick reply. How often are the glitches? A few per minute? A few per second? Constant?

Can you try opening with 1 or 2 channels to see if there is a difference?

philburk avatar Mar 10 '21 17:03 philburk

Also tested different channels, same thing. Glitches at every second. This has been an issue for a long time. My only app ported to Android also has the same issue, kind of got busy with other things and forgot about it. It is reflected in my app's rating :( in comparison with the iOS version.

paulorrfilho avatar Mar 10 '21 18:03 paulorrfilho

I did try going with SoundPools but the latency is not good enough in my opinion. Also tested AudioTrack, for which I experienced higher latencies. Oboe provides excellent latency results but it glitches so much :( Not sure whether this is a very specific situation with my Samsung device or it is wide spread among older devices.

paulorrfilho avatar Mar 10 '21 18:03 paulorrfilho

Thanks! We need to know how to workaround this in the QuirksManager.

What was the "burst = ?" for the low latency AAudio tests? And capacity? Is MMAP enabled? I don't think it is supported on S8.

Can you please set the Audio API to OpenSL ES in the TEST OUTPUT before you OPEN? Does it glitch?

In your app you could try requesting a larger Buffer Capacity and then increase the Buffer Size higher. At some point it may stop glitching and still be lower latency than the performance mode NONE.

philburk avatar Mar 10 '21 18:03 philburk

burst = 192, capacity = 1536 MMAP is disabled Changing to OpenSL ES does not have any impact

Increased capacity to 6144 and kBufferSizeInBursts to 16, no difference

paulorrfilho avatar Mar 10 '21 18:03 paulorrfilho

Wow. Thanks again.

So to summarize: if performanceMode=LowLatency then output glitches even when the buffer size is large, stereo or mono, OpenSL ES or AAudio. The S8 is running Pie, Android 9.0. I assume the glitches are heard over the speaker.

It is hard to imagine this could be happening on all S8 devices. Perhaps a driver has gotten into a state where it is disabling interrupts for a long time. That would glitch the Fast Mixer and cause glitches downstream. That would be consistent with the observation.

Can you please try going into Airplane Mode? Pull down from top of screen and look for Airplane icon. That will disable the WiFi and Bluetooth drivers. They can sometimes disable interrupts.

If that does not work, try restarting the phone by long pressing the power button.

(I will report all this data back to Samsung.)

philburk avatar Mar 10 '21 18:03 philburk

Ok, just got some interesting results. All tests using a wired earphone.

  • Turning off the WiFi works! Even with the default settings (burst =192, buffer cap = 1536, burst multiplier = 2)
  • WiFi on will cause glitches regardless of the buffer settings. I tried many different settings: increased buffer capacity to 6144 and burst multiplier to 16, it has no effect.

Any suggestions on how to solve this? Is this an Oboe or Android or Samsung bug?

paulorrfilho avatar Mar 10 '21 19:03 paulorrfilho

For the record, the first time I turned WiFi off it reduced the glitching issue but it did not solve completely. I had to restart my phone to see the full impact of the WiFi interference.

paulorrfilho avatar Mar 10 '21 20:03 paulorrfilho

I just found a previous bug raised also related to wifi interference. [https://github.com/google/oboe/issues/1178] It seems it was fixed in Android 11?

paulorrfilho avatar Mar 10 '21 22:03 paulorrfilho

Sorry to keep bugging you on this but is there any guidance on how to deal with this? It is not clear to me who is responsible for the bug and whether there is a solution.

paulorrfilho avatar Mar 11 '21 16:03 paulorrfilho

Thanks for the DUP to #1178. That does sound like the same bug. Somehow I missed that. This is probably a Samsung bug in their WiFi. I expect that the WiFi driver is disabling interrupts, which causes an underflow at the DSP level. So it glitches on both AAudio and OpenSL ES, and because increasing the buffer size did not help.

I don't think there is any workaround that we can do. I will ask Samsung if they have any advice.

philburk avatar Mar 15 '21 20:03 philburk

@paulorrfilho - I wonder if this is an Exynos device. What do you get if you enter:

    adb shell getprop ro.arch
    adb shell getpropro.hardware.chipname

philburk avatar Mar 15 '21 20:03 philburk

those commands don't work for me, however adb -s xxxxxxxxx shell getprop does the job. This is what I got: [ro.hardware]: [qcom] [ro.hardware.chipname]: [MSM8998]

Which is a Qualcomm MSM8998 Snapdragon 835 (10 nm) - USA & China

There is a different S8 version in other countries, not mine, which uses a Exynos 8895

paulorrfilho avatar Mar 15 '21 21:03 paulorrfilho

Thanks. I passed that on to Samsung.

philburk avatar Mar 17 '21 15:03 philburk