OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_VOICE_ENGINE_SHARED_DATA_H | 11 #ifndef WEBRTC_VOICE_ENGINE_SHARED_DATA_H |
12 #define WEBRTC_VOICE_ENGINE_SHARED_DATA_H | 12 #define WEBRTC_VOICE_ENGINE_SHARED_DATA_H |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
| 17 #include "webrtc/base/scoped_ref_ptr.h" |
17 #include "webrtc/modules/audio_device/include/audio_device.h" | 18 #include "webrtc/modules/audio_device/include/audio_device.h" |
18 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 19 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
19 #include "webrtc/modules/utility/include/process_thread.h" | 20 #include "webrtc/modules/utility/include/process_thread.h" |
20 #include "webrtc/voice_engine/channel_manager.h" | 21 #include "webrtc/voice_engine/channel_manager.h" |
21 #include "webrtc/voice_engine/statistics.h" | 22 #include "webrtc/voice_engine/statistics.h" |
22 #include "webrtc/voice_engine/voice_engine_defines.h" | 23 #include "webrtc/voice_engine/voice_engine_defines.h" |
23 | 24 |
24 class ProcessThread; | 25 class ProcessThread; |
25 | 26 |
26 namespace webrtc { | 27 namespace webrtc { |
27 class Config; | 28 class Config; |
28 | 29 |
29 namespace voe { | 30 namespace voe { |
30 | 31 |
31 class TransmitMixer; | 32 class TransmitMixer; |
32 class OutputMixer; | 33 class OutputMixer; |
33 | 34 |
34 class SharedData | 35 class SharedData |
35 { | 36 { |
36 public: | 37 public: |
37 // Public accessors. | 38 // Public accessors. |
38 uint32_t instance_id() const { return _instanceId; } | 39 uint32_t instance_id() const { return _instanceId; } |
39 Statistics& statistics() { return _engineStatistics; } | 40 Statistics& statistics() { return _engineStatistics; } |
40 ChannelManager& channel_manager() { return _channelManager; } | 41 ChannelManager& channel_manager() { return _channelManager; } |
41 AudioDeviceModule* audio_device() { return _audioDevicePtr; } | 42 AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } |
42 void set_audio_device(AudioDeviceModule* audio_device); | 43 void set_audio_device( |
| 44 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); |
43 AudioProcessing* audio_processing() { return audioproc_.get(); } | 45 AudioProcessing* audio_processing() { return audioproc_.get(); } |
44 void set_audio_processing(AudioProcessing* audio_processing); | 46 void set_audio_processing(AudioProcessing* audio_processing); |
45 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } | 47 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } |
46 OutputMixer* output_mixer() { return _outputMixerPtr; } | 48 OutputMixer* output_mixer() { return _outputMixerPtr; } |
47 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } | 49 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } |
48 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } | 50 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } |
49 AudioDeviceModule::AudioLayer audio_device_layer() const { | 51 AudioDeviceModule::AudioLayer audio_device_layer() const { |
50 return _audioDeviceLayer; | 52 return _audioDeviceLayer; |
51 } | 53 } |
52 void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) { | 54 void set_audio_device_layer(AudioDeviceModule::AudioLayer layer) { |
53 _audioDeviceLayer = layer; | 55 _audioDeviceLayer = layer; |
54 } | 56 } |
55 | 57 |
56 int NumOfSendingChannels(); | 58 int NumOfSendingChannels(); |
57 int NumOfPlayingChannels(); | 59 int NumOfPlayingChannels(); |
58 | 60 |
59 // Convenience methods for calling statistics().SetLastError(). | 61 // Convenience methods for calling statistics().SetLastError(). |
60 void SetLastError(int32_t error) const; | 62 void SetLastError(int32_t error) const; |
61 void SetLastError(int32_t error, TraceLevel level) const; | 63 void SetLastError(int32_t error, TraceLevel level) const; |
62 void SetLastError(int32_t error, TraceLevel level, | 64 void SetLastError(int32_t error, TraceLevel level, |
63 const char* msg) const; | 65 const char* msg) const; |
64 | 66 |
65 protected: | 67 protected: |
66 const uint32_t _instanceId; | 68 const uint32_t _instanceId; |
67 rtc::CriticalSection _apiCritPtr; | 69 rtc::CriticalSection _apiCritPtr; |
68 ChannelManager _channelManager; | 70 ChannelManager _channelManager; |
69 Statistics _engineStatistics; | 71 Statistics _engineStatistics; |
70 AudioDeviceModule* _audioDevicePtr; | 72 rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; |
71 OutputMixer* _outputMixerPtr; | 73 OutputMixer* _outputMixerPtr; |
72 TransmitMixer* _transmitMixerPtr; | 74 TransmitMixer* _transmitMixerPtr; |
73 std::unique_ptr<AudioProcessing> audioproc_; | 75 std::unique_ptr<AudioProcessing> audioproc_; |
74 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; | 76 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; |
75 | 77 |
76 AudioDeviceModule::AudioLayer _audioDeviceLayer; | 78 AudioDeviceModule::AudioLayer _audioDeviceLayer; |
77 | 79 |
78 SharedData(const Config& config); | 80 SharedData(const Config& config); |
79 virtual ~SharedData(); | 81 virtual ~SharedData(); |
80 }; | 82 }; |
81 | 83 |
82 } // namespace voe | 84 } // namespace voe |
83 | 85 |
84 } // namespace webrtc | 86 } // namespace webrtc |
85 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H | 87 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H |
OLD | NEW |