OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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_MEDIA_ENGINE_WEBRTCVOE_H_ | 11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ |
12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ | 12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/base/common.h" | |
17 #include "webrtc/media/engine/webrtccommon.h" | 16 #include "webrtc/media/engine/webrtccommon.h" |
18 | 17 |
19 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
20 #include "webrtc/modules/audio_device/include/audio_device.h" | 19 #include "webrtc/modules/audio_device/include/audio_device.h" |
21 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 20 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
22 #include "webrtc/voice_engine/include/voe_base.h" | 21 #include "webrtc/voice_engine/include/voe_base.h" |
23 #include "webrtc/voice_engine/include/voe_codec.h" | 22 #include "webrtc/voice_engine/include/voe_codec.h" |
24 #include "webrtc/voice_engine/include/voe_errors.h" | 23 #include "webrtc/voice_engine/include/voe_errors.h" |
25 #include "webrtc/voice_engine/include/voe_hardware.h" | 24 #include "webrtc/voice_engine/include/voe_hardware.h" |
26 #include "webrtc/voice_engine/include/voe_volume_control.h" | 25 #include "webrtc/voice_engine/include/voe_volume_control.h" |
27 | 26 |
28 namespace cricket { | 27 namespace cricket { |
29 // automatically handles lifetime of WebRtc VoiceEngine | 28 // automatically handles lifetime of WebRtc VoiceEngine |
30 class scoped_voe_engine { | 29 class scoped_voe_engine { |
31 public: | 30 public: |
32 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} | 31 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} |
33 // VERIFY, to ensure that there are no leaks at shutdown | 32 // VERIFY, to ensure that there are no leaks at shutdown |
kwiberg-webrtc
2017/02/07 09:39:49
Stale comment.
nisse-webrtc
2017/02/07 10:48:15
Updated.
| |
34 ~scoped_voe_engine() { if (ptr) VERIFY(webrtc::VoiceEngine::Delete(ptr)); } | 33 ~scoped_voe_engine() { |
34 if (ptr) { | |
35 bool res = webrtc::VoiceEngine::Delete(ptr); | |
36 RTC_DCHECK(res); | |
37 } | |
38 } | |
35 // Releases the current pointer. | 39 // Releases the current pointer. |
36 void reset() { | 40 void reset() { |
37 if (ptr) { | 41 if (ptr) { |
38 VERIFY(webrtc::VoiceEngine::Delete(ptr)); | 42 bool res = webrtc::VoiceEngine::Delete(ptr); |
43 RTC_DCHECK(res); | |
39 ptr = NULL; | 44 ptr = NULL; |
40 } | 45 } |
41 } | 46 } |
42 webrtc::VoiceEngine* get() const { return ptr; } | 47 webrtc::VoiceEngine* get() const { return ptr; } |
43 private: | 48 private: |
44 webrtc::VoiceEngine* ptr; | 49 webrtc::VoiceEngine* ptr; |
45 }; | 50 }; |
46 | 51 |
47 // unique_ptr-like class to handle obtaining and releasing WebRTC interface | 52 // unique_ptr-like class to handle obtaining and releasing WebRTC interface |
48 // pointers. | 53 // pointers. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 scoped_voe_engine engine_; | 107 scoped_voe_engine engine_; |
103 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; | 108 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; |
104 scoped_voe_ptr<webrtc::VoEBase> base_; | 109 scoped_voe_ptr<webrtc::VoEBase> base_; |
105 scoped_voe_ptr<webrtc::VoECodec> codec_; | 110 scoped_voe_ptr<webrtc::VoECodec> codec_; |
106 scoped_voe_ptr<webrtc::VoEHardware> hw_; | 111 scoped_voe_ptr<webrtc::VoEHardware> hw_; |
107 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; | 112 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; |
108 }; | 113 }; |
109 } // namespace cricket | 114 } // namespace cricket |
110 | 115 |
111 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ | 116 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ |
OLD | NEW |