0005-increase-aaudio-powersaving-buffering.patch (1159B)
1 diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp 2 --- a/src/cubeb_aaudio.cpp 3 +++ b/src/cubeb_aaudio.cpp 4 @@ -1328,18 +1328,18 @@ aaudio_stream_init_impl(cubeb_stream * s 5 6 int rate = WRAP(AAudioStream_getSampleRate)(stm->ostream); 7 int32_t output_burst_frames = 8 WRAP(AAudioStream_getFramesPerBurst)(stm->ostream); 9 // 3 times the burst size seems fairly robust, use it as minimum. 10 int32_t output_buffer_size_frames = 3 * output_burst_frames; 11 if (stm->latency_frames > POWERSAVE_LATENCY_FRAMES_THRESHOLD) { 12 // FramesPerBurst is large in power saving mode, reduce the buffer size to 13 - // 1 burst. 14 - output_buffer_size_frames = output_burst_frames; 15 + // 2 bursts. 16 + output_buffer_size_frames = 2 * output_burst_frames; 17 } 18 // Make output buffer size a function of the requested latency so clients 19 // can adapt to their use case. 20 output_buffer_size_frames = 21 std::max(output_buffer_size_frames, 22 static_cast<int32_t>(stm->latency_frames / 2)); 23 int32_t output_final_buffer_size_frames = 24 WRAP(AAudioStream_setBufferSizeInFrames)(stm->ostream,