blob: a22427128412f35273a19d079226a1e2a1c61e1e [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
Henrik Kjellander98f53512015-10-28 18:17:40 +010016#include "webrtc/system_wrappers/include/atomic32.h"
henrik.lundina9a6d4b2016-12-12 05:03:02 -080017#include "webrtc/typedefs.h"
henrik.lundine066b302016-12-02 02:30:15 -080018#include "webrtc/voice_engine/voe_base_impl.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000019#include "webrtc/voice_engine/voe_codec_impl.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000020#include "webrtc/voice_engine/voe_file_impl.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000021#include "webrtc/voice_engine/voe_network_impl.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000022#include "webrtc/voice_engine/voe_rtp_rtcp_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000023
Jelena Marusic0d266052015-05-04 14:15:32 +020024namespace webrtc {
solenberg13725082015-11-25 08:16:52 -080025namespace voe {
26class ChannelProxy;
27} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000028
tommi@webrtc.org851becd2012-04-04 14:57:19 +000029class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
tommi@webrtc.org0989fb72013-02-15 15:07:32 +000030 public VoiceEngine,
tommi@webrtc.org851becd2012-04-04 14:57:19 +000031 public VoECodecImpl,
tommi@webrtc.org851becd2012-04-04 14:57:19 +000032 public VoEFileImpl,
tommi@webrtc.org851becd2012-04-04 14:57:19 +000033 public VoENetworkImpl,
tommi@webrtc.org851becd2012-04-04 14:57:19 +000034 public VoERTP_RTCPImpl,
Jelena Marusic0d266052015-05-04 14:15:32 +020035 public VoEBaseImpl {
36 public:
solenberg88499ec2016-09-07 07:34:41 -070037 VoiceEngineImpl()
38 : SharedData(),
tommi@webrtc.org851becd2012-04-04 14:57:19 +000039 VoECodecImpl(this),
tommi@webrtc.org851becd2012-04-04 14:57:19 +000040 VoEFileImpl(this),
tommi@webrtc.org851becd2012-04-04 14:57:19 +000041 VoENetworkImpl(this),
tommi@webrtc.org851becd2012-04-04 14:57:19 +000042 VoERTP_RTCPImpl(this),
tommi@webrtc.orga990e122012-04-26 15:28:22 +000043 VoEBaseImpl(this),
solenberg88499ec2016-09-07 07:34:41 -070044 _ref_count(0) {}
Jelena Marusic0d266052015-05-04 14:15:32 +020045 ~VoiceEngineImpl() override { assert(_ref_count.Value() == 0); }
tommi@webrtc.orga990e122012-04-26 15:28:22 +000046
Jelena Marusic0d266052015-05-04 14:15:32 +020047 int AddRef();
tommi@webrtc.orga990e122012-04-26 15:28:22 +000048
Jelena Marusic0d266052015-05-04 14:15:32 +020049 // This implements the Release() method for all the inherited interfaces.
50 int Release() override;
tommi@webrtc.orga990e122012-04-26 15:28:22 +000051
solenberg13725082015-11-25 08:16:52 -080052 // Backdoor to access a voe::Channel object without a channel ID. This is only
53 // to be used while refactoring the VoE API!
kwibergb7f89d62016-02-17 10:04:18 -080054 virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
solenberg13725082015-11-25 08:16:52 -080055
Fredrik Solenberg4f4ec0a2015-10-22 10:49:27 +020056 // This is *protected* so that FakeVoiceEngine can inherit from the class and
57 // manipulate the reference count. See: fake_voice_engine.h.
58 protected:
Jelena Marusic0d266052015-05-04 14:15:32 +020059 Atomic32 _ref_count;
niklase@google.com470e71d2011-07-07 08:21:25 +000060};
61
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000062} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000063
Jelena Marusic0d266052015-05-04 14:15:32 +020064#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H