blob: 917cc1aa68c640c97e31fb85b9903b97fe75055f [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef VOICE_ENGINE_VOICE_ENGINE_IMPL_H_
12#define VOICE_ENGINE_VOICE_ENGINE_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
kwibergb7f89d62016-02-17 10:04:18 -080014#include <memory>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "system_wrappers/include/atomic32.h"
Mirko Bonadei71207422017-09-15 13:58:09 +020017#include "typedefs.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "voice_engine/voe_base_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
Jelena Marusic0d266052015-05-04 14:15:32 +020020namespace webrtc {
solenberg13725082015-11-25 08:16:52 -080021namespace voe {
22class ChannelProxy;
23} // namespace voe
niklase@google.com470e71d2011-07-07 08:21:25 +000024
tommi@webrtc.org851becd2012-04-04 14:57:19 +000025class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
tommi@webrtc.org0989fb72013-02-15 15:07:32 +000026 public VoiceEngine,
Jelena Marusic0d266052015-05-04 14:15:32 +020027 public VoEBaseImpl {
28 public:
solenberg88499ec2016-09-07 07:34:41 -070029 VoiceEngineImpl()
30 : SharedData(),
tommi@webrtc.orga990e122012-04-26 15:28:22 +000031 VoEBaseImpl(this),
solenberg88499ec2016-09-07 07:34:41 -070032 _ref_count(0) {}
Jelena Marusic0d266052015-05-04 14:15:32 +020033 ~VoiceEngineImpl() override { assert(_ref_count.Value() == 0); }
tommi@webrtc.orga990e122012-04-26 15:28:22 +000034
Jelena Marusic0d266052015-05-04 14:15:32 +020035 int AddRef();
tommi@webrtc.orga990e122012-04-26 15:28:22 +000036
Jelena Marusic0d266052015-05-04 14:15:32 +020037 // This implements the Release() method for all the inherited interfaces.
38 int Release() override;
tommi@webrtc.orga990e122012-04-26 15:28:22 +000039
solenberg13725082015-11-25 08:16:52 -080040 // Backdoor to access a voe::Channel object without a channel ID. This is only
41 // to be used while refactoring the VoE API!
kwibergb7f89d62016-02-17 10:04:18 -080042 virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
solenberg13725082015-11-25 08:16:52 -080043
Fredrik Solenberg4f4ec0a2015-10-22 10:49:27 +020044 // This is *protected* so that FakeVoiceEngine can inherit from the class and
45 // manipulate the reference count. See: fake_voice_engine.h.
46 protected:
Jelena Marusic0d266052015-05-04 14:15:32 +020047 Atomic32 _ref_count;
niklase@google.com470e71d2011-07-07 08:21:25 +000048};
49
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000050} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000051
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020052#endif // VOICE_ENGINE_VOICE_ENGINE_IMPL_H_