blob: 9bfd00f228ba2caf2f7d5702bbd0553401f1f373 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_BASE_LOOPBACK_AUDIO_CONVERTER_H_
#define MEDIA_BASE_LOOPBACK_AUDIO_CONVERTER_H_
#include "base/macros.h"
#include "media/base/audio_converter.h"
namespace media {
// LoopbackAudioConverter works similar to AudioConverter and converts input
// streams to different audio parameters. Then, the LoopbackAudioConverter can
// be used as an input to another AudioConverter. This allows us to
// use converted audio from AudioOutputStreams as input to an AudioConverter.
// For example, this allows converting multiple streams into a common format and
// using the converted audio as input to another AudioConverter (i.e. a mixer).
class LoopbackAudioConverter : public AudioConverter::InputCallback {
public:
LoopbackAudioConverter(const AudioParameters& input_params,
const AudioParameters& output_params,
bool disable_fifo);
~LoopbackAudioConverter() override;
void AddInput(AudioConverter::InputCallback* input) {
audio_converter_.AddInput(input);
}
void RemoveInput(AudioConverter::InputCallback* input) {
audio_converter_.RemoveInput(input);
}
bool empty() { return audio_converter_.empty(); }
private:
double ProvideInput(AudioBus* audio_bus,
base::TimeDelta buffer_delay) override;
AudioConverter audio_converter_;
DISALLOW_COPY_AND_ASSIGN(LoopbackAudioConverter);
};
} // namespace media
#endif // MEDIA_BASE_LOOPBACK_AUDIO_CONVERTER_H_
|