aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_audiounit.cpp
diff options
context:
space:
mode:
authorMatthew Gregan <[email protected]>2022-03-26 13:50:32 +1300
committerMatthew Gregan <[email protected]>2022-03-30 18:12:01 +1300
commitb62d61bc661b49c7a7f5d97f4657189c630ac7a5 (patch)
treec1d774314a0d474ee8f489ce18f378a4fe1a14ab /src/cubeb_audiounit.cpp
parent16c2a521525ae91c376eaa8a49b99ecccd89e066 (diff)
downloadcubeb-b62d61bc661b49c7a7f5d97f4657189c630ac7a5.tar.gz
cubeb-b62d61bc661b49c7a7f5d97f4657189c630ac7a5.zip
audiounit,pulse,wasapi: Handle data_callback errors and signal to user via state_callback.
Diffstat (limited to 'src/cubeb_audiounit.cpp')
-rw-r--r--src/cubeb_audiounit.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cubeb_audiounit.cpp b/src/cubeb_audiounit.cpp
index 8f2741a..37036a3 100644
--- a/src/cubeb_audiounit.cpp
+++ b/src/cubeb_audiounit.cpp
@@ -541,6 +541,13 @@ audiounit_input_callback(void * user_ptr, AudioUnitRenderActionFlags * flags,
long outframes = cubeb_resampler_fill(stm->resampler.get(),
stm->input_linear_buffer->data(),
&total_input_frames, NULL, 0);
+ if (outframes < 0) {
+ stm->shutdown = true;
+ OSStatus r = AudioOutputUnitStop(stm->input_unit);
+ assert(r == 0);
+ stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
+ return noErr;
+ }
stm->draining = outframes < total_input_frames;
// Reset input buffer