chromium/media/base/audio_latency.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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)
// Taken from "Bit Twiddling Hacks"
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
uint32_t RoundUpToPowerOfTwo(uint32_t v) {}
#endif

#if BUILDFLAG(IS_ANDROID)
// WebAudio renderer's quantum size (frames per callback) that is used for
// calculating the "interactive" buffer size.
// TODO(crbug.com/40637820): This number needs to be passed down from Blink when
// user-selectable render quantum size is implemented.
const int kWebAudioRenderQuantumSize = 128;

// From media/renderers/paint_canvas_video_renderer.cc. To calculate the optimum
// buffer size for Pixel 3/4/5 devices, which has a HW buffer size of 96 frames.
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

}  // namespace

// static
bool AudioLatency::IsResamplingPassthroughSupported(Type type) {}

// static
int AudioLatency::GetHighLatencyBufferSize(int sample_rate,
                                           int preferred_buffer_size) {}

// static
int AudioLatency::GetRtcBufferSize(int sample_rate, int hardware_buffer_size) {}

// static
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) {}

// static
// Used for UMA histogram names, do not change the lookup.
const char* AudioLatency::ToString(Type type) {}
}  // namespace media