mirror of
https://github.com/mozilla/cubeb
synced 2024-11-21 06:26:10 -07:00
Set buffer capacity to allow for buffering
Some checks failed
Build / build (macos-13, Debug) (push) Has been cancelled
Build / build (macos-13, Release) (push) Has been cancelled
Build / build (macos-14, Debug) (push) Has been cancelled
Build / build (macos-14, Release) (push) Has been cancelled
Build / build (ubuntu-20.04, Debug) (push) Has been cancelled
Build / build (ubuntu-20.04, Release) (push) Has been cancelled
Build / build (windows-2019, Debug) (push) Has been cancelled
Build / build (windows-2019, Release) (push) Has been cancelled
Build / build-android (arm64-v8a, Debug) (push) Has been cancelled
Build / build-android (arm64-v8a, Release) (push) Has been cancelled
Build / build-android (armeabi-v7a, Debug) (push) Has been cancelled
Build / build-android (armeabi-v7a, Release) (push) Has been cancelled
Build / build-android (x86_64, Debug) (push) Has been cancelled
Build / build-android (x86_64, Release) (push) Has been cancelled
Build / check_format (push) Has been cancelled
Some checks failed
Build / build (macos-13, Debug) (push) Has been cancelled
Build / build (macos-13, Release) (push) Has been cancelled
Build / build (macos-14, Debug) (push) Has been cancelled
Build / build (macos-14, Release) (push) Has been cancelled
Build / build (ubuntu-20.04, Debug) (push) Has been cancelled
Build / build (ubuntu-20.04, Release) (push) Has been cancelled
Build / build (windows-2019, Debug) (push) Has been cancelled
Build / build (windows-2019, Release) (push) Has been cancelled
Build / build-android (arm64-v8a, Debug) (push) Has been cancelled
Build / build-android (arm64-v8a, Release) (push) Has been cancelled
Build / build-android (armeabi-v7a, Debug) (push) Has been cancelled
Build / build-android (armeabi-v7a, Release) (push) Has been cancelled
Build / build-android (x86_64, Debug) (push) Has been cancelled
Build / build-android (x86_64, Release) (push) Has been cancelled
Build / check_format (push) Has been cancelled
This commit is contained in:
parent
2566793347
commit
b7089edab3
1 changed files with 3 additions and 24 deletions
|
@ -1134,8 +1134,10 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
|
||||||
std::unique_ptr<AAudioStreamBuilder, StreamBuilderDestructor> sbPtr(sb);
|
std::unique_ptr<AAudioStreamBuilder, StreamBuilderDestructor> sbPtr(sb);
|
||||||
|
|
||||||
WRAP(AAudioStreamBuilder_setErrorCallback)(sb, aaudio_error_cb, stm);
|
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)
|
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 in_data_callback{};
|
||||||
AAudioStream_dataCallback out_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;
|
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);
|
int rate = WRAP(AAudioStream_getSampleRate)(stm->ostream);
|
||||||
LOG("AAudio output stream sharing mode: %d",
|
LOG("AAudio output stream sharing mode: %d",
|
||||||
WRAP(AAudioStream_getSharingMode)(stm->ostream));
|
WRAP(AAudioStream_getSharingMode)(stm->ostream));
|
||||||
|
@ -1252,17 +1242,6 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
|
||||||
if (stm->voice_input) {
|
if (stm->voice_input) {
|
||||||
stm->input_session_id = WRAP(AAudioStream_getSessionId)(stm->istream);
|
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 bcap = WRAP(AAudioStream_getBufferCapacityInFrames)(stm->istream);
|
||||||
int rate = WRAP(AAudioStream_getSampleRate)(stm->istream);
|
int rate = WRAP(AAudioStream_getSampleRate)(stm->istream);
|
||||||
|
|
Loading…
Reference in a new issue