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 | |
tommi | 31fc21f | 2016-01-21 10:37:37 -0800 | [diff] [blame] | 16 | #include "webrtc/base/criticalsection.h" |
Peter Boström | 1d19441 | 2016-03-21 16:44:31 +0100 | [diff] [blame^] | 17 | #include "webrtc/base/scoped_ref_ptr.h" |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 18 | #include "webrtc/modules/audio_device/include/audio_device.h" |
| 19 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
Henrik Kjellander | ff761fb | 2015-11-04 08:31:52 +0100 | [diff] [blame] | 20 | #include "webrtc/modules/utility/include/process_thread.h" |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 21 | #include "webrtc/voice_engine/channel_manager.h" |
| 22 | #include "webrtc/voice_engine/statistics.h" |
| 23 | #include "webrtc/voice_engine/voice_engine_defines.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | |
| 25 | class ProcessThread; |
| 26 | |
| 27 | namespace webrtc { |
minyue@webrtc.org | e509f94 | 2013-09-12 17:03:00 +0000 | [diff] [blame] | 28 | class Config; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 29 | |
| 30 | namespace voe { |
| 31 | |
| 32 | class TransmitMixer; |
| 33 | class OutputMixer; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 35 | class SharedData |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | { |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 37 | public: |
| 38 | // Public accessors. |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 39 | uint32_t instance_id() const { return _instanceId; } |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 40 | Statistics& statistics() { return _engineStatistics; } |
| 41 | ChannelManager& channel_manager() { return _channelManager; } |
Peter Boström | 1d19441 | 2016-03-21 16:44:31 +0100 | [diff] [blame^] | 42 | AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } |
| 43 | void set_audio_device( |
| 44 | const rtc::scoped_refptr<AudioDeviceModule>& audio_device); |
andrew@webrtc.org | f0a90c3 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 45 | AudioProcessing* audio_processing() { return audioproc_.get(); } |
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(); } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 51 | AudioDeviceModule::AudioLayer audio_device_layer() const { |
| 52 | return _audioDeviceLayer; |
| 53 | } |
| 54 | void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) { |
| 55 | _audioDeviceLayer = layer; |
| 56 | } |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 57 | |
xians@webrtc.org | 675e260 | 2013-10-17 16:15:34 +0000 | [diff] [blame] | 58 | int NumOfSendingChannels(); |
| 59 | int NumOfPlayingChannels(); |
tommi@webrtc.org | 9ff87db | 2012-01-19 15:05:36 +0000 | [diff] [blame] | 60 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 61 | // Convenience methods for calling statistics().SetLastError(). |
pbos@webrtc.org | 9213521 | 2013-05-14 08:31:39 +0000 | [diff] [blame] | 62 | void SetLastError(int32_t error) const; |
| 63 | void SetLastError(int32_t error, TraceLevel level) const; |
| 64 | void SetLastError(int32_t error, TraceLevel level, |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 65 | const char* msg) const; |
| 66 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | protected: |
pbos@webrtc.org | 6141e13 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 68 | const uint32_t _instanceId; |
pbos | d8de115 | 2016-02-01 09:00:51 -0800 | [diff] [blame] | 69 | rtc::CriticalSection _apiCritPtr; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 70 | ChannelManager _channelManager; |
| 71 | Statistics _engineStatistics; |
Peter Boström | 1d19441 | 2016-03-21 16:44:31 +0100 | [diff] [blame^] | 72 | rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 73 | OutputMixer* _outputMixerPtr; |
| 74 | TransmitMixer* _transmitMixerPtr; |
kwiberg | b7f89d6 | 2016-02-17 10:04:18 -0800 | [diff] [blame] | 75 | std::unique_ptr<AudioProcessing> audioproc_; |
| 76 | std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | AudioDeviceModule::AudioLayer _audioDeviceLayer; |
| 79 | |
minyue@webrtc.org | e509f94 | 2013-09-12 17:03:00 +0000 | [diff] [blame] | 80 | SharedData(const Config& config); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 81 | virtual ~SharedData(); |
| 82 | }; |
| 83 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 84 | } // namespace voe |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 85 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 86 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 87 | #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H |