blob: ed6efe3d9e7df2c91bc7bd22a221d5686d6c845d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tommi@webrtc.org851becd2012-04-04 14:57:19 +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
11#ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
12#define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
13
kwibergb7f89d62016-02-17 10:04:18 -080014#include <memory>
15
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000016#include "webrtc/engine_configurations.h"
Henrik Kjellander98f53512015-10-28 18:17:40 +010017#include "webrtc/system_wrappers/include/atomic32.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000018#include "webrtc/voice_engine/voe_base_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000021#include "webrtc/voice_engine/voe_audio_processing_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000022#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000023#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000024#include "webrtc/voice_engine/voe_codec_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000025#endif
26#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000027#include "webrtc/voice_engine/voe_dtmf_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000028#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000029#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000030#include "webrtc/voice_engine/voe_external_media_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000031#endif
32#ifdef WEBRTC_VOICE_ENGINE_FILE_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000033#include "webrtc/voice_engine/voe_file_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000034#endif
35#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000036#include "webrtc/voice_engine/voe_hardware_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000037#endif
38#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000039#include "webrtc/voice_engine/voe_neteq_stats_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000040#endif
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000041#include "webrtc/voice_engine/voe_network_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000042#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000043#include "webrtc/voice_engine/voe_rtp_rtcp_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000044#endif
45#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000046#include "webrtc/voice_engine/voe_video_sync_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000047#endif
48#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000049#include "webrtc/voice_engine/voe_volume_control_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000050#endif
51
Jelena Marusic0d266052015-05-04 14:15:32 +020052namespace webrtc {
solenberg13725082015-11-25 08:16:52 -080053namespace voe {
54class ChannelProxy;
55} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000056
tommi@webrtc.org851becd2012-04-04 14:57:19 +000057class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
tommi@webrtc.org0989fb72013-02-15 15:07:32 +000058 public VoiceEngine,
niklase@google.com470e71d2011-07-07 08:21:25 +000059#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000060 public VoEAudioProcessingImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000061#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000062#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000063 public VoECodecImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000064#endif
65#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000066 public VoEDtmfImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000067#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000068#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000069 public VoEExternalMediaImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000070#endif
71#ifdef WEBRTC_VOICE_ENGINE_FILE_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000072 public VoEFileImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000073#endif
74#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000075 public VoEHardwareImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000076#endif
77#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000078 public VoENetEqStatsImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000079#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +000080 public VoENetworkImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000081#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000082 public VoERTP_RTCPImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000083#endif
84#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000085 public VoEVideoSyncImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000086#endif
87#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000088 public VoEVolumeControlImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000089#endif
Jelena Marusic0d266052015-05-04 14:15:32 +020090 public VoEBaseImpl {
91 public:
92 VoiceEngineImpl(const Config* config, bool owns_config)
93 : SharedData(*config),
tommi@webrtc.org851becd2012-04-04 14:57:19 +000094#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
95 VoEAudioProcessingImpl(this),
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000096#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +000097#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
98 VoECodecImpl(this),
99#endif
100#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
101 VoEDtmfImpl(this),
102#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000103#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
104 VoEExternalMediaImpl(this),
105#endif
106#ifdef WEBRTC_VOICE_ENGINE_FILE_API
107 VoEFileImpl(this),
108#endif
109#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
110 VoEHardwareImpl(this),
111#endif
112#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
113 VoENetEqStatsImpl(this),
114#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000115 VoENetworkImpl(this),
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000116#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
117 VoERTP_RTCPImpl(this),
118#endif
119#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
120 VoEVideoSyncImpl(this),
121#endif
122#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
123 VoEVolumeControlImpl(this),
124#endif
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000125 VoEBaseImpl(this),
minyue@webrtc.orge509f942013-09-12 17:03:00 +0000126 _ref_count(0),
Jelena Marusic0d266052015-05-04 14:15:32 +0200127 own_config_(owns_config ? config : NULL) {
128 }
129 ~VoiceEngineImpl() override { assert(_ref_count.Value() == 0); }
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000130
Jelena Marusic0d266052015-05-04 14:15:32 +0200131 int AddRef();
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000132
Jelena Marusic0d266052015-05-04 14:15:32 +0200133 // This implements the Release() method for all the inherited interfaces.
134 int Release() override;
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000135
solenberg13725082015-11-25 08:16:52 -0800136 // Backdoor to access a voe::Channel object without a channel ID. This is only
137 // to be used while refactoring the VoE API!
kwibergb7f89d62016-02-17 10:04:18 -0800138 virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
solenberg13725082015-11-25 08:16:52 -0800139
Fredrik Solenberg4f4ec0a2015-10-22 10:49:27 +0200140 // This is *protected* so that FakeVoiceEngine can inherit from the class and
141 // manipulate the reference count. See: fake_voice_engine.h.
142 protected:
Jelena Marusic0d266052015-05-04 14:15:32 +0200143 Atomic32 _ref_count;
Fredrik Solenberg4f4ec0a2015-10-22 10:49:27 +0200144 private:
kwibergb7f89d62016-02-17 10:04:18 -0800145 std::unique_ptr<const Config> own_config_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000146};
147
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000148} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +0000149
Jelena Marusic0d266052015-05-04 14:15:32 +0200150#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H