Skip to content

Commit

Permalink
Attempt to reinitialize the stream when the error callback is called …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
padenot committed Apr 16, 2024
1 parent f42ca23 commit 529c3d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cubeb_aaudio.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 529c3d2

Please sign in to comment.