| 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/media/engine/webrtccommon.h" | 16 #include "webrtc/media/engine/webrtccommon.h" |
| 17 | 17 |
| 18 #include "webrtc/common_types.h" | 18 #include "webrtc/common_types.h" |
| 19 #include "webrtc/modules/audio_device/include/audio_device.h" | 19 #include "webrtc/modules/audio_device/include/audio_device.h" |
| 20 #include "webrtc/voice_engine/include/voe_audio_processing.h" | |
| 21 #include "webrtc/voice_engine/include/voe_base.h" | 20 #include "webrtc/voice_engine/include/voe_base.h" |
| 22 #include "webrtc/voice_engine/include/voe_codec.h" | 21 #include "webrtc/voice_engine/include/voe_codec.h" |
| 23 #include "webrtc/voice_engine/include/voe_errors.h" | 22 #include "webrtc/voice_engine/include/voe_errors.h" |
| 24 #include "webrtc/voice_engine/include/voe_hardware.h" | 23 #include "webrtc/voice_engine/include/voe_hardware.h" |
| 25 #include "webrtc/voice_engine/include/voe_volume_control.h" | 24 #include "webrtc/voice_engine/include/voe_volume_control.h" |
| 26 | 25 |
| 27 namespace cricket { | 26 namespace cricket { |
| 28 // automatically handles lifetime of WebRtc VoiceEngine | 27 // automatically handles lifetime of WebRtc VoiceEngine |
| 29 class scoped_voe_engine { | 28 class scoped_voe_engine { |
| 30 public: | 29 public: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 70 |
| 72 private: | 71 private: |
| 73 T* ptr; | 72 T* ptr; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 // Utility class for aggregating the various WebRTC interface. | 75 // Utility class for aggregating the various WebRTC interface. |
| 77 // Fake implementations can also be injected for testing. | 76 // Fake implementations can also be injected for testing. |
| 78 class VoEWrapper { | 77 class VoEWrapper { |
| 79 public: | 78 public: |
| 80 VoEWrapper() | 79 VoEWrapper() |
| 81 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), | 80 : engine_(webrtc::VoiceEngine::Create()), |
| 82 base_(engine_), codec_(engine_), hw_(engine_), | 81 base_(engine_), codec_(engine_), hw_(engine_), |
| 83 volume_(engine_) { | 82 volume_(engine_) { |
| 84 } | 83 } |
| 85 VoEWrapper(webrtc::VoEAudioProcessing* processing, | 84 VoEWrapper(webrtc::VoEBase* base, |
| 86 webrtc::VoEBase* base, | |
| 87 webrtc::VoECodec* codec, | 85 webrtc::VoECodec* codec, |
| 88 webrtc::VoEHardware* hw, | 86 webrtc::VoEHardware* hw, |
| 89 webrtc::VoEVolumeControl* volume) | 87 webrtc::VoEVolumeControl* volume) |
| 90 : engine_(NULL), | 88 : engine_(NULL), |
| 91 processing_(processing), | |
| 92 base_(base), | 89 base_(base), |
| 93 codec_(codec), | 90 codec_(codec), |
| 94 hw_(hw), | 91 hw_(hw), |
| 95 volume_(volume) { | 92 volume_(volume) { |
| 96 } | 93 } |
| 97 ~VoEWrapper() {} | 94 ~VoEWrapper() {} |
| 98 webrtc::VoiceEngine* engine() const { return engine_.get(); } | 95 webrtc::VoiceEngine* engine() const { return engine_.get(); } |
| 99 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } | |
| 100 webrtc::VoEBase* base() const { return base_.get(); } | 96 webrtc::VoEBase* base() const { return base_.get(); } |
| 101 webrtc::VoECodec* codec() const { return codec_.get(); } | 97 webrtc::VoECodec* codec() const { return codec_.get(); } |
| 102 webrtc::VoEHardware* hw() const { return hw_.get(); } | 98 webrtc::VoEHardware* hw() const { return hw_.get(); } |
| 103 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } | 99 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } |
| 104 int error() { return base_->LastError(); } | 100 int error() { return base_->LastError(); } |
| 105 | 101 |
| 106 private: | 102 private: |
| 107 scoped_voe_engine engine_; | 103 scoped_voe_engine engine_; |
| 108 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; | |
| 109 scoped_voe_ptr<webrtc::VoEBase> base_; | 104 scoped_voe_ptr<webrtc::VoEBase> base_; |
| 110 scoped_voe_ptr<webrtc::VoECodec> codec_; | 105 scoped_voe_ptr<webrtc::VoECodec> codec_; |
| 111 scoped_voe_ptr<webrtc::VoEHardware> hw_; | 106 scoped_voe_ptr<webrtc::VoEHardware> hw_; |
| 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 |