Bug 1947917 - Add cubeb patch to increase AAudio buffering when not doing low-latency and re-vendor. r=padenot,cubeb-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D238767
This commit is contained in:
Andreas Pehrson
2025-02-19 14:02:37 +00:00
parent e6ef5b89c6
commit ca4b67f619
3 changed files with 27 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
diff --git a/src/cubeb_aaudio.cpp b/src/cubeb_aaudio.cpp
--- a/src/cubeb_aaudio.cpp
+++ b/src/cubeb_aaudio.cpp
@@ -1328,18 +1328,18 @@ aaudio_stream_init_impl(cubeb_stream * s
int rate = WRAP(AAudioStream_getSampleRate)(stm->ostream);
int32_t output_burst_frames =
WRAP(AAudioStream_getFramesPerBurst)(stm->ostream);
// 3 times the burst size seems fairly robust, use it as minimum.
int32_t output_buffer_size_frames = 3 * output_burst_frames;
if (stm->latency_frames > POWERSAVE_LATENCY_FRAMES_THRESHOLD) {
// FramesPerBurst is large in power saving mode, reduce the buffer size to
- // 1 burst.
- output_buffer_size_frames = output_burst_frames;
+ // 2 bursts.
+ output_buffer_size_frames = 2 * output_burst_frames;
}
// Make output buffer size a function of the requested latency so clients
// can adapt to their use case.
output_buffer_size_frames =
std::max(output_buffer_size_frames,
static_cast<int32_t>(stm->latency_frames / 2));
int32_t output_final_buffer_size_frames =
WRAP(AAudioStream_setBufferSizeInFrames)(stm->ostream,

View File

@@ -21,6 +21,7 @@ vendoring:
- 0002-disable-crash-reporter-death-test.patch
- 0003-audiounit-ios-compile-fixes.patch
- 0004-disable-cubeb_one_duplex_one_input-macos10.15.patch
- 0005-increase-aaudio-powersaving-buffering.patch
skip-vendoring-steps:
- update-moz-build
exclude:

View File

@@ -1333,8 +1333,8 @@ aaudio_stream_init_impl(cubeb_stream * stm, lock_guard<mutex> & lock)
int32_t output_buffer_size_frames = 3 * output_burst_frames;
if (stm->latency_frames > POWERSAVE_LATENCY_FRAMES_THRESHOLD) {
// FramesPerBurst is large in power saving mode, reduce the buffer size to
// 1 burst.
output_buffer_size_frames = output_burst_frames;
// 2 bursts.
output_buffer_size_frames = 2 * output_burst_frames;
}
// Make output buffer size a function of the requested latency so clients
// can adapt to their use case.