aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_aaudio.cpp
diff options
context:
space:
mode:
authorAndreas Pehrson <[email protected]>2024-06-27 12:04:24 +0200
committerAndreas Pehrson <[email protected]>2024-06-27 12:04:24 +0200
commitb7089edab3ee9e9a4e1765f49d38b580e53c6e59 (patch)
treed605b98543c3c7bfa5407489c58dcf553586f3aa /src/cubeb_aaudio.cpp
parent2566793347bd29f390f814fd67634b3063cca5f1 (diff)
downloadcubeb-b7089edab3ee9e9a4e1765f49d38b580e53c6e59.tar.gz
cubeb-b7089edab3ee9e9a4e1765f49d38b580e53c6e59.zip
Set buffer capacity to allow for bufferingprocessing-params
Diffstat (limited to 'src/cubeb_aaudio.cpp')
-rw-r--r--src/cubeb_aaudio.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp
index 7711d15..7d725ad 100644
--- a/src/cubeb_aaudio.cpp
+++ b/src/cubeb_aaudio.cpp
@@ -1134,8 +1134,10 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
std::unique_ptr<AAudioStreamBuilder, StreamBuilderDestructor> sbPtr(sb);
WRAP(AAudioStreamBuilder_setErrorCallback)(sb, aaudio_error_cb, stm);
+ // Capacity should be at least twice the frames-per-callback to allow double
+ // buffering.
WRAP(AAudioStreamBuilder_setBufferCapacityInFrames)
- (sb, static_cast<int32_t>(stm->latency_frames));
+ (sb, static_cast<int32_t>(3 * stm->latency_frames));
AAudioStream_dataCallback in_data_callback{};
AAudioStream_dataCallback out_data_callback{};
@@ -1188,18 +1190,6 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
return res_err;
}
- int32_t output_burst_size =
- WRAP(AAudioStream_getFramesPerBurst)(stm->ostream);
- LOG("AAudio output burst size: %d", output_burst_size);
- // 3 times the burst size seems to be robust.
- res = WRAP(AAudioStream_setBufferSizeInFrames)(stm->ostream,
- output_burst_size * 3);
- if (res < 0) {
- LOG("AAudioStream_setBufferSizeInFrames error (ostream): %s",
- WRAP(AAudio_convertResultToText)(res));
- // Not fatal
- }
-
int rate = WRAP(AAudioStream_getSampleRate)(stm->ostream);
LOG("AAudio output stream sharing mode: %d",
WRAP(AAudioStream_getSharingMode)(stm->ostream));
@@ -1252,17 +1242,6 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
if (stm->voice_input) {
stm->input_session_id = WRAP(AAudioStream_getSessionId)(stm->istream);
}
- int32_t input_burst_size =
- WRAP(AAudioStream_getFramesPerBurst)(stm->istream);
- LOG("AAudio input burst size: %d", input_burst_size);
- // 3 times the burst size seems to be robust.
- res = WRAP(AAudioStream_setBufferSizeInFrames)(stm->istream,
- input_burst_size * 3);
- if (res < AAUDIO_OK) {
- LOG("AAudioStream_setBufferSizeInFrames error (istream): %s",
- WRAP(AAudio_convertResultToText)(res));
- // Not fatal
- }
int bcap = WRAP(AAudioStream_getBufferCapacityInFrames)(stm->istream);
int rate = WRAP(AAudioStream_getSampleRate)(stm->istream);