summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/webrtc/voice_engine/voice_engine_impl.h
blob: 917cc1aa68c640c97e31fb85b9903b97fe75055f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef VOICE_ENGINE_VOICE_ENGINE_IMPL_H_
#define VOICE_ENGINE_VOICE_ENGINE_IMPL_H_

#include <memory>

#include "system_wrappers/include/atomic32.h"
#include "typedefs.h"  // NOLINT(build/include)
#include "voice_engine/voe_base_impl.h"

namespace webrtc {
namespace voe {
class ChannelProxy;
}  // namespace voe

class VoiceEngineImpl : public voe::SharedData,  // Must be the first base class
                        public VoiceEngine,
                        public VoEBaseImpl {
 public:
  VoiceEngineImpl()
      : SharedData(),
        VoEBaseImpl(this),
        _ref_count(0) {}
  ~VoiceEngineImpl() override { assert(_ref_count.Value() == 0); }

  int AddRef();

  // This implements the Release() method for all the inherited interfaces.
  int Release() override;

  // Backdoor to access a voe::Channel object without a channel ID. This is only
  // to be used while refactoring the VoE API!
  virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);

 // This is *protected* so that FakeVoiceEngine can inherit from the class and
 // manipulate the reference count. See: fake_voice_engine.h.
 protected:
  Atomic32 _ref_count;
};

}  // namespace webrtc

#endif  // VOICE_ENGINE_VOICE_ENGINE_IMPL_H_