chromium/media/base/amplitude_peak_detector.cc

// Copyright 2023 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/amplitude_peak_detector.h"

#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "media/base/audio_sample_types.h"

namespace media {

constexpr float kLoudnessThreshold =;  // Corresponds to approximately -6dbs

AmplitudePeakDetector::AmplitudePeakDetector(PeakDetectedCB peak_detected_cb)
    :{}

AmplitudePeakDetector::~AmplitudePeakDetector() = default;

void AmplitudePeakDetector::SetIsTracingEnabledForTests(
    bool is_tracing_enabled) {}

void AmplitudePeakDetector::FindPeak(const void* data,
                                     int frames,
                                     int bytes_per_sample) {}

void AmplitudePeakDetector::FindPeak(const AudioBus* audio_bus) {}

template <class T>
bool IsDataLoud(const T* audio_data,
                int frames,
                const T min_loudness,
                const T max_loudness) {}

template <class T>
bool LoudDetector(const void* data, int frames) {}

template <>
bool LoudDetector<float>(const void* data, int frames) {}

// Returns whether if any of the samples in `audio_bus` surpass
// `kLoudnessThreshold`.
bool AmplitudePeakDetector::AreFramesLoud(const AudioBus* audio_bus) {}

// Returns whether if any of the samples in `data` surpass `kLoudnessThreshold`.
bool AmplitudePeakDetector::AreFramesLoud(const void* data,
                                          int frames,
                                          int bytes_per_sample) {}

void AmplitudePeakDetector::MaybeReportPeak(bool are_frames_loud) {}

}  // namespace media