Closed blazeking101 closed 1 year ago
Does #3862 work for you?
I get this error too:
[server] INFO: Device: vivo V2043 (Android 11)
INFO: Renderer: direct3d
INFO: Initial texture: 720x1600
WARN: Demuxer 'audio': stream explicitly disabled by the device
[server] ERROR: Exception on thread Thread[Thread-4,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:102)
at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:102)
at android.media.VivoAudioRecordImpl.getSignatures(VivoAudioRecordImpl.java:100)
at android.media.VivoAudioRecordImpl.getSignInfo(VivoAudioRecordImpl.java:68)
at android.media.VivoAudioRecordImpl.isSupportSubMixRecording(VivoAudioRecordImpl.java:133)
at android.media.AudioRecord.<init>(AudioRecord.java:433)
at android.media.AudioRecord$Builder.build(AudioRecord.java:798)
at com.genymobile.scrcpy.AudioCapture.createAudioRecord(AudioCapture.java:58)
at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:90)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:183)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:120)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:923)
sorry for the very late response, i couldn't really understand what was i supposed to do in the blog could you explain to me on what to do? (my honor phone is not andriod 13 and yet it doesn't work)
@blazeking101 Please test this version and report if this works for you: https://github.com/Genymobile/scrcpy/pull/3862#issuecomment-1561871804
@rom1v ,my phone is also honor 70, I have try #3862 version, and i get this: scrcpy 2.0 https://github.com/Genymobile/scrcpy C:\Users\Q520x\Downloads\scrcpy-win64-vivo...skipped. 60.8 MB/s (56403 bytes in 0.001s) [server] INFO: Device: HONOR FNE-AN00 (Android 12) [server] ERROR: Exception on thread Thread[Thread-4,5,main] java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:220) at android.media.AudioRecord.startRecording(AudioRecord.java:1326) at com.genymobile.scrcpy.AudioCapture.startRecording(AudioCapture.java:110) at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:122) at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:192) at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:122) at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4) at java.lang.Thread.run(Thread.java:930) INFO: Renderer: direct3d WARN: Demuxer 'audio': stream explicitly disabled by the device INFO: Texture: 1080x2400 WARN: Killing the server...
@TheTouYu Could you please post your framework.jar
?
adb pull /system/framework/framework.jar
ok! thanks your reply! framework.zip
thanks you,here ls: https://github.com/Genymobile/scrcpy/files/11717450/framework.zip
So on current AOSP master
, the implementation of AudioRecord.startRecording()
is:
public void startRecording()
throws IllegalStateException {
if (mState != STATE_INITIALIZED) {
throw new IllegalStateException("startRecording() called on an "
+ "uninitialized AudioRecord.");
}
// start recording
synchronized(mRecordingStateLock) {
if (native_start(MediaSyncEvent.SYNC_EVENT_NONE, 0) == SUCCESS) {
handleFullVolumeRec(true);
mRecordingState = RECORDSTATE_RECORDING;
}
}
}
On your device, the code has been modified by the vendor:
public void startRecording() throws IllegalStateException {
if (this.mRecordSource != 5) {
try {
Context context = ActivityThread.currentApplication();
Objects.requireNonNull(context);
String appName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).applicationInfo.loadLabel(context.getPackageManager()).toString();
String action = this.mRecordSource == 4 ? "开启通话录音" : "本地录音";
HwFrameworkFactory.getHiLog().authPrintf(3, 218114827, TAG, appName, "android.audiorecord", ActivityThread.currentPackageName(), "AudioRecord.startRecording", action, new Object[0]);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "appName not found");
}
}
if (this.mState != 1) {
throw new IllegalStateException("startRecording() called on an uninitialized AudioRecord.");
}
if (HwDeviceManager.disallowOp(30)) {
HnMediaFactory.getHnAudioRecord().showDisableMicrophoneToast();
throw new IllegalStateException("microphone has been disabled.");
}
synchronized (this.mRecordingStateLock) {
if (native_start(0, 0) == 0) {
handleFullVolumeRec(true);
this.mRecordingState = 3;
HwAudioServiceManager.checkRecordActive(this.mRecordSource);
HwAudioServiceManager.sendRecordStateChangedIntent(this.mRecordingState);
} else {
HwAudioServiceManager.sendRecordStateChangedIntent(-1);
}
}
}
It attempts to get information about the application package :confused: Scrcpy could not be run as an application (otherwise it would not get shell permissions), so it fails. For now, I don't see any solution to bypass this piece of code and make it work on your device.
ok, I get! thanks for your work.
String action = this.mRecordSource == 4 ? "开启通话录音" : "本地录音";
Translates to
String action = this.mRecordSource == 4 ? "Turn on call recording" : "local recording";
Context context = ActivityThread.currentApplication();
I think enabling currentApplication
patching will conflict with Nvidia Shield devices? #3801
context.getPackageManager()
ActivityThread.getSystemContext()
returns a Context
that getPackageManager
can be invoked on. Use that Context
for base
of FakeContext
should pass this line. (found when investigating https://github.com/Genymobile/scrcpy/issues/1887#issuecomment-1564633226)
Usually the getSystemContext
method is called like Context context = ActivityThread.systemMain().getSystemContext();
, not sure if any ActivityThread
(for example the one Scrcpy created) will work.
if (HwDeviceManager.disallowOp(30))
HwAudioServiceManager.checkRecordActive(this.mRecordSource);
HwAudioServiceManager.sendRecordStateChangedIntent(this.mRecordingState);
I'm more worried about these.
I think that even if we manage to get a more or less valid context, context.getPackageManager().getPackageInfo(…)
will return null or throw an exception anyway.
I think it will work. ActivityThread.currentApplication().getPackageName()
delegates to FakeContext.getPackageName()
which returns "com.android.shell"
, and it's a real system app on Android.
I tried this minimal code:
Looper.prepareMainLooper();
@SuppressLint("PrivateApi") var activityThreadClass = Class.forName("android.app.ActivityThread");
@SuppressLint("DiscouragedPrivateApi") var systemMainMethod = activityThreadClass.getDeclaredMethod("systemMain");
var systemMain = systemMainMethod.invoke(null);
Objects.requireNonNull(systemMain);
var getSystemContextMethod = systemMain.getClass().getDeclaredMethod("getSystemContext");
var systemContext = (Context) getSystemContextMethod.invoke(systemMain);
Objects.requireNonNull(systemContext);
var packageManager = systemContext.getPackageManager();
var packageInfo = packageManager.getPackageInfo("com.android.shell", 0);
System.out.println(packageInfo.applicationInfo.loadLabel(packageManager));
It prints Shell
.
Oh, great :)
Is there a benefit in calling ActivityThread.systemMain()
rather than just new ActivityThread()
(like scrcpy does in fillActivityThread()
)
I don't know. This code was copied from a StackOverflow answer. I guess the ActivityThread
created by Scrcpy will also work, systemMain
is the simplest method to get an ActivityThread
.
ActivityThread.getSystemContext()
returns aContext
thatgetPackageManager
can be invoked on. Use thatContext
forbase
ofFakeContext
should pass this line. (found when investigating https://github.com/Genymobile/scrcpy/issues/1887#issuecomment-1564633226)
Let's try:
@TheTouYu Please replace this binary in your scrcpy v2.0 folder and test again:
scrcpy-server
SHA-256: 70eb70c2256f54cf93657b1272974ee952a1b6aae91cffd68cd38b95d317bdb5
Please post any stacktrace (the error printed in the console).
ok,
C:\Users\Q520x\Downloads\scrcpy-win64-v2.0\scrcpy-win64-v2.0>scrcpy.exe --tcpip=192.168.123.11
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.123.11:5555...
INFO: Connected to 192.168.123.11:5555
C:\Users\Q520x\Downloads\scrcpy-win64-v2.0\scrcpy-win64-v2...1 file pushed, 0 skipped. 9.5 MB/s (95226 bytes in 0.010s)
[server] INFO: Device: HONOR FNE-AN00 (Android 12)
[server] ERROR: Exception on thread Thread[Thread-4,5,main]
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:220)
at android.media.AudioRecord.startRecording(AudioRecord.java:1326)
at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:91)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:183)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:120)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:930)
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Initial texture: 2400x1080
Ah, of course, ActivityThread.currentApplication()
still returns null
.
Let's quick-fix that with this additional diff:
Here is a new binary:
scrcpy-server
SHA-256: c5f182a63be88fc392165181546ec99495cc5ded5f631ab3df809cd153d31679
amazing! it works now
Oh, so let's try if it works with only that last change without the first one:
Please test this new binary:
scrcpy-server
SHA-256: 4345ce30da5d12663281abeb93210a48039065eb948f6c1c375be551c85bd2a4
Thanks very much! and This time it report this:
C:\Users\Q520x\Downloads\scrcpy-win64-v2.0\scrcpy-win64-v2.0>scrcpy.exe -e
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
C:\Users\Q520x\Downloads\scrcpy-win64-v2.0\scrcpy-win64-v2...file pushed, 0 skipped. 129.6 MB/s (95226 bytes in 0.001s)
[server] INFO: Device: HONOR FNE-AN00 (Android 12)
[server] ERROR: Exception on thread Thread[Thread-4,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:105)
at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:105)
at android.media.AudioRecord.startRecording(AudioRecord.java:1327)
at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:91)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:183)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:120)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:930)
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Initial texture: 2400x1080
OK, the result is as expected :+1: Thank you for the test.
I'll work on a proper fix on dev
branch (maybe this evening) and I'll provide a new binary to test before merging. It will be included in scrcpy v2.1.
Aha, this is what i should do, and I'm very happy, It also made the process of my first bug report enjoyable. Dalao, I am extremly grateful for the effort you had done for a better sortware user experience! (my English is poor , sorry for that)
Arf, passing the system context as base in FakeContext
causes #994 on Xiaomi devices:
java.io.FileNotFoundException: /data/system/theme_config/theme_compatibility.xml: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:492)
at java.io.FileInputStream.<init>(FileInputStream.java:160)
at java.io.FileInputStream.<init>(FileInputStream.java:115)
at java.io.FileReader.<init>(FileReader.java:58)
at miui.content.res.ThemeCompatibilityLoader.getVersion(ThemeCompatibilityLoader.java:108)
at miui.content.res.ThemeCompatibilityLoader.getConfigDocumentTree(ThemeCompatibilityLoader.java:126)
at miui.content.res.ThemeCompatibilityLoader.loadConfig(ThemeCompatibilityLoader.java:59)
at miui.content.res.ThemeCompatibility.<clinit>(ThemeCompatibility.java:31)
at miui.content.res.ThemeCompatibility.isThemeEnabled(ThemeCompatibility.java:111)
at android.content.res.MiuiResourcesImpl.<clinit>(MiuiResourcesImpl.java:41)
at android.content.res.Resources.<init>(Resources.java:353)
at android.content.res.MiuiResources.<init>(MiuiResources.java:49)
at android.content.res.Resources.getSystem(Resources.java:233)
at android.app.LoadedApk.<init>(LoadedApk.java:239)
at android.app.ContextImpl.createSystemContext(ContextImpl.java:2625)
at android.app.ActivityThread.getSystemContext(ActivityThread.java:2533)
at java.lang.reflect.Method.invoke(Native Method)
at com.genymobile.scrcpy.FakeContext.retrieveSystemContext(FakeContext.java:27)
at com.genymobile.scrcpy.FakeContext.<init>(FakeContext.java:39)
at com.genymobile.scrcpy.FakeContext.<clinit>(FakeContext.java:19)
at com.genymobile.scrcpy.FakeContext.get(FakeContext.java:35)
at com.genymobile.scrcpy.Workarounds.fillAppContext(Workarounds.java:99)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:120)
at com.genymobile.scrcpy.Server.main(Server.java:218)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:407)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
at libcore.io.IoBridge.open(IoBridge.java:478)
... 25 more
(That's just a log in the system code, nothing is thrown.)
Maybe I should pass it only if the manufacturer is not Xiaomi :confused:
@TheTouYu By the way, could you post the result of:
adb shell getprop ro.product.manufacturer
adb shell getprop ro.product.brand
Ok, the result:
[h@TouYu relang]$ adb shell getprop ro.product.manufacturer
HONOR
[h@TouYu relang]$ adb shell getprop ro.product.brand
HONOR
@yume-chan Oh, providing a base context might also impact Vivo phones: https://github.com/Genymobile/scrcpy/pull/3757#issuecomment-1454684588
So, I worked on a new patch which should fix this issue without breaking #3805: 86e5c90ed6b8eed145c631777752d130f3996a11 (honor
branch).
Please test this new binary:
scrcpy-win64-issue4015.zip
SHA-256: 1a65039d83cb4a40bfcfdb4c7918c05e8e3e85d594d570ecbcdfc3db5ff1d435
oh it works now thank you for all of your hard work i really appreciate it much love <333
Awesome.
I refactored and simplified the workaround. I removed the call to fillAppInfo()
, I think it is not necessary), but I'm not entirely sure, so it might break.
Could you please test this new version with an Honor device? (e91954de82d7c196797e66d38dc4c906a817897e honor.3
branch)
scrcpy-win64-honor_3.zip
SHA-256: 8d2405c724d9af90951da780f135dd22c90e8d27df674cd0e731cbd2bb76afff
sorry for late response, here is result:
C:\Users\Q520x\Downloads\scrcpy-win64-honor_3\scrcpy-win64-v2.0-93-ge91954de8>scrcpy.exe --tcpip=192.168.123.11
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.123.11:5555...
INFO: Connected to 192.168.123.11:5555
C:\Users\Q520x\Downloads\scrcpy-win64-honor_3\scrcpy-win64... file pushed, 0 skipped. 76.3 MB/s (56871 bytes in 0.001s)
[server] INFO: Device: [HONOR] HONOR FNE-AN00 (Android 12)
[server] ERROR: Exception on thread Thread[audio-encoder,5,main]
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:220)
at android.media.AudioRecord.startRecording(AudioRecord.java:1326)
at com.genymobile.scrcpy.AudioCapture.startRecording(AudioCapture.java:114)
at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:126)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:193)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:124)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:930)
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1080x2400
@TheTouYu OK, thank you :+1:
So this one should work (feb247f78266ce68c4d6d81da6b20653d679dba4 branch honor.4
):
scrcpy-win64-honor_4.zip
SHA-256: a3c7fa03047e22245b4c1e22702208c332594847237ec217816d100260c11485
Could you confirm?
I get this:
Thank you for your quick test. I'm surprised that it does not work.
Does https://github.com/Genymobile/scrcpy/issues/4015#issuecomment-1596192278 work for you?
let me try, wait a moment
oh no,
C:\Users\Q520x\Downloads\scrcpy-win64-issue4015\scrcpy-win64-v2.0-93-g86e5c90ed>scrcpy.exe -e
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
C:\Users\Q520x\Downloads\scrcpy-win64-issue4015\scrcpy-win... file pushed, 0 skipped. 58.1 MB/s (56923 bytes in 0.001s)
[server] INFO: Device: [HONOR] HONOR FNE-AN00 (Android 12)
[server] ERROR: Exception on thread Thread[audio-encoder,5,main]
java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:220)
at android.media.AudioRecord.startRecording(AudioRecord.java:1326)
at com.genymobile.scrcpy.AudioCapture.startRecording(AudioCapture.java:114)
at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:126)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:193)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:124)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:930)
[server] INFO: newMaxSize = 1920
[server] INFO: Retrying with -m1920...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 2400x1080
[server] INFO: newMaxSize = 1600
[server] INFO: Retrying with -m1600...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 1280
[server] INFO: Retrying with -m1280...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 1024
[server] INFO: Retrying with -m1024...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 800
[server] INFO: Retrying with -m800...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 0
[server] ERROR: Exception on thread Thread[video,5,main]
android.media.MediaCodec$CodecException: start failed
at android.media.MediaCodec.native_start(Native Method)
at android.media.MediaCodec.start(MediaCodec.java:2289)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:102)
at com.genymobile.scrcpy.ScreenEncoder.lambda$start$0$com-genymobile-scrcpy-ScreenEncoder(ScreenEncoder.java:290)
at com.genymobile.scrcpy.ScreenEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:930)
OK, there was some confusion because the first patches were applied on master
while the latest were applied on dev
, and there were changes regarding workarounds between both branches.
So, maybe this one will work (1c2d4b18b2ab8490a0da18c37b987223279106f8 branch honor.5
)
scrcpy-win64-honor_5.zip
SHA-256: 9b79dd887ec60f73347ca53693703906d22fdfaa797844a2d322c749887c7efa
sorry, this version still no work (~^~)
C:\Users\Q520x\Downloads\scrcpy-win64-honor_5\scrcpy-win64-v2.0-94-g1c2d4b18b>scrcpy.exe -e
scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
C:\Users\Q520x\Downloads\scrcpy-win64-honor_5\scrcpy-win64...file pushed, 0 skipped. 196.8 MB/s (56927 bytes in 0.000s)
[server] INFO: Device: [HONOR] HONOR FNE-AN00 (Android 12)
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 1920
[server] INFO: Retrying with -m1920...
[server] INFO: Retrying...
INFO: Renderer: direct3d
INFO: Texture: 2400x1080
[server] INFO: newMaxSize = 1600
[server] INFO: Retrying with -m1600...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 1280
[server] INFO: Retrying with -m1280...
[server] INFO: Retrying...
[server] WARN: Could not get any audio timestamp
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 1024
[server] INFO: Retrying with -m1024...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 800
[server] INFO: Retrying with -m800...
[server] INFO: Retrying...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: start failed
[server] INFO: newMaxSize = 0
[server] ERROR: Exception on thread Thread[video,5,main]
android.media.MediaCodec$CodecException: start failed
at android.media.MediaCodec.native_start(Native Method)
at android.media.MediaCodec.start(MediaCodec.java:2289)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:102)
at com.genymobile.scrcpy.ScreenEncoder.lambda$start$0$com-genymobile-scrcpy-ScreenEncoder(ScreenEncoder.java:290)
at com.genymobile.scrcpy.ScreenEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:930)
Ok, I will need more time then (maybe this evening or tomorrow) :/
Could you just confirm that https://github.com/Genymobile/scrcpy/issues/4015#issuecomment-1594432451 still works (if you replace the binary in your v2.0 release)?
sure, I am using it and it still works.
Just an additional quick test with a single line change (just in case it is sufficient):
(9f9b852ae7deaae9dc4c4baa445424d9620f3824 branch honor.6
)
scrcpy-win64-honor_6.zip
SHA-256: d79a02e66e3a118c05119b1a4778dfba26439c4f3402a9fa828fe9fc3cc15d42
congratulations! it‘s ok! ( $ ^^ $ )
So it works for Honor devices and also for Vivo devices (https://github.com/Genymobile/scrcpy/issues/3805#issuecomment-1597249985). Let's merge it: fb21bbf763691407bc069d84b8e6248667a80e6f
Having the same issue with 2.1 on Huawei P Smart 2019 (Android 12, POT LX1).
@CrimsonFork Please post the whole scrcpy output.
$ scrcpy
Ah, whoops, turns out EMUI12 is Android 10. Obviously.
[server] INFO: Device: [Xiaomi] lge LG-US998 (Android 11)
INFO: Renderer: direct3d
WA[server] ERROR: Could not create default audio encoder for opus
List of audio encoders:
--audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
RN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1440x2880
[server] ERROR: Exception on thread Thread[audio-encoder,5,main]
java.lang.IllegalArgumentException: Failed to initialize audio/opus, error 0xfffffffe
at android.media.MediaCodec.native_setup(Native Method)
at android.media.MediaCodec.<init>(Unknown Source:121)
at android.media.MediaCodec.createEncoderByType(Unknown Source:3)
at com.genymobile.scrcpy.AudioEncoder.createMediaCodec(AudioEncoder.java:292)
at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:184)
at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:124)
at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:923)
framework.jar: https://www.mediafire.com/file/fd273euyhlib45m/framework.jar/file
[server] ERROR: Could not create default audio encoder for opus List of audio encoders: --audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
Hi, I have the same issue on my Realme phone. Here's the console output:
scrcpy 2.3.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (usb) d56f859f device RMX2103
E:\Downloads\scrcpy-win64-v2.3.1\scrcpy-win64-v2.3.1\scrcp... file pushed, 0 skipped. 67.3 MB/s (66007 bytes in 0.001s)
[server] INFO: Device: [realme] realme RMX2103 (Android 11)
INFO: Renderer: direct3d
INFO: Texture: 720x1600
[server] ERROR: Failed to start audio capture
[server] ERROR: On Android 11, audio capture must be started in the foreground, make sure that the device is unlocked when starting scrcpy.
WARN: Demuxer 'audio': stream explicitly disabled by the device
Check the error message:
On Android 11, audio capture must be started in the foreground, make sure that the device is unlocked when starting scrcpy.
See https://github.com/Genymobile/scrcpy/blob/master/doc/audio.md
Sorry for the trouble, audio works when I start scrcpy after unlocking my phone.
Environment
Describe the bug the audio forwarding doesn't work with my device I tried looking into solutions for this issue but I cannot find a solution to it
[server] INFO: Device: HONOR FNE-NX9 (Android 12) [server] ERROR: Exception on thread Thread[Thread-4,5,main] java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:220) at android.media.AudioRecord.startRecording(AudioRecord.java:1326) at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:91) at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:183) at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:120) at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:2) at java.lang.Thread.run(Thread.java:1012) INFO: Renderer: direct3d WARN: Demuxer 'audio': stream explicitly disabled by the device INFO: Initial texture: 1080x2400