chromium/components/capture_mode/audio_capturer.h

// 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.

#ifndef COMPONENTS_CAPTURE_MODE_AUDIO_CAPTURER_H_
#define COMPONENTS_CAPTURE_MODE_AUDIO_CAPTURER_H_

#include <memory>
#include <string_view>

#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "components/capture_mode/capture_mode_export.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_bus_pool.h"
#include "media/base/audio_capturer_source.h"
#include "media/base/audio_parameters.h"
#include "media/mojo/mojom/audio_stream_factory.mojom-forward.h"
#include "mojo/public/cpp/bindings/pending_remote.h"

namespace capture_mode {

// Defines the type of the callback that will be triggered repeatedly by the
// audio input device to deliver a stream of buffers containing the captured
// audio data. Each call will provide an `audio_bus` and the
// `audio_capture_time` when the first frame of that bus was captured.
// This callback will be invoked on a worker thread created by the audio input
// device (`media::AudioDeviceThread`). The provided `audio_bus` owns its own
// memory.
OnAudioCapturedCallback;

// Defines an audio capturer that can capture an audio input device whose ID is
// `device_id`. The provided `audio_stream_factory` will be used so that the
// underlying `AudioInputDevice` can communicate with audio service via IPC. The
// provided `audio_params` will be used to initialize the underlying audio
// capturer. `callback` will be invoked according to the rules specified above.
class CAPTURE_MODE_EXPORT AudioCapturer
    : public media::AudioCapturerSource::CaptureCallback {};

}  // namespace capture_mode

#endif  // COMPONENTS_CAPTURE_MODE_AUDIO_CAPTURER_H_