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" |
18 #include "webrtc/modules/audio_device/include/audio_device.h" | 19 #include "webrtc/modules/audio_device/include/audio_device.h" |
19 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 20 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
20 #include "webrtc/modules/utility/include/process_thread.h" | 21 #include "webrtc/modules/utility/include/process_thread.h" |
21 #include "webrtc/voice_engine/channel_manager.h" | 22 #include "webrtc/voice_engine/channel_manager.h" |
22 #include "webrtc/voice_engine/statistics.h" | 23 #include "webrtc/voice_engine/statistics.h" |
23 #include "webrtc/voice_engine/voice_engine_defines.h" | 24 #include "webrtc/voice_engine/voice_engine_defines.h" |
24 | 25 |
25 class ProcessThread; | 26 class ProcessThread; |
26 | 27 |
27 namespace webrtc { | 28 namespace webrtc { |
(...skipping 14 matching lines...) Expand all Loading... |
42 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); | 43 const rtc::scoped_refptr<AudioDeviceModule>& audio_device); |
43 AudioProcessing* audio_processing() { return audioproc_.get(); } | 44 AudioProcessing* audio_processing() { return audioproc_.get(); } |
44 void set_audio_processing(AudioProcessing* audio_processing); | 45 void set_audio_processing(AudioProcessing* audio_processing); |
45 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } | 46 TransmitMixer* transmit_mixer() { return _transmitMixerPtr; } |
46 OutputMixer* output_mixer() { return _outputMixerPtr; } | 47 OutputMixer* output_mixer() { return _outputMixerPtr; } |
47 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } | 48 rtc::CriticalSection* crit_sec() { return &_apiCritPtr; } |
48 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } | 49 ProcessThread* process_thread() { return _moduleProcessThreadPtr.get(); } |
49 AudioDeviceModule::AudioLayer audio_device_layer() const { | 50 AudioDeviceModule::AudioLayer audio_device_layer() const { |
50 return _audioDeviceLayer; | 51 return _audioDeviceLayer; |
51 } | 52 } |
| 53 rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } |
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 rtc::scoped_refptr<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 | |
76 AudioDeviceModule::AudioLayer _audioDeviceLayer; | 77 AudioDeviceModule::AudioLayer _audioDeviceLayer; |
| 78 // |encoder_queue| is defined last to ensure all pending tasks are cancelled |
| 79 // and deleted before any other members. |
| 80 rtc::TaskQueue encoder_queue_; |
77 | 81 |
78 SharedData(); | 82 SharedData(); |
79 virtual ~SharedData(); | 83 virtual ~SharedData(); |
80 }; | 84 }; |
81 | 85 |
82 } // namespace voe | 86 } // namespace voe |
83 } // namespace webrtc | 87 } // namespace webrtc |
84 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H | 88 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H |
OLD | NEW |