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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 T* ptr; | 89 T* ptr; |
90 }; | 90 }; |
91 | 91 |
92 // Utility class for aggregating the various WebRTC interface. | 92 // Utility class for aggregating the various WebRTC interface. |
93 // Fake implementations can also be injected for testing. | 93 // Fake implementations can also be injected for testing. |
94 class VoEWrapper { | 94 class VoEWrapper { |
95 public: | 95 public: |
96 VoEWrapper() | 96 VoEWrapper() |
97 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), | 97 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), |
98 base_(engine_), codec_(engine_), dtmf_(engine_), | 98 base_(engine_), codec_(engine_), dtmf_(engine_), |
99 hw_(engine_), media_(engine_), neteq_(engine_), network_(engine_), | 99 hw_(engine_), neteq_(engine_), network_(engine_), |
100 rtp_(engine_), sync_(engine_), volume_(engine_) { | 100 rtp_(engine_), sync_(engine_), volume_(engine_) { |
101 } | 101 } |
102 VoEWrapper(webrtc::VoEAudioProcessing* processing, | 102 VoEWrapper(webrtc::VoEAudioProcessing* processing, |
103 webrtc::VoEBase* base, | 103 webrtc::VoEBase* base, |
104 webrtc::VoECodec* codec, | 104 webrtc::VoECodec* codec, |
105 webrtc::VoEDtmf* dtmf, | 105 webrtc::VoEDtmf* dtmf, |
106 webrtc::VoEHardware* hw, | 106 webrtc::VoEHardware* hw, |
107 webrtc::VoEExternalMedia* media, | |
108 webrtc::VoENetEqStats* neteq, | 107 webrtc::VoENetEqStats* neteq, |
109 webrtc::VoENetwork* network, | 108 webrtc::VoENetwork* network, |
110 webrtc::VoERTP_RTCP* rtp, | 109 webrtc::VoERTP_RTCP* rtp, |
111 webrtc::VoEVideoSync* sync, | 110 webrtc::VoEVideoSync* sync, |
112 webrtc::VoEVolumeControl* volume) | 111 webrtc::VoEVolumeControl* volume) |
113 : engine_(NULL), | 112 : engine_(NULL), |
114 processing_(processing), | 113 processing_(processing), |
115 base_(base), | 114 base_(base), |
116 codec_(codec), | 115 codec_(codec), |
117 dtmf_(dtmf), | 116 dtmf_(dtmf), |
118 hw_(hw), | 117 hw_(hw), |
119 media_(media), | |
120 neteq_(neteq), | 118 neteq_(neteq), |
121 network_(network), | 119 network_(network), |
122 rtp_(rtp), | 120 rtp_(rtp), |
123 sync_(sync), | 121 sync_(sync), |
124 volume_(volume) { | 122 volume_(volume) { |
125 } | 123 } |
126 ~VoEWrapper() {} | 124 ~VoEWrapper() {} |
127 webrtc::VoiceEngine* engine() const { return engine_.get(); } | 125 webrtc::VoiceEngine* engine() const { return engine_.get(); } |
128 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } | 126 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } |
129 webrtc::VoEBase* base() const { return base_.get(); } | 127 webrtc::VoEBase* base() const { return base_.get(); } |
130 webrtc::VoECodec* codec() const { return codec_.get(); } | 128 webrtc::VoECodec* codec() const { return codec_.get(); } |
131 webrtc::VoEDtmf* dtmf() const { return dtmf_.get(); } | 129 webrtc::VoEDtmf* dtmf() const { return dtmf_.get(); } |
132 webrtc::VoEHardware* hw() const { return hw_.get(); } | 130 webrtc::VoEHardware* hw() const { return hw_.get(); } |
133 webrtc::VoEExternalMedia* media() const { return media_.get(); } | |
134 webrtc::VoENetEqStats* neteq() const { return neteq_.get(); } | 131 webrtc::VoENetEqStats* neteq() const { return neteq_.get(); } |
135 webrtc::VoENetwork* network() const { return network_.get(); } | 132 webrtc::VoENetwork* network() const { return network_.get(); } |
136 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } | 133 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } |
137 webrtc::VoEVideoSync* sync() const { return sync_.get(); } | 134 webrtc::VoEVideoSync* sync() const { return sync_.get(); } |
138 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } | 135 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } |
139 int error() { return base_->LastError(); } | 136 int error() { return base_->LastError(); } |
140 | 137 |
141 private: | 138 private: |
142 scoped_voe_engine engine_; | 139 scoped_voe_engine engine_; |
143 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; | 140 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; |
144 scoped_voe_ptr<webrtc::VoEBase> base_; | 141 scoped_voe_ptr<webrtc::VoEBase> base_; |
145 scoped_voe_ptr<webrtc::VoECodec> codec_; | 142 scoped_voe_ptr<webrtc::VoECodec> codec_; |
146 scoped_voe_ptr<webrtc::VoEDtmf> dtmf_; | 143 scoped_voe_ptr<webrtc::VoEDtmf> dtmf_; |
147 scoped_voe_ptr<webrtc::VoEHardware> hw_; | 144 scoped_voe_ptr<webrtc::VoEHardware> hw_; |
148 scoped_voe_ptr<webrtc::VoEExternalMedia> media_; | |
149 scoped_voe_ptr<webrtc::VoENetEqStats> neteq_; | 145 scoped_voe_ptr<webrtc::VoENetEqStats> neteq_; |
150 scoped_voe_ptr<webrtc::VoENetwork> network_; | 146 scoped_voe_ptr<webrtc::VoENetwork> network_; |
151 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; | 147 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; |
152 scoped_voe_ptr<webrtc::VoEVideoSync> sync_; | 148 scoped_voe_ptr<webrtc::VoEVideoSync> sync_; |
153 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; | 149 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; |
154 }; | 150 }; |
155 | 151 |
156 // Adds indirection to static WebRtc functions, allowing them to be mocked. | 152 // Adds indirection to static WebRtc functions, allowing them to be mocked. |
157 class VoETraceWrapper { | 153 class VoETraceWrapper { |
158 public: | 154 public: |
159 virtual ~VoETraceWrapper() {} | 155 virtual ~VoETraceWrapper() {} |
160 | 156 |
161 virtual int SetTraceFilter(const unsigned int filter) { | 157 virtual int SetTraceFilter(const unsigned int filter) { |
162 return webrtc::VoiceEngine::SetTraceFilter(filter); | 158 return webrtc::VoiceEngine::SetTraceFilter(filter); |
163 } | 159 } |
164 virtual int SetTraceFile(const char* fileNameUTF8) { | 160 virtual int SetTraceFile(const char* fileNameUTF8) { |
165 return webrtc::VoiceEngine::SetTraceFile(fileNameUTF8); | 161 return webrtc::VoiceEngine::SetTraceFile(fileNameUTF8); |
166 } | 162 } |
167 virtual int SetTraceCallback(webrtc::TraceCallback* callback) { | 163 virtual int SetTraceCallback(webrtc::TraceCallback* callback) { |
168 return webrtc::VoiceEngine::SetTraceCallback(callback); | 164 return webrtc::VoiceEngine::SetTraceCallback(callback); |
169 } | 165 } |
170 }; | 166 }; |
171 | 167 |
172 } // namespace cricket | 168 } // namespace cricket |
173 | 169 |
174 #endif // TALK_MEDIA_WEBRTCVOE_H_ | 170 #endif // TALK_MEDIA_WEBRTCVOE_H_ |
OLD | NEW |