#include "media/base/audio_latency.h"
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include "base/check_op.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/limits.h"
#include "media/media_buildflags.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "media/base/mac/audio_latency_mac.h"
#endif
#if BUILDFLAG(IS_FUCHSIA)
#include "base/fuchsia/scheduler.h"
#endif
namespace media {
namespace {
#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_FUCHSIA)
uint32_t RoundUpToPowerOfTwo(uint32_t v) { … }
#endif
#if BUILDFLAG(IS_ANDROID)
const int kWebAudioRenderQuantumSize = 128;
int GCD(int a, int b) {
return a == 0 ? b : GCD(b % a, a);
}
int LCM(int a, int b) {
return a / GCD(a, b) * b;
}
#endif
}
bool AudioLatency::IsResamplingPassthroughSupported(Type type) { … }
int AudioLatency::GetHighLatencyBufferSize(int sample_rate,
int preferred_buffer_size) { … }
int AudioLatency::GetRtcBufferSize(int sample_rate, int hardware_buffer_size) { … }
int AudioLatency::GetInteractiveBufferSize(int hardware_buffer_size) { … }
int AudioLatency::GetExactBufferSize(base::TimeDelta duration,
int sample_rate,
int hardware_buffer_size,
int min_hardware_buffer_size,
int max_hardware_buffer_size,
int max_allowed_buffer_size) { … }
const char* AudioLatency::ToString(Type type) { … }
}