Compare commits
1 Commits
fix4392zxc
...
camera_noa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3caaf6dbc2 |
@@ -18,6 +18,17 @@ scrcpy --video-source=display --audio-source=mic # force display AND micropho
|
||||
scrcpy --video-source=camera --audio-source=output # force camera AND device audio output
|
||||
```
|
||||
|
||||
Audio can be disabled:
|
||||
|
||||
```bash
|
||||
# audio not captured at all
|
||||
scrcpy --video-source=camera --no-audio
|
||||
scrcpy --video-source=camera --no-audio --record=file.mp4
|
||||
|
||||
# audio captured and recorded, but not played
|
||||
scrcpy --video-source=camera --no-audio-playback --record=file.mp4
|
||||
```
|
||||
|
||||
|
||||
## List
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public final class FakeContext extends MutableContextWrapper {
|
||||
}
|
||||
|
||||
private FakeContext() {
|
||||
super(Workarounds.retrieveSystemContext());
|
||||
super(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.content.AttributionSource;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.AudioManager;
|
||||
import android.media.AudioRecord;
|
||||
@@ -31,12 +30,6 @@ public final class Workarounds {
|
||||
|
||||
public static void apply(boolean audio, boolean camera) {
|
||||
Workarounds.prepareMainLooper();
|
||||
try {
|
||||
fillActivityThread();
|
||||
FakeContext.get();
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
boolean mustFillAppInfo = false;
|
||||
boolean mustFillBaseContext = false;
|
||||
@@ -130,22 +123,6 @@ public final class Workarounds {
|
||||
ApplicationInfo applicationInfo = new ApplicationInfo();
|
||||
applicationInfo.packageName = FakeContext.PACKAGE_NAME;
|
||||
|
||||
Application application = new Application() {
|
||||
@Override
|
||||
public String getOpPackageName() {
|
||||
return FakeContext.PACKAGE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackageManager getPackageManager() {
|
||||
return FakeContext.get().getPackageManager();
|
||||
}
|
||||
};
|
||||
|
||||
Field initialApplicationField = activityThreadClass.getDeclaredField("mInitialApplication");
|
||||
initialApplicationField.setAccessible(true);
|
||||
initialApplicationField.set(activityThread, application);
|
||||
|
||||
// appBindData.appInfo = applicationInfo;
|
||||
Field appInfoField = appBindDataClass.getDeclaredField("appInfo");
|
||||
appInfoField.setAccessible(true);
|
||||
@@ -329,16 +306,4 @@ public final class Workarounds {
|
||||
throw new RuntimeException("Cannot create AudioRecord");
|
||||
}
|
||||
}
|
||||
|
||||
static Context retrieveSystemContext() {
|
||||
try {
|
||||
Method getSystemContextMethod = activityThreadClass.getDeclaredMethod("getSystemContext");
|
||||
Context ctx = (Context) getSystemContextMethod.invoke(activityThread);
|
||||
Ln.i("===== " + ctx);
|
||||
return ctx;
|
||||
} catch (Exception e) {
|
||||
Ln.e("Cannot retrieve system context", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user