This commit is contained in:
Paul Adenot 2023-11-09 18:29:27 +01:00
Родитель b32ab34399
Коммит 6f0f147148
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -69,7 +69,7 @@ using namespace std;
X(AAudioStreamBuilder_setFramesPerDataCallback) X(AAudioStreamBuilder_setFramesPerDataCallback)
// not needed or added later on // not needed or added later on
// X(AAudioStreamBuilder_setDeviceId) \ // X(AAudioStreamBuilder_setDeviceId) \
// X(AAudioStreamBuilder_setSamplesPerFrame) \ // X(AAudioStreamBuilder_setSamplesPerFrame) \
// X(AAudioStream_getSamplesPerFrame) \ // X(AAudioStream_getSamplesPerFrame) \
// X(AAudioStream_getDeviceId) \ // X(AAudioStream_getDeviceId) \
@ -1124,7 +1124,8 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
WRAP(AAudioStreamBuilder_setDataCallback)(sb, out_data_callback, stm); WRAP(AAudioStreamBuilder_setDataCallback)(sb, out_data_callback, stm);
assert(stm->latency_frames < std::numeric_limits<int32_t>::max()); assert(stm->latency_frames < std::numeric_limits<int32_t>::max());
LOG("Frames per callback set to %d for output", stm->latency_frames); LOG("Frames per callback set to %d for output", stm->latency_frames);
WRAP(AAudioStreamBuilder_setFramesPerDataCallback)(sb, static_cast<int>(stm->latency_frames)); WRAP(AAudioStreamBuilder_setFramesPerDataCallback)
(sb, static_cast<int32_t>(stm->latency_frames));
int res_err = realize_stream(sb, stm->output_stream_params.get(), int res_err = realize_stream(sb, stm->output_stream_params.get(),
&stm->ostream, &frame_size); &stm->ostream, &frame_size);
@ -1179,14 +1180,16 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
WRAP(AAudioStreamBuilder_setDataCallback)(sb, in_data_callback, stm); WRAP(AAudioStreamBuilder_setDataCallback)(sb, in_data_callback, stm);
assert(stm->latency_frames < std::numeric_limits<int32_t>::max()); assert(stm->latency_frames < std::numeric_limits<int32_t>::max());
LOG("Frames per callback set to %d for input", stm->latency_frames); LOG("Frames per callback set to %d for input", stm->latency_frames);
WRAP(AAudioStreamBuilder_setFramesPerDataCallback) (sb, static_cast<int>(stm->latency_frames)); WRAP(AAudioStreamBuilder_setFramesPerDataCallback)
(sb, static_cast<int32_t>(stm->latency_frames));
int res_err = realize_stream(sb, stm->input_stream_params.get(), int res_err = realize_stream(sb, stm->input_stream_params.get(),
&stm->istream, &frame_size); &stm->istream, &frame_size);
if (res_err) { if (res_err) {
return res_err; return res_err;
} }
int32_t input_burst_size = WRAP(AAudioStream_getFramesPerBurst)(stm->istream); int32_t input_burst_size =
WRAP(AAudioStream_getFramesPerBurst)(stm->istream);
LOG("AAudio input burst size: %d", input_burst_size); LOG("AAudio input burst size: %d", input_burst_size);
// 3 times the burst size seems to be robust. // 3 times the burst size seems to be robust.
res = WRAP(AAudioStream_setBufferSizeInFrames)(stm->istream, res = WRAP(AAudioStream_setBufferSizeInFrames)(stm->istream,