#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/views/media_preview/mic_preview/audio_stream_coordinator.h"
#include <memory>
#include "base/task/bind_post_task.h"
#include "chrome/browser/ui/views/media_preview/mic_preview/audio_stream_view.h"
namespace {
constexpr float kMaxAudioValue = …;
constexpr int kNumberOfBuffersPerSecond = …;
constexpr float kAudioValueScaler = …;
constexpr int kRolledAverageSize = …;
float GetRolledAverageValue(float current_audio_value,
float previous_audio_level) { … }
}
AudioStreamCoordinator::AudioStreamCoordinator(views::View& parent_view) { … }
AudioStreamCoordinator::~AudioStreamCoordinator() { … }
void AudioStreamCoordinator::ConnectToDevice(
mojo::PendingRemote<media::mojom::AudioStreamFactory> audio_stream_factory,
const std::string& device_id,
int sample_rate) { … }
void AudioStreamCoordinator::OnAudioCaptured(
std::unique_ptr<media::AudioBus> audio_bus,
base::TimeTicks capture_time) { … }
void AudioStreamCoordinator::Stop() { … }
AudioStreamView* AudioStreamCoordinator::GetAudioStreamView() { … }