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
Audio not functional on Pixel 7 Pro running Android 14 Developer Preview 2 #3784
Comments
Thank you for your report. Unfortunately, AOSP sources for this version are not available yet. So it seems that there are two issues:
(unrelated to audio) and
What is the value of scrcpy/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java Lines 49 to 52 in 02586cf
Does it work with the following patch? diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java
index 5800487da..cb9a1e4ab 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Server.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Server.java
@@ -86,7 +86,7 @@ public final class Server {
// Before Android 11, audio is not supported.
// Since Android 12, we can properly set a context on the AudioRecord.
// Only on Android 11 we must fill app info for the AudioRecord to work.
- mustFillAppInfo |= audio && Build.VERSION.SDK_INT == Build.VERSION_CODES.R;
+ mustFillAppInfo |= audio;
if (mustFillAppInfo) {
Workarounds.fillAppInfo(); |
It's still 33 (
Decompiled source: private static int resolveSessionId(Context context, int requestedSessionId) {
int deviceId;
VirtualDeviceManager vdm;
if (requestedSessionId != 0) {
return requestedSessionId;
}
if (context == null || (deviceId = context.getDeviceId()) == 0 || (vdm = (VirtualDeviceManager) context.getSystemService(VirtualDeviceManager.class)) == null || vdm.getDevicePolicy(deviceId, 1) == 0) {
return 0;
}
return vdm.getAudioRecordingSessionId(deviceId);
} Returning 0 looks fine. diff --git a/server/src/main/java/com/genymobile/scrcpy/FakeContext.java b/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
index 844d6bd8..d611c642 100644
--- a/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
+++ b/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
@@ -31,6 +31,10 @@ public final class FakeContext extends ContextWrapper {
return PACKAGE_NAME;
}
+ public int getDeviceId(){
+ return 0;
+ }
+
@TargetApi(Build.VERSION_CODES.S)
@Override
public AttributionSource getAttributionSource() { This works on Android 14 RC2 emulator. It's a new method in |
public static class Default implements IClipboard {
public ClipData getPrimaryClip(String pkg, String attributionTag, int userId, int deviceId) {}
public void setPrimaryClip(ClipData clip, String callingPackage, String attributionTag, int userId, int deviceId) {}
public void addPrimaryClipChangedListener(IOnPrimaryClipChangedListener listener, String callingPackage, String attributionTag, int userId, int deviceId) {}
} |
Yep, just that patch is making audio work on the Pixel 7 Pro running Android 14 Developer Preview 2. Also no side effects as I tested with a Pixel XL running Android 11 and it's still fine after the patch. |
Thank you 👍 However, I'm surprised, because the error message suggests that the context is
|
Oh, probably because the default implementation delegates to the inner context, which is |
Please test/review branch |
Audio issues are resolved, however the clipboard errors are only semi-resolved. Device to computer clipboard works, computer clipboard to device text entry works, however computer to device clipboard sync errors and causes the controller to crash leading to the controller crashing and input no longer working. adb logcat
I've also done some more testing on the shortcuts and all work except for trying to turn the display off while mirroring. adb logcat
|
Oops, stupid mistake in my code. I just force-pushed
Thank you for your tests 👍
Could you please post your
|
That fixes the issue.
|
Hmm, What if you just bypass the multi-display code: diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java
index 3d83f73eb..0f181d8f6 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Device.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Device.java
@@ -277,7 +277,7 @@ public final class Device {
* @param mode one of the {@code POWER_MODE_*} constants
*/
public static boolean setScreenPowerMode(int mode) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ if (false && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// Change the power mode for all physical displays
long[] physicalDisplayIds = SurfaceControl.getPhysicalDisplayIds();
if (physicalDisplayIds == null) { |
Still a no go.
|
Hmm… ok, so I don't know 😕 As a side note, there is a new class |
(now that the source code of Android 14 is released)
It seems that the methods I don't have any device with Android 14 to test though. |
Oh, I hadn't noticed, this class is in This is caused by this commit: aosp-mirror/platform_frameworks_base@e2f3337 |
Is there any workaround for this? |
Is there perhaps an issue-tracker post about this, so we can star it, and maybe Google will allow it again? |
I opened an issue: https://issuetracker.google.com/issues/303565669 Please do not comment on that issue just to say that you are impacted, this would just add noise. |
I can test for you on my pixel 6a |
It remains 3 scrcpy features broken in Android 14:
|
Environment
Bug
Audio stream doesn't get initialized.
This happens with all of the supported codecs
Logs
scrcpy --list-encoders
scrcpy console log
adb logcat
The text was updated successfully, but these errors were encountered: