andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 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 | |
andrew@webrtc.org | 6316d17 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/audio_device/include/audio_device.h" |
| 15 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 16 | #include "webrtc/modules/utility/interface/process_thread.h" |
| 17 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
| 18 | #include "webrtc/voice_engine/channel_manager.h" |
| 19 | #include "webrtc/voice_engine/statistics.h" |
| 20 | #include "webrtc/voice_engine/voice_engine_defines.h" |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 21 | |
| 22 | class ProcessThread; |
| 23 | |
| 24 | namespace webrtc { |
minyue@webrtc.org | 1963a68 | 2013-09-12 17:03:00 +0000 | [diff] [blame] | 25 | class Config; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 26 | class CriticalSectionWrapper; |
| 27 | |
| 28 | namespace voe { |
| 29 | |
| 30 | class TransmitMixer; |
| 31 | class OutputMixer; |
| 32 | |
| 33 | class SharedData |
| 34 | { |
| 35 | public: |
| 36 | // Public accessors. |
pbos@webrtc.org | 1d46b92 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 37 | uint32_t instance_id() const { return _instanceId; } |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 38 | Statistics& statistics() { return _engineStatistics; } |
| 39 | ChannelManager& channel_manager() { return _channelManager; } |
| 40 | AudioDeviceModule* audio_device() { return _audioDevicePtr; } |
| 41 | void set_audio_device(AudioDeviceModule* audio_device); |
andrew@webrtc.org | 6316d17 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 42 | AudioProcessing* audio_processing() { return audioproc_.get(); } |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 43 | void set_audio_processing(AudioProcessing* audio_processing); |
| 44 | TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } |
| 45 | OutputMixer* output_mixer() { return _outputMixerPtr; } |
| 46 | CriticalSectionWrapper* crit_sec() { return _apiCritPtr; } |
| 47 | bool ext_recording() const { return _externalRecording; } |
| 48 | void set_ext_recording(bool value) { _externalRecording = value; } |
| 49 | bool ext_playout() const { return _externalPlayout; } |
| 50 | void set_ext_playout(bool value) { _externalPlayout = value; } |
| 51 | ProcessThread* process_thread() { return _moduleProcessThreadPtr; } |
| 52 | AudioDeviceModule::AudioLayer audio_device_layer() const { |
| 53 | return _audioDeviceLayer; |
| 54 | } |
| 55 | void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) { |
| 56 | _audioDeviceLayer = layer; |
| 57 | } |
| 58 | |
xians@webrtc.org | 1e6493d | 2013-10-17 16:15:34 +0000 | [diff] [blame] | 59 | int NumOfSendingChannels(); |
| 60 | int NumOfPlayingChannels(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 61 | |
| 62 | // Convenience methods for calling statistics().SetLastError(). |
pbos@webrtc.org | 07a1c11 | 2013-05-14 08:31:39 +0000 | [diff] [blame] | 63 | void SetLastError(int32_t error) const; |
| 64 | void SetLastError(int32_t error, TraceLevel level) const; |
| 65 | void SetLastError(int32_t error, TraceLevel level, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 66 | const char* msg) const; |
| 67 | |
| 68 | protected: |
pbos@webrtc.org | 1d46b92 | 2013-04-09 10:09:10 +0000 | [diff] [blame] | 69 | const uint32_t _instanceId; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 70 | CriticalSectionWrapper* _apiCritPtr; |
| 71 | ChannelManager _channelManager; |
| 72 | Statistics _engineStatistics; |
| 73 | AudioDeviceModule* _audioDevicePtr; |
| 74 | OutputMixer* _outputMixerPtr; |
| 75 | TransmitMixer* _transmitMixerPtr; |
andrew@webrtc.org | 6316d17 | 2013-03-05 01:12:49 +0000 | [diff] [blame] | 76 | scoped_ptr<AudioProcessing> audioproc_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 77 | ProcessThread* _moduleProcessThreadPtr; |
| 78 | |
| 79 | bool _externalRecording; |
| 80 | bool _externalPlayout; |
| 81 | |
| 82 | AudioDeviceModule::AudioLayer _audioDeviceLayer; |
| 83 | |
minyue@webrtc.org | 1963a68 | 2013-09-12 17:03:00 +0000 | [diff] [blame] | 84 | SharedData(const Config& config); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 85 | virtual ~SharedData(); |
| 86 | }; |
| 87 | |
pbos@webrtc.org | 5ab7b93 | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 88 | } // namespace voe |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 89 | |
pbos@webrtc.org | 5ab7b93 | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 90 | } // namespace webrtc |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 91 | #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H |