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 VOICE_ENGINE_SHARED_DATA_H_ | 11 #ifndef VOICE_ENGINE_SHARED_DATA_H_ |
12 #define VOICE_ENGINE_SHARED_DATA_H_ | 12 #define VOICE_ENGINE_SHARED_DATA_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "modules/audio_device/include/audio_device.h" | 16 #include "modules/audio_device/include/audio_device.h" |
17 #include "modules/audio_processing/include/audio_processing.h" | 17 #include "modules/audio_processing/include/audio_processing.h" |
18 #include "modules/utility/include/process_thread.h" | 18 #include "modules/utility/include/process_thread.h" |
19 #include "rtc_base/criticalsection.h" | 19 #include "rtc_base/criticalsection.h" |
20 #include "rtc_base/scoped_ref_ptr.h" | 20 #include "rtc_base/scoped_ref_ptr.h" |
21 #include "rtc_base/task_queue.h" | 21 #include "rtc_base/task_queue.h" |
22 #include "rtc_base/thread_annotations.h" | 22 #include "rtc_base/thread_annotations.h" |
23 #include "rtc_base/thread_checker.h" | 23 #include "rtc_base/thread_checker.h" |
24 #include "voice_engine/channel_manager.h" | 24 #include "voice_engine/channel_manager.h" |
25 #include "voice_engine/statistics.h" | |
26 #include "voice_engine/voice_engine_defines.h" | 25 #include "voice_engine/voice_engine_defines.h" |
27 | 26 |
28 class ProcessThread; | 27 class ProcessThread; |
29 | 28 |
30 namespace webrtc { | 29 namespace webrtc { |
31 namespace voe { | 30 namespace voe { |
32 | 31 |
33 class TransmitMixer; | 32 class TransmitMixer; |
34 | 33 |
35 class SharedData | 34 class SharedData |
36 { | 35 { |
37 public: | 36 public: |
38 // Public accessors. | 37 // Public accessors. |
39 uint32_t instance_id() const { return _instanceId; } | 38 uint32_t instance_id() const { return _instanceId; } |
40 Statistics& statistics() { return _engineStatistics; } | |
41 ChannelManager& channel_manager() { return _channelManager; } | 39 ChannelManager& channel_manager() { return _channelManager; } |
42 AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } | 40 AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } |
43 void set_audio_device( | 41 void set_audio_device( |
44 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); | 42 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); |
45 void set_audio_processing(AudioProcessing* audio_processing); | 43 void set_audio_processing(AudioProcessing* audio_processing); |
46 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } | 44 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } |
47 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } | 45 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } |
48 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } | 46 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } |
49 rtc::TaskQueue* encoder_queue(); | 47 rtc::TaskQueue* encoder_queue(); |
50 | 48 |
51 int NumOfSendingChannels(); | 49 int NumOfSendingChannels(); |
52 int NumOfPlayingChannels(); | 50 int NumOfPlayingChannels(); |
53 | 51 |
54 // Convenience methods for calling statistics().SetLastError(). | |
55 void SetLastError(int32_t error) const; | |
56 void SetLastError(int32_t error, TraceLevel level) const; | |
57 void SetLastError(int32_t error, TraceLevel level, | |
58 const char* msg) const; | |
59 | |
60 protected: | 52 protected: |
61 rtc::ThreadChecker construction_thread_; | 53 rtc::ThreadChecker construction_thread_; |
62 const uint32_t _instanceId; | 54 const uint32_t _instanceId; |
63 rtc::CriticalSection _apiCritPtr; | 55 rtc::CriticalSection _apiCritPtr; |
64 ChannelManager _channelManager; | 56 ChannelManager _channelManager; |
65 Statistics _engineStatistics; | |
66 rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; | 57 rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; |
67 TransmitMixer* _transmitMixerPtr; | 58 TransmitMixer* _transmitMixerPtr; |
68 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; | 59 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; |
69 // |encoder_queue| is defined last to ensure all pending tasks are cancelled | 60 // |encoder_queue| is defined last to ensure all pending tasks are cancelled |
70 // and deleted before any other members. | 61 // and deleted before any other members. |
71 rtc::TaskQueue encoder_queue_ RTC_ACCESS_ON(construction_thread_); | 62 rtc::TaskQueue encoder_queue_ RTC_ACCESS_ON(construction_thread_); |
72 | 63 |
73 SharedData(); | 64 SharedData(); |
74 virtual ~SharedData(); | 65 virtual ~SharedData(); |
75 }; | 66 }; |
76 | 67 |
77 } // namespace voe | 68 } // namespace voe |
78 } // namespace webrtc | 69 } // namespace webrtc |
79 #endif // VOICE_ENGINE_SHARED_DATA_H_ | 70 #endif // VOICE_ENGINE_SHARED_DATA_H_ |
OLD | NEW |