blob: 284f92d134959bb84391836f33de1151c80d7b89 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.org4ecea3e2012-06-27 03:25:31 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef VOICE_ENGINE_OUTPUT_MIXER_H_
12#define VOICE_ENGINE_OUTPUT_MIXER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
kwiberg5a25d952016-08-17 07:31:12 -070014#include <memory>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "common_audio/resampler/include/push_resampler.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020017#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "modules/audio_conference_mixer/include/audio_conference_mixer.h"
19#include "modules/audio_conference_mixer/include/audio_conference_mixer_defines.h"
20#include "rtc_base/criticalsection.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
22namespace webrtc {
23
24class AudioProcessing;
niklase@google.com470e71d2011-07-07 08:21:25 +000025class FileWrapper;
niklase@google.com470e71d2011-07-07 08:21:25 +000026
27namespace voe {
28
29class Statistics;
30
solenbergb63310a2017-09-18 03:04:12 -070031class OutputMixer : public AudioMixerOutputReceiver
niklase@google.com470e71d2011-07-07 08:21:25 +000032{
33public:
pbos@webrtc.org92135212013-05-14 08:31:39 +000034 static int32_t Create(OutputMixer*& mixer, uint32_t instanceId);
niklase@google.com470e71d2011-07-07 08:21:25 +000035
36 static void Destroy(OutputMixer*& mixer);
37
pbos@webrtc.org6141e132013-04-09 10:09:10 +000038 int32_t SetEngineInformation(Statistics& engineStatistics);
niklase@google.com470e71d2011-07-07 08:21:25 +000039
pbos@webrtc.org6141e132013-04-09 10:09:10 +000040 int32_t SetAudioProcessingModule(
niklase@google.com470e71d2011-07-07 08:21:25 +000041 AudioProcessing* audioProcessingModule);
42
pbos@webrtc.org6141e132013-04-09 10:09:10 +000043 int32_t MixActiveChannels();
niklase@google.com470e71d2011-07-07 08:21:25 +000044
xians@webrtc.org56925312014-04-14 10:50:37 +000045 int32_t DoOperationsOnCombinedSignal(bool feed_data_to_apm);
niklase@google.com470e71d2011-07-07 08:21:25 +000046
pbos@webrtc.org6141e132013-04-09 10:09:10 +000047 int32_t SetMixabilityStatus(MixerParticipant& participant,
pbos@webrtc.org92135212013-05-14 08:31:39 +000048 bool mixable);
niklase@google.com470e71d2011-07-07 08:21:25 +000049
Peter Kasting69558702016-01-12 16:26:35 -080050 int GetMixedAudio(int sample_rate_hz, size_t num_channels,
andrew@webrtc.org4ecea3e2012-06-27 03:25:31 +000051 AudioFrame* audioFrame);
niklase@google.com470e71d2011-07-07 08:21:25 +000052
niklase@google.com470e71d2011-07-07 08:21:25 +000053 virtual ~OutputMixer();
54
andrew@webrtc.org4ecea3e2012-06-27 03:25:31 +000055 // from AudioMixerOutputReceiver
niklase@google.com470e71d2011-07-07 08:21:25 +000056 virtual void NewMixedAudio(
pbos@webrtc.org92135212013-05-14 08:31:39 +000057 int32_t id,
niklase@google.com470e71d2011-07-07 08:21:25 +000058 const AudioFrame& generalAudioFrame,
59 const AudioFrame** uniqueAudioFrames,
pbos@webrtc.org92135212013-05-14 08:31:39 +000060 uint32_t size);
niklase@google.com470e71d2011-07-07 08:21:25 +000061
niklase@google.com470e71d2011-07-07 08:21:25 +000062private:
pbos@webrtc.org92135212013-05-14 08:31:39 +000063 OutputMixer(uint32_t instanceId);
niklase@google.com470e71d2011-07-07 08:21:25 +000064
andrew@webrtc.org4ecea3e2012-06-27 03:25:31 +000065 // uses
niklase@google.com470e71d2011-07-07 08:21:25 +000066 Statistics* _engineStatisticsPtr;
67 AudioProcessing* _audioProcessingModulePtr;
68
niklase@google.com470e71d2011-07-07 08:21:25 +000069 AudioConferenceMixer& _mixerModule;
70 AudioFrame _audioFrame;
andrew@webrtc.orgf5a33f12014-04-19 00:32:07 +000071 // Converts mixed audio to the audio device output rate.
72 PushResampler<int16_t> resampler_;
73 // Converts mixed audio to the audio processing rate.
74 PushResampler<int16_t> audioproc_resampler_;
xians@google.com0b0665a2011-08-08 08:18:44 +000075 int _instanceId;
xians@google.com0b0665a2011-08-08 08:18:44 +000076 int _mixingFrequencyHz;
niklase@google.com470e71d2011-07-07 08:21:25 +000077};
78
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000079} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000080
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000081} // namespace werbtc
niklase@google.com470e71d2011-07-07 08:21:25 +000082
andrew@webrtc.org4ecea3e2012-06-27 03:25:31 +000083#endif // VOICE_ENGINE_OUTPUT_MIXER_H_