-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for bluetooth headset audio stutter #8846
Conversation
Ah, right. I'd like to set the low watermark adaptively based on the system-provided buffer size though, maybe a simple factor. You are right that it's probably set a little too low right now though... |
These values right? Note that it's clamped to 512: ppsspp/android/jni/app-android.cpp Line 566 in 1837870
Just need to provide them into NativeApp somewhere, and we could adapt. I assume they will be related to bluetooth when it's plugged in... but what happens when bluetooth is connected during gameplay? Do we need to handle re-adapting? It might already be a problem in hitting the fast path there? Note: on a Nexus 5: Guessing bluetooth provides initially a larger value, like 4096? -[Unknown] |
Right, for the low watermark we should probably stick to the optimalFramesPerBuffer but without clamping to 512, maybe multiplied by a small factor. I think that should be enough. As for changing at runtime, that would indeed be a concern - but if we can notice the change, changing the low watermark at runtime should not be an issue. |
If it is any help, Bluetooth output issues are a daily phenomenom for latency-optimized applications of all kind. For example pretty much every OpenSL based application (which does use the system-provided values for providing low-latency output) suffers from identical symptoms. From what I've read up the accepted workaround so far seems to be upping the buffer size to 2048x4... which is exactly what my commit does. I don't think the system provided values actually update when a Bluetooth headset is present, so there might not be a easy way around this issue other than doing what I've already done in the pull request. The only alternative way of doing this would be to install a permanently listening BroadcastReceiver (in a background service for example) and monitoring for Bluetooth connect and disconnect events, which would then change the audio settings as needed. |
Hello Thanks for taking time to read. |
|
I have a few android devices, mostly with Snapdragon processors, and I noticed a trend here, on ALL my snapdragon devices I get Bluetooth lag or stuttering in ppsspp even with 100% speed (the fix above does fix or improve it), I tested on a Snapdragon 800 and Snapdraon 650, However on my other cheap device that has a Rockchip rk3188 the bluetooth has no lags or delays in ppsspp at 100% speed, so I am wondering if these lags are related to the hardware, if that's the case it might be simpler to add an option like Snapdragon BT fix or Mediatek BT fix. we would need people with different CPU types (mediatek, snapdragon, exynos, rockchip,..etc) to report if their device is effected. |
@hyakki- Interesting find. I can't really confirm it myself as all my devices are snapdragon based but if what you say is true then this might be another reason to make this an toggle in the menu. |
Yup, I'm going to make it a toggle soon, that will also help investigation I guess. Been a bit swamped with other things, but it's coming :) |
Well, I said soon, it wasn't - but now it's done. See (and please test) #9138. Closing this. |
you must of read my mind!, just installed the beta yesterday and I didn't see the option, then today option added, anyways I quickly tested and audio is working fine with my bt headphones, I will do some more testing tonight on a few other devices, so far so good. |
It's the same issue we've had before on the NVidia Shield (and to an similiar extend on the OnePlus 3), just on a bigger scale.
This merge fixes bluetooth audio once and for all.
It also has the nice side-effect of fixing some smaller stutters on the OnePlus 3 when using the built-in speakers or wired headphones.
I know it's shooting pidgeons with cannons, but at least it works.