Skip to content

Display and control your Android device

Disable audio stream with fatal error Throwable

Romain Vimont23710e04c12b
diff --git a/server/src/main/java/com/genymobile/scrcpy/audio/AudioEncoder.java b/server/src/main/java/com/genymobile/scrcpy/audio/AudioEncoder.java
index 33177228..a8e9c708 100644
--- a/server/src/main/java/com/genymobile/scrcpy/audio/AudioEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/audio/AudioEncoder.java
@@ -266,14 +266,14 @@ public final class AudioEncoder implements AsyncProcessor {
outputThread.start();
waitEnded();
- } catch (ConfigurationException e) {
- // Notify the error to make scrcpy exit
- streamer.writeDisableStream(true);
- throw e;
- } catch (Throwable e) {
+ } catch (AudioCaptureException e) {
// Notify the client that the audio could not be captured
streamer.writeDisableStream(false);
throw e;
+ } catch (Throwable e) {
+ // Notify the error to make scrcpy exit
+ streamer.writeDisableStream(true);
+ throw e;
} finally {
// Cleanup everything (either at the end or on error at any step of the initialization)
if (mediaCodecThread != null) {