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" | 16 #include "webrtc/base/common.h" |
17 #include "webrtc/media/engine/webrtccommon.h" | 17 #include "webrtc/media/engine/webrtccommon.h" |
18 | 18 |
19 #include "webrtc/common_types.h" | 19 #include "webrtc/common_types.h" |
20 #include "webrtc/modules/audio_device/include/audio_device.h" | 20 #include "webrtc/modules/audio_device/include/audio_device.h" |
21 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 21 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
22 #include "webrtc/voice_engine/include/voe_base.h" | 22 #include "webrtc/voice_engine/include/voe_base.h" |
23 #include "webrtc/voice_engine/include/voe_codec.h" | 23 #include "webrtc/voice_engine/include/voe_codec.h" |
24 #include "webrtc/voice_engine/include/voe_errors.h" | 24 #include "webrtc/voice_engine/include/voe_errors.h" |
25 #include "webrtc/voice_engine/include/voe_hardware.h" | 25 #include "webrtc/voice_engine/include/voe_hardware.h" |
26 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | |
27 #include "webrtc/voice_engine/include/voe_volume_control.h" | 26 #include "webrtc/voice_engine/include/voe_volume_control.h" |
28 | 27 |
29 namespace cricket { | 28 namespace cricket { |
30 // automatically handles lifetime of WebRtc VoiceEngine | 29 // automatically handles lifetime of WebRtc VoiceEngine |
31 class scoped_voe_engine { | 30 class scoped_voe_engine { |
32 public: | 31 public: |
33 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} | 32 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} |
34 // VERIFY, to ensure that there are no leaks at shutdown | 33 // VERIFY, to ensure that there are no leaks at shutdown |
35 ~scoped_voe_engine() { if (ptr) VERIFY(webrtc::VoiceEngine::Delete(ptr)); } | 34 ~scoped_voe_engine() { if (ptr) VERIFY(webrtc::VoiceEngine::Delete(ptr)); } |
36 // Releases the current pointer. | 35 // Releases the current pointer. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 private: | 67 private: |
69 T* ptr; | 68 T* ptr; |
70 }; | 69 }; |
71 | 70 |
72 // Utility class for aggregating the various WebRTC interface. | 71 // Utility class for aggregating the various WebRTC interface. |
73 // Fake implementations can also be injected for testing. | 72 // Fake implementations can also be injected for testing. |
74 class VoEWrapper { | 73 class VoEWrapper { |
75 public: | 74 public: |
76 VoEWrapper() | 75 VoEWrapper() |
77 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), | 76 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), |
78 base_(engine_), codec_(engine_), hw_(engine_), rtp_(engine_), | 77 base_(engine_), codec_(engine_), hw_(engine_), |
79 volume_(engine_) { | 78 volume_(engine_) { |
80 } | 79 } |
81 VoEWrapper(webrtc::VoEAudioProcessing* processing, | 80 VoEWrapper(webrtc::VoEAudioProcessing* processing, |
82 webrtc::VoEBase* base, | 81 webrtc::VoEBase* base, |
83 webrtc::VoECodec* codec, | 82 webrtc::VoECodec* codec, |
84 webrtc::VoEHardware* hw, | 83 webrtc::VoEHardware* hw, |
85 webrtc::VoERTP_RTCP* rtp, | |
86 webrtc::VoEVolumeControl* volume) | 84 webrtc::VoEVolumeControl* volume) |
87 : engine_(NULL), | 85 : engine_(NULL), |
88 processing_(processing), | 86 processing_(processing), |
89 base_(base), | 87 base_(base), |
90 codec_(codec), | 88 codec_(codec), |
91 hw_(hw), | 89 hw_(hw), |
92 rtp_(rtp), | |
93 volume_(volume) { | 90 volume_(volume) { |
94 } | 91 } |
95 ~VoEWrapper() {} | 92 ~VoEWrapper() {} |
96 webrtc::VoiceEngine* engine() const { return engine_.get(); } | 93 webrtc::VoiceEngine* engine() const { return engine_.get(); } |
97 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } | 94 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } |
98 webrtc::VoEBase* base() const { return base_.get(); } | 95 webrtc::VoEBase* base() const { return base_.get(); } |
99 webrtc::VoECodec* codec() const { return codec_.get(); } | 96 webrtc::VoECodec* codec() const { return codec_.get(); } |
100 webrtc::VoEHardware* hw() const { return hw_.get(); } | 97 webrtc::VoEHardware* hw() const { return hw_.get(); } |
101 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } | |
102 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } | 98 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } |
103 int error() { return base_->LastError(); } | 99 int error() { return base_->LastError(); } |
104 | 100 |
105 private: | 101 private: |
106 scoped_voe_engine engine_; | 102 scoped_voe_engine engine_; |
107 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; | 103 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; |
108 scoped_voe_ptr<webrtc::VoEBase> base_; | 104 scoped_voe_ptr<webrtc::VoEBase> base_; |
109 scoped_voe_ptr<webrtc::VoECodec> codec_; | 105 scoped_voe_ptr<webrtc::VoECodec> codec_; |
110 scoped_voe_ptr<webrtc::VoEHardware> hw_; | 106 scoped_voe_ptr<webrtc::VoEHardware> hw_; |
111 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; | |
112 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; | 107 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; |
113 }; | 108 }; |
114 } // namespace cricket | 109 } // namespace cricket |
115 | 110 |
116 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ | 111 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ |
OLD | NEW |