Skip to content

Commit

Permalink
wip: wait for recorder bufq to empty before freeing.
Browse files Browse the repository at this point in the history
  • Loading branch information
kinetiknz committed Feb 4, 2025
1 parent a223c3f commit e159132
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/cubeb_opensl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,21 @@ opensl_destroy_recorder(cubeb_stream * stm)
LOG("Failed to clear recorder buffer queue. Error code: %lu", res);
return CUBEB_ERROR;
}

SLBufferQueueState state;
while (true) {
SLresult res = (*stm->recorderBufferQueueItf)->GetState(
stm->recorderBufferQueueItf, &state);
if (res != SL_RESULT_SUCCESS) {
LOG("Failed to get recorder buffer queue state. Error code: %lu", res);
break;
}
if (state.count == 0) {
break;
}
usleep(10 * 1000);
}

stm->recorderBufferQueueItf = nullptr;
for (uint32_t i = 0; i < stm->input_array_capacity; ++i) {
free(stm->input_buffer_array[i]);
Expand Down

0 comments on commit e159132

Please sign in to comment.