mirror of
https://github.com/Genymobile/scrcpy
synced 2024-11-11 01:10:32 +00:00
Move audio compatibility check
The compatibility depends on the capture constraints, not the encoding. This will allow to add a new capture implementation with different constraints. PR #5102 <https://github.com/Genymobile/scrcpy/pull/5102>
This commit is contained in:
parent
cf09e78323
commit
5e605b9b8f
@ -121,6 +121,13 @@ public final class AudioCapture {
|
||||
recorder.startRecording();
|
||||
}
|
||||
|
||||
public void checkCompatibility() throws AudioCaptureException {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
Ln.w("Audio disabled: it is not supported before Android 11");
|
||||
throw new AudioCaptureException();
|
||||
}
|
||||
}
|
||||
|
||||
public void start() throws AudioCaptureException {
|
||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
|
||||
startWorkaroundAndroid11();
|
||||
|
@ -187,6 +187,8 @@ public final class AudioEncoder implements AsyncProcessor {
|
||||
|
||||
boolean mediaCodecStarted = false;
|
||||
try {
|
||||
capture.checkCompatibility(); // throws an AudioCaptureException on error
|
||||
|
||||
Codec codec = streamer.getCodec();
|
||||
mediaCodec = createMediaCodec(codec, encoderName);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user