niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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_SHARED_DATA_H |
| 12 | #define WEBRTC_VOICE_ENGINE_SHARED_DATA_H |
| 13 | |
kwiberg | b7f89d6 | 2016-02-17 10:04:18 -0800 | [diff] [blame] | 14 | #include <memory> |
| 15 | |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 16 | #include "webrtc/modules/audio_device/include/audio_device.h" |
| 17 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 18 | #include "webrtc/modules/utility/include/process_thread.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 19 | #include "webrtc/rtc_base/criticalsection.h" |
| 20 | #include "webrtc/rtc_base/scoped_ref_ptr.h" |
| 21 | #include "webrtc/rtc_base/task_queue.h" |
| 22 | #include "webrtc/rtc_base/thread_annotations.h" |
| 23 | #include "webrtc/rtc_base/thread_checker.h" |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 24 | #include "webrtc/voice_engine/channel_manager.h" |
| 25 | #include "webrtc/voice_engine/statistics.h" |
| 26 | #include "webrtc/voice_engine/voice_engine_defines.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 27 | |
| 28 | class ProcessThread; |
| 29 | |
| 30 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | namespace voe { |
| 32 | |
| 33 | class TransmitMixer; |
| 34 | class OutputMixer; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 36 | class SharedData |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | { |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 38 | public: |
| 39 | // Public accessors. |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 40 | uint32_t instance_id() const { return _instanceId; } |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 41 | Statistics& statistics() { return _engineStatistics; } |
| 42 | ChannelManager& channel_manager() { return _channelManager; } |
Peter Boström | 1d19441 | 2016-03-21 16:44:31 +0100 | [diff] [blame] | 43 | AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } |
| 44 | void set_audio_device( |
| 45 | const rtc::scoped_refptr<AudioDeviceModule>& audio_device); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 46 | void set_audio_processing(AudioProcessing* audio_processing); |
| 47 | TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } |
| 48 | OutputMixer* output_mixer() { return _outputMixerPtr; } |
tommi | 31fc21f | 2016-01-21 10:37:37 -0800 | [diff] [blame] | 49 | rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } |
tommi@webrtc.org | 0c3e12b | 2015-02-06 09:44:12 +0000 | [diff] [blame] | 50 | ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } |
henrika | ec6fbd2 | 2017-03-31 05:43:36 -0700 | [diff] [blame] | 51 | rtc::TaskQueue* encoder_queue(); |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 52 | |
xians@webrtc.org | 675e260 | 2013-10-17 16:15:34 +0000 | [diff] [blame] | 53 | int NumOfSendingChannels(); |
| 54 | int NumOfPlayingChannels(); |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 55 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 56 | // Convenience methods for calling statistics().SetLastError(). |
pbos@webrtc.org | 9213521 | 2013-05-14 08:31:39 +0000 | [diff] [blame] | 57 | void SetLastError(int32_t error) const; |
| 58 | void SetLastError(int32_t error, TraceLevel level) const; |
| 59 | void SetLastError(int32_t error, TraceLevel level, |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 60 | const char* msg) const; |
| 61 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 62 | protected: |
henrika | ec6fbd2 | 2017-03-31 05:43:36 -0700 | [diff] [blame] | 63 | rtc::ThreadChecker construction_thread_; |
| 64 | const uint32_t _instanceId; |
| 65 | rtc::CriticalSection _apiCritPtr; |
| 66 | ChannelManager _channelManager; |
| 67 | Statistics _engineStatistics; |
| 68 | rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; |
| 69 | OutputMixer* _outputMixerPtr; |
| 70 | TransmitMixer* _transmitMixerPtr; |
henrika | ec6fbd2 | 2017-03-31 05:43:36 -0700 | [diff] [blame] | 71 | std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; |
| 72 | // |encoder_queue| is defined last to ensure all pending tasks are cancelled |
| 73 | // and deleted before any other members. |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 74 | rtc::TaskQueue encoder_queue_ RTC_ACCESS_ON(construction_thread_); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 75 | |
henrika | ec6fbd2 | 2017-03-31 05:43:36 -0700 | [diff] [blame] | 76 | SharedData(); |
| 77 | virtual ~SharedData(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 80 | } // namespace voe |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 81 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 82 | #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H |