Skip to content

Display and control your Android device

Report device disconnection on audio EOS

Romain Vimont0983f0a194db
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c
index d68a2424..aabb7c5a 100644
--- a/app/src/scrcpy.c
+++ b/app/src/scrcpy.c
@@ -252,7 +252,9 @@ sc_audio_demuxer_on_ended(struct sc_demuxer *demuxer,
// Contrary to the video demuxer, keep mirroring if only the audio fails
// (unless --require-audio is set).
- if (status == SC_DEMUXER_STATUS_ERROR
+ if (status == SC_DEMUXER_STATUS_EOS) {
+ PUSH_EVENT(SC_EVENT_DEVICE_DISCONNECTED);
+ } else if (status == SC_DEMUXER_STATUS_ERROR
|| (status == SC_DEMUXER_STATUS_DISABLED
&& options->require_audio)) {
PUSH_EVENT(SC_EVENT_DEMUXER_ERROR);