blob: f98f88121468d15ab24d3aee12609eb084f72f56 [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
solenberg13725082015-11-25 08:16:52 -080014#include "webrtc/base/scoped_ptr.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000015#include "webrtc/engine_configurations.h"
Henrik Kjellander98f53512015-10-28 18:17:40 +010016#include "webrtc/system_wrappers/include/atomic32.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000017#include "webrtc/voice_engine/voe_base_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
19#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000020#include "webrtc/voice_engine/voe_audio_processing_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000021#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000022#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000023#include "webrtc/voice_engine/voe_codec_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000024#endif
25#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000026#include "webrtc/voice_engine/voe_dtmf_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000027#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000028#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000029#include "webrtc/voice_engine/voe_external_media_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000030#endif
31#ifdef WEBRTC_VOICE_ENGINE_FILE_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000032#include "webrtc/voice_engine/voe_file_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000033#endif
34#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000035#include "webrtc/voice_engine/voe_hardware_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000036#endif
37#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000038#include "webrtc/voice_engine/voe_neteq_stats_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000039#endif
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000040#include "webrtc/voice_engine/voe_network_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000041#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000042#include "webrtc/voice_engine/voe_rtp_rtcp_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000043#endif
44#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000045#include "webrtc/voice_engine/voe_video_sync_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000046#endif
47#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000048#include "webrtc/voice_engine/voe_volume_control_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000049#endif
50
Jelena Marusic0d266052015-05-04 14:15:32 +020051namespace webrtc {
solenberg13725082015-11-25 08:16:52 -080052namespace voe {
53class ChannelProxy;
54} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000055
tommi@webrtc.org851becd2012-04-04 14:57:19 +000056class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
tommi@webrtc.org0989fb72013-02-15 15:07:32 +000057 public VoiceEngine,
niklase@google.com470e71d2011-07-07 08:21:25 +000058#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000059 public VoEAudioProcessingImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000060#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000061#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000062 public VoECodecImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000063#endif
64#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000065 public VoEDtmfImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000066#endif
niklase@google.com470e71d2011-07-07 08:21:25 +000067#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000068 public VoEExternalMediaImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000069#endif
70#ifdef WEBRTC_VOICE_ENGINE_FILE_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000071 public VoEFileImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000072#endif
73#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000074 public VoEHardwareImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000075#endif
76#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000077 public VoENetEqStatsImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000078#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +000079 public VoENetworkImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000080#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000081 public VoERTP_RTCPImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000082#endif
83#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000084 public VoEVideoSyncImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000085#endif
86#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
tommi@webrtc.org851becd2012-04-04 14:57:19 +000087 public VoEVolumeControlImpl,
niklase@google.com470e71d2011-07-07 08:21:25 +000088#endif
Jelena Marusic0d266052015-05-04 14:15:32 +020089 public VoEBaseImpl {
90 public:
91 VoiceEngineImpl(const Config* config, bool owns_config)
92 : SharedData(*config),
tommi@webrtc.org851becd2012-04-04 14:57:19 +000093#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
94 VoEAudioProcessingImpl(this),
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000095#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +000096#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
97 VoECodecImpl(this),
98#endif
99#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
100 VoEDtmfImpl(this),
101#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000102#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
103 VoEExternalMediaImpl(this),
104#endif
105#ifdef WEBRTC_VOICE_ENGINE_FILE_API
106 VoEFileImpl(this),
107#endif
108#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
109 VoEHardwareImpl(this),
110#endif
111#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
112 VoENetEqStatsImpl(this),
113#endif
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000114 VoENetworkImpl(this),
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000115#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
116 VoERTP_RTCPImpl(this),
117#endif
118#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
119 VoEVideoSyncImpl(this),
120#endif
121#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
122 VoEVolumeControlImpl(this),
123#endif
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000124 VoEBaseImpl(this),
minyue@webrtc.orge509f942013-09-12 17:03:00 +0000125 _ref_count(0),
Jelena Marusic0d266052015-05-04 14:15:32 +0200126 own_config_(owns_config ? config : NULL) {
127 }
128 ~VoiceEngineImpl() override { assert(_ref_count.Value() == 0); }
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000129
Jelena Marusic0d266052015-05-04 14:15:32 +0200130 int AddRef();
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000131
Jelena Marusic0d266052015-05-04 14:15:32 +0200132 // This implements the Release() method for all the inherited interfaces.
133 int Release() override;
tommi@webrtc.orga990e122012-04-26 15:28:22 +0000134
solenberg13725082015-11-25 08:16:52 -0800135 // Backdoor to access a voe::Channel object without a channel ID. This is only
136 // to be used while refactoring the VoE API!
137 virtual rtc::scoped_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
138
Fredrik Solenberg4f4ec0a2015-10-22 10:49:27 +0200139 // This is *protected* so that FakeVoiceEngine can inherit from the class and
140 // manipulate the reference count. See: fake_voice_engine.h.
141 protected:
Jelena Marusic0d266052015-05-04 14:15:32 +0200142 Atomic32 _ref_count;
Fredrik Solenberg4f4ec0a2015-10-22 10:49:27 +0200143 private:
Jelena Marusic0d266052015-05-04 14:15:32 +0200144 rtc::scoped_ptr<const Config> own_config_;
niklase@google.com470e71d2011-07-07 08:21:25 +0000145};
146
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +0000147} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +0000148
Jelena Marusic0d266052015-05-04 14:15:32 +0200149#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H