-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Failed to start audio capture / Demuxer 'audio': stream explicitly disabled by the device on Android 11 #4147
Comments
On diff --git a/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java b/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
index 7b20cce4f..8b30d6f26 100644
--- a/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
+++ b/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
@@ -118,7 +118,7 @@ public final class AudioCapture {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
startWorkaroundAndroid11();
try {
- tryStartRecording(3, 100);
+ tryStartRecording(6, 100);
} finally {
stopWorkaroundAndroid11();
} and run with |
Thank you for your very fast response.
|
OK, so I will change from 3 to 5 attempts (so the last one is after ~500ms). Thank you for your report. |
Happy if I can contribute. Thank you for colaborating and finding the cause / fix in no time. |
Merged into |
I have read the FAQ.
I have searched in existing issues.
OS: Ubuntu
scrcpy version: 2.1
installation method: manual build
device model: ASUS
Android version: 11 (LOS-based Custom ROM)
Sound does not work by default. As I've read in several other issues regarding sound, you bring up the Shell Heap Dump report activity for a short period of time to make android (11) think that scrcpy - which has the same uid - would be running upfront. That does not work on my device (ofc. with the screen on).
If I, however, run
adb shell "am start com.android.shell/.HeapDumpActivity"
before I run scrcpy, it does work. (The Heap Dump report activity pops up, scrcpy starts, closes it and audio works as expected.) Below I will post the output of what scrcpy logs without the manually started activity:When searching for similar Issues, I found #3796 which looked a lot like my issue. I therefore tried to apply the same fix which was successfull there: Setting
SystemClock.sleep()
to a higher value (I tried500
ms). After that I recompiled the scrcpy-server according to https://github.com/Genymobile/scrcpy/blob/master/doc/build.md#option-1-build-everything-from-sources (which is a real PITA btw, thank you for delivering that one pre-build by default.) and didnt notice any difference. On the other hand I have no experience with java whatsoever so I might have done some mistakes when recompiling.The text was updated successfully, but these errors were encountered: