From be56a7493b0bc3780ba34c2a8ad16b9e8b8e72bc Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 13 Nov 2023 13:56:52 +0100 Subject: Attempt to reinitialize the stream when the error callback is called with AAUDIO_ERROR_TIMEOUT This can happen when the client side of the AAudio API fails to write all the data to the server side, after the user callback has returned. According to the reporter, this can be hit when a debugger is attached. This fixes #767. --- src/cubeb_aaudio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp index db417c0..a7472dd 100644 --- a/src/cubeb_aaudio.cpp +++ b/src/cubeb_aaudio.cpp @@ -931,7 +931,7 @@ aaudio_error_cb(AAudioStream * astream, void * user_data, aaudio_result_t error) assert(stm->ostream == astream || stm->istream == astream); // Device change -- reinitialize on the new default device. - if (error == AAUDIO_ERROR_DISCONNECTED) { + if (error == AAUDIO_ERROR_DISCONNECTED || error == AAUDIO_ERROR_TIMEOUT) { LOG("Audio device change, reinitializing stream"); reinitialize_stream(stm); return; -- cgit v1.2.3