chromium/media/base/audio_bus.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/base/audio_bus.h"

#include <stddef.h>
#include <stdint.h>

#include <limits>
#include <utility>

#include "base/check_op.h"
#include "base/memory/aligned_memory.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "media/base/audio_parameters.h"
#include "media/base/limits.h"
#include "media/base/vector_math.h"

namespace media {

// In order to guarantee that the memory block for each channel starts at an
// aligned address when splitting a contiguous block of memory into one block
// per channel, we may have to make these blocks larger than otherwise needed.
// We do this by allocating space for potentially more frames than requested.
// This method returns the required size for the contiguous memory block
// in bytes and outputs the adjusted number of frames via |out_aligned_frames|.
static int CalculateMemorySizeInternal(int channels,
                                       int frames,
                                       int* out_aligned_frames) {}

static void ValidateConfig(int channels, int frames) {}

void AudioBus::CheckOverflow(int start_frame, int frames, int total_frames) {}

AudioBus::AudioBus(int channels, int frames)
    :{}

AudioBus::AudioBus(int channels, int frames, float* data)
    :{}

AudioBus::AudioBus(int frames, const std::vector<float*>& channel_data)
    :{}

AudioBus::AudioBus(int channels)
    :{}

AudioBus::~AudioBus() {}

std::unique_ptr<AudioBus> AudioBus::Create(int channels, int frames) {}

std::unique_ptr<AudioBus> AudioBus::Create(const AudioParameters& params) {}

std::unique_ptr<AudioBus> AudioBus::CreateWrapper(int channels) {}

std::unique_ptr<AudioBus> AudioBus::WrapVector(
    int frames,
    const std::vector<float*>& channel_data) {}

std::unique_ptr<AudioBus> AudioBus::WrapMemory(int channels,
                                               int frames,
                                               void* data) {}

std::unique_ptr<AudioBus> AudioBus::WrapMemory(const AudioParameters& params,
                                               void* data) {}

std::unique_ptr<const AudioBus> AudioBus::WrapReadOnlyMemory(int channels,
                                                             int frames,
                                                             const void* data) {}

std::unique_ptr<const AudioBus> AudioBus::WrapReadOnlyMemory(
    const AudioParameters& params,
    const void* data) {}

void AudioBus::SetChannelData(int channel, float* data) {}

void AudioBus::set_frames(int frames) {}

void AudioBus::SetWrappedDataDeleter(base::OnceClosure deleter) {}

size_t AudioBus::GetBitstreamDataSize() const {}

void AudioBus::SetBitstreamDataSize(size_t data_size) {}

int AudioBus::GetBitstreamFrames() const {}

void AudioBus::SetBitstreamFrames(int frames) {}

void AudioBus::ZeroFramesPartial(int start_frame, int frames) {}

void AudioBus::ZeroFrames(int frames) {}

void AudioBus::Zero() {}

bool AudioBus::AreFramesZero() const {}

// static
int AudioBus::CalculateMemorySize(const AudioParameters& params) {}

// static
int AudioBus::CalculateMemorySize(int channels, int frames) {}

// static
bool AudioBus::IsAligned(void* ptr) {}

void AudioBus::BuildChannelData(int channels, int aligned_frames, float* data) {}

void AudioBus::CopyTo(AudioBus* dest) const {}

void AudioBus::CopyAndClipTo(AudioBus* dest) const {}

void AudioBus::CopyPartialFramesTo(int source_start_frame,
                                   int frame_count,
                                   int dest_start_frame,
                                   AudioBus* dest) const {}

void AudioBus::Scale(float volume) {}

void AudioBus::SwapChannels(int a, int b) {}

}  // namespace media