blob: d313c24c64af881c58bba100d23f7b3f11fd6041 [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_SHARED_DATA_H_
12#define VOICE_ENGINE_SHARED_DATA_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 "modules/audio_device/include/audio_device.h"
17#include "modules/audio_processing/include/audio_processing.h"
18#include "modules/utility/include/process_thread.h"
19#include "rtc_base/criticalsection.h"
20#include "rtc_base/scoped_ref_ptr.h"
21#include "rtc_base/task_queue.h"
22#include "rtc_base/thread_annotations.h"
23#include "rtc_base/thread_checker.h"
24#include "voice_engine/channel_manager.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020025#include "voice_engine/voice_engine_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000026
27class ProcessThread;
28
29namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000030namespace voe {
31
32class TransmitMixer;
niklase@google.com470e71d2011-07-07 08:21:25 +000033
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000034class SharedData
niklase@google.com470e71d2011-07-07 08:21:25 +000035{
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000036public:
37 // Public accessors.
pbos@webrtc.org6141e132013-04-09 10:09:10 +000038 uint32_t instance_id() const { return _instanceId; }
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000039 ChannelManager& channel_manager() { return _channelManager; }
Peter Boström1d194412016-03-21 16:44:31 +010040 AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); }
41 void set_audio_device(
42 const rtc::scoped_refptr<AudioDeviceModule>& audio_device);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000043 void set_audio_processing(AudioProcessing* audio_processing);
44 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; }
tommi31fc21f2016-01-21 10:37:37 -080045 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; }
tommi@webrtc.org0c3e12b2015-02-06 09:44:12 +000046 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); }
henrikaec6fbd22017-03-31 05:43:36 -070047 rtc::TaskQueue* encoder_queue();
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000048
xians@webrtc.org675e2602013-10-17 16:15:34 +000049 int NumOfSendingChannels();
50 int NumOfPlayingChannels();
tommi@webrtc.org9ff87db2012-01-19 15:05:36 +000051
niklase@google.com470e71d2011-07-07 08:21:25 +000052protected:
henrikaec6fbd22017-03-31 05:43:36 -070053 rtc::ThreadChecker construction_thread_;
54 const uint32_t _instanceId;
55 rtc::CriticalSection _apiCritPtr;
56 ChannelManager _channelManager;
henrikaec6fbd22017-03-31 05:43:36 -070057 rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr;
henrikaec6fbd22017-03-31 05:43:36 -070058 TransmitMixer* _transmitMixerPtr;
henrikaec6fbd22017-03-31 05:43:36 -070059 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr;
60 // |encoder_queue| is defined last to ensure all pending tasks are cancelled
61 // and deleted before any other members.
danilchapa37de392017-09-09 04:17:22 -070062 rtc::TaskQueue encoder_queue_ RTC_ACCESS_ON(construction_thread_);
niklase@google.com470e71d2011-07-07 08:21:25 +000063
henrikaec6fbd22017-03-31 05:43:36 -070064 SharedData();
65 virtual ~SharedData();
niklase@google.com470e71d2011-07-07 08:21:25 +000066};
67
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000068} // namespace voe
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000069} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020070#endif // VOICE_ENGINE_SHARED_DATA_H_