| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "talk/media/webrtc/webrtccommon.h" | 31 #include "talk/media/webrtc/webrtccommon.h" |
| 32 #include "webrtc/base/common.h" | 32 #include "webrtc/base/common.h" |
| 33 | 33 |
| 34 #include "webrtc/common_types.h" | 34 #include "webrtc/common_types.h" |
| 35 #include "webrtc/modules/audio_device/include/audio_device.h" | 35 #include "webrtc/modules/audio_device/include/audio_device.h" |
| 36 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 36 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
| 37 #include "webrtc/voice_engine/include/voe_base.h" | 37 #include "webrtc/voice_engine/include/voe_base.h" |
| 38 #include "webrtc/voice_engine/include/voe_codec.h" | 38 #include "webrtc/voice_engine/include/voe_codec.h" |
| 39 #include "webrtc/voice_engine/include/voe_dtmf.h" | 39 #include "webrtc/voice_engine/include/voe_dtmf.h" |
| 40 #include "webrtc/voice_engine/include/voe_errors.h" | 40 #include "webrtc/voice_engine/include/voe_errors.h" |
| 41 #include "webrtc/voice_engine/include/voe_external_media.h" |
| 42 #include "webrtc/voice_engine/include/voe_file.h" |
| 41 #include "webrtc/voice_engine/include/voe_hardware.h" | 43 #include "webrtc/voice_engine/include/voe_hardware.h" |
| 44 #include "webrtc/voice_engine/include/voe_neteq_stats.h" |
| 42 #include "webrtc/voice_engine/include/voe_network.h" | 45 #include "webrtc/voice_engine/include/voe_network.h" |
| 43 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 46 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
| 47 #include "webrtc/voice_engine/include/voe_video_sync.h" |
| 44 #include "webrtc/voice_engine/include/voe_volume_control.h" | 48 #include "webrtc/voice_engine/include/voe_volume_control.h" |
| 45 | 49 |
| 46 namespace cricket { | 50 namespace cricket { |
| 47 // automatically handles lifetime of WebRtc VoiceEngine | 51 // automatically handles lifetime of WebRtc VoiceEngine |
| 48 class scoped_voe_engine { | 52 class scoped_voe_engine { |
| 49 public: | 53 public: |
| 50 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} | 54 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} |
| 51 // VERIFY, to ensure that there are no leaks at shutdown | 55 // VERIFY, to ensure that there are no leaks at shutdown |
| 52 ~scoped_voe_engine() { if (ptr) VERIFY(webrtc::VoiceEngine::Delete(ptr)); } | 56 ~scoped_voe_engine() { if (ptr) VERIFY(webrtc::VoiceEngine::Delete(ptr)); } |
| 53 // Releases the current pointer. | 57 // Releases the current pointer. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 T* ptr; | 89 T* ptr; |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 // Utility class for aggregating the various WebRTC interface. | 92 // Utility class for aggregating the various WebRTC interface. |
| 89 // Fake implementations can also be injected for testing. | 93 // Fake implementations can also be injected for testing. |
| 90 class VoEWrapper { | 94 class VoEWrapper { |
| 91 public: | 95 public: |
| 92 VoEWrapper() | 96 VoEWrapper() |
| 93 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), | 97 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), |
| 94 base_(engine_), codec_(engine_), dtmf_(engine_), | 98 base_(engine_), codec_(engine_), dtmf_(engine_), |
| 95 hw_(engine_), network_(engine_), | 99 hw_(engine_), neteq_(engine_), network_(engine_), |
| 96 rtp_(engine_), volume_(engine_) { | 100 rtp_(engine_), sync_(engine_), volume_(engine_) { |
| 97 } | 101 } |
| 98 VoEWrapper(webrtc::VoEAudioProcessing* processing, | 102 VoEWrapper(webrtc::VoEAudioProcessing* processing, |
| 99 webrtc::VoEBase* base, | 103 webrtc::VoEBase* base, |
| 100 webrtc::VoECodec* codec, | 104 webrtc::VoECodec* codec, |
| 101 webrtc::VoEDtmf* dtmf, | 105 webrtc::VoEDtmf* dtmf, |
| 102 webrtc::VoEHardware* hw, | 106 webrtc::VoEHardware* hw, |
| 107 webrtc::VoENetEqStats* neteq, |
| 103 webrtc::VoENetwork* network, | 108 webrtc::VoENetwork* network, |
| 104 webrtc::VoERTP_RTCP* rtp, | 109 webrtc::VoERTP_RTCP* rtp, |
| 110 webrtc::VoEVideoSync* sync, |
| 105 webrtc::VoEVolumeControl* volume) | 111 webrtc::VoEVolumeControl* volume) |
| 106 : engine_(NULL), | 112 : engine_(NULL), |
| 107 processing_(processing), | 113 processing_(processing), |
| 108 base_(base), | 114 base_(base), |
| 109 codec_(codec), | 115 codec_(codec), |
| 110 dtmf_(dtmf), | 116 dtmf_(dtmf), |
| 111 hw_(hw), | 117 hw_(hw), |
| 118 neteq_(neteq), |
| 112 network_(network), | 119 network_(network), |
| 113 rtp_(rtp), | 120 rtp_(rtp), |
| 121 sync_(sync), |
| 114 volume_(volume) { | 122 volume_(volume) { |
| 115 } | 123 } |
| 116 ~VoEWrapper() {} | 124 ~VoEWrapper() {} |
| 117 webrtc::VoiceEngine* engine() const { return engine_.get(); } | 125 webrtc::VoiceEngine* engine() const { return engine_.get(); } |
| 118 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } | 126 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } |
| 119 webrtc::VoEBase* base() const { return base_.get(); } | 127 webrtc::VoEBase* base() const { return base_.get(); } |
| 120 webrtc::VoECodec* codec() const { return codec_.get(); } | 128 webrtc::VoECodec* codec() const { return codec_.get(); } |
| 121 webrtc::VoEDtmf* dtmf() const { return dtmf_.get(); } | 129 webrtc::VoEDtmf* dtmf() const { return dtmf_.get(); } |
| 122 webrtc::VoEHardware* hw() const { return hw_.get(); } | 130 webrtc::VoEHardware* hw() const { return hw_.get(); } |
| 131 webrtc::VoENetEqStats* neteq() const { return neteq_.get(); } |
| 123 webrtc::VoENetwork* network() const { return network_.get(); } | 132 webrtc::VoENetwork* network() const { return network_.get(); } |
| 124 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } | 133 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } |
| 134 webrtc::VoEVideoSync* sync() const { return sync_.get(); } |
| 125 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } | 135 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } |
| 126 int error() { return base_->LastError(); } | 136 int error() { return base_->LastError(); } |
| 127 | 137 |
| 128 private: | 138 private: |
| 129 scoped_voe_engine engine_; | 139 scoped_voe_engine engine_; |
| 130 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; | 140 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; |
| 131 scoped_voe_ptr<webrtc::VoEBase> base_; | 141 scoped_voe_ptr<webrtc::VoEBase> base_; |
| 132 scoped_voe_ptr<webrtc::VoECodec> codec_; | 142 scoped_voe_ptr<webrtc::VoECodec> codec_; |
| 133 scoped_voe_ptr<webrtc::VoEDtmf> dtmf_; | 143 scoped_voe_ptr<webrtc::VoEDtmf> dtmf_; |
| 134 scoped_voe_ptr<webrtc::VoEHardware> hw_; | 144 scoped_voe_ptr<webrtc::VoEHardware> hw_; |
| 145 scoped_voe_ptr<webrtc::VoENetEqStats> neteq_; |
| 135 scoped_voe_ptr<webrtc::VoENetwork> network_; | 146 scoped_voe_ptr<webrtc::VoENetwork> network_; |
| 136 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; | 147 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; |
| 148 scoped_voe_ptr<webrtc::VoEVideoSync> sync_; |
| 137 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; | 149 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; |
| 138 }; | 150 }; |
| 139 | 151 |
| 140 // Adds indirection to static WebRtc functions, allowing them to be mocked. | 152 // Adds indirection to static WebRtc functions, allowing them to be mocked. |
| 141 class VoETraceWrapper { | 153 class VoETraceWrapper { |
| 142 public: | 154 public: |
| 143 virtual ~VoETraceWrapper() {} | 155 virtual ~VoETraceWrapper() {} |
| 144 | 156 |
| 145 virtual int SetTraceFilter(const unsigned int filter) { | 157 virtual int SetTraceFilter(const unsigned int filter) { |
| 146 return webrtc::VoiceEngine::SetTraceFilter(filter); | 158 return webrtc::VoiceEngine::SetTraceFilter(filter); |
| 147 } | 159 } |
| 148 virtual int SetTraceFile(const char* fileNameUTF8) { | 160 virtual int SetTraceFile(const char* fileNameUTF8) { |
| 149 return webrtc::VoiceEngine::SetTraceFile(fileNameUTF8); | 161 return webrtc::VoiceEngine::SetTraceFile(fileNameUTF8); |
| 150 } | 162 } |
| 151 virtual int SetTraceCallback(webrtc::TraceCallback* callback) { | 163 virtual int SetTraceCallback(webrtc::TraceCallback* callback) { |
| 152 return webrtc::VoiceEngine::SetTraceCallback(callback); | 164 return webrtc::VoiceEngine::SetTraceCallback(callback); |
| 153 } | 165 } |
| 154 }; | 166 }; |
| 155 | 167 |
| 156 } // namespace cricket | 168 } // namespace cricket |
| 157 | 169 |
| 158 #endif // TALK_MEDIA_WEBRTCVOE_H_ | 170 #endif // TALK_MEDIA_WEBRTCVOE_H_ |
| OLD | NEW |