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/base/scoped_ref_ptr.h" |
| 18 #include "webrtc/base/task_queue.h" |
| 19 #include "webrtc/base/thread_annotations.h" |
| 20 #include "webrtc/base/thread_checker.h" |
18 #include "webrtc/modules/audio_device/include/audio_device.h" | 21 #include "webrtc/modules/audio_device/include/audio_device.h" |
19 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 22 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
20 #include "webrtc/modules/utility/include/process_thread.h" | 23 #include "webrtc/modules/utility/include/process_thread.h" |
21 #include "webrtc/voice_engine/channel_manager.h" | 24 #include "webrtc/voice_engine/channel_manager.h" |
22 #include "webrtc/voice_engine/statistics.h" | 25 #include "webrtc/voice_engine/statistics.h" |
23 #include "webrtc/voice_engine/voice_engine_defines.h" | 26 #include "webrtc/voice_engine/voice_engine_defines.h" |
24 | 27 |
25 class ProcessThread; | 28 class ProcessThread; |
26 | 29 |
27 namespace webrtc { | 30 namespace webrtc { |
(...skipping 11 matching lines...) Expand all Loading... |
39 ChannelManager& channel_manager() { return _channelManager; } | 42 ChannelManager& channel_manager() { return _channelManager; } |
40 AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } | 43 AudioDeviceModule* audio_device() { return _audioDevicePtr.get(); } |
41 void set_audio_device( | 44 void set_audio_device( |
42 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); | 45 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); |
43 AudioProcessing* audio_processing() { return audioproc_.get(); } | 46 AudioProcessing* audio_processing() { return audioproc_.get(); } |
44 void set_audio_processing(AudioProcessing* audio_processing); | 47 void set_audio_processing(AudioProcessing* audio_processing); |
45 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } | 48 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } |
46 OutputMixer* output_mixer() { return _outputMixerPtr; } | 49 OutputMixer* output_mixer() { return _outputMixerPtr; } |
47 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } | 50 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } |
48 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } | 51 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } |
| 52 rtc::TaskQueue* encoder_queue(); |
49 | 53 |
50 int NumOfSendingChannels(); | 54 int NumOfSendingChannels(); |
51 int NumOfPlayingChannels(); | 55 int NumOfPlayingChannels(); |
52 | 56 |
53 // Convenience methods for calling statistics().SetLastError(). | 57 // Convenience methods for calling statistics().SetLastError(). |
54 void SetLastError(int32_t error) const; | 58 void SetLastError(int32_t error) const; |
55 void SetLastError(int32_t error, TraceLevel level) const; | 59 void SetLastError(int32_t error, TraceLevel level) const; |
56 void SetLastError(int32_t error, TraceLevel level, | 60 void SetLastError(int32_t error, TraceLevel level, |
57 const char* msg) const; | 61 const char* msg) const; |
58 | 62 |
59 protected: | 63 protected: |
60 const uint32_t _instanceId; | 64 rtc::ThreadChecker construction_thread_; |
61 rtc::CriticalSection _apiCritPtr; | 65 const uint32_t _instanceId; |
62 ChannelManager _channelManager; | 66 rtc::CriticalSection _apiCritPtr; |
63 Statistics _engineStatistics; | 67 ChannelManager _channelManager; |
64 rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; | 68 Statistics _engineStatistics; |
65 OutputMixer* _outputMixerPtr; | 69 rtc::scoped_refptr<AudioDeviceModule> _audioDevicePtr; |
66 TransmitMixer* _transmitMixerPtr; | 70 OutputMixer* _outputMixerPtr; |
67 std::unique_ptr<AudioProcessing> audioproc_; | 71 TransmitMixer* _transmitMixerPtr; |
68 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; | 72 std::unique_ptr<AudioProcessing> audioproc_; |
| 73 std::unique_ptr<ProcessThread> _moduleProcessThreadPtr; |
| 74 // |encoder_queue| is defined last to ensure all pending tasks are cancelled |
| 75 // and deleted before any other members. |
| 76 rtc::TaskQueue encoder_queue_ ACCESS_ON(construction_thread_); |
69 | 77 |
70 SharedData(); | 78 SharedData(); |
71 virtual ~SharedData(); | 79 virtual ~SharedData(); |
72 }; | 80 }; |
73 | 81 |
74 } // namespace voe | 82 } // namespace voe |
75 } // namespace webrtc | 83 } // namespace webrtc |
76 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H | 84 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H |
OLD | NEW |