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