Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: webrtc/media/engine/fakewebrtcvoiceengine.h

Issue 1741933002: Prevent a voice channel from sending data before a renderer is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Modifying copyright header to satisfy presubmit bot. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvoiceengine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 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
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 class FakeWebRtcVoiceEngine 123 class FakeWebRtcVoiceEngine
124 : public webrtc::VoEAudioProcessing, 124 : public webrtc::VoEAudioProcessing,
125 public webrtc::VoEBase, public webrtc::VoECodec, 125 public webrtc::VoEBase, public webrtc::VoECodec,
126 public webrtc::VoEHardware, 126 public webrtc::VoEHardware,
127 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP, 127 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
128 public webrtc::VoEVolumeControl { 128 public webrtc::VoEVolumeControl {
129 public: 129 public:
130 struct Channel { 130 struct Channel {
131 explicit Channel() 131 explicit Channel()
132 : external_transport(false), 132 : external_transport(false),
133 send(false),
134 playout(false), 133 playout(false),
135 volume_scale(1.0), 134 volume_scale(1.0),
136 vad(false), 135 vad(false),
137 codec_fec(false), 136 codec_fec(false),
138 max_encoding_bandwidth(0), 137 max_encoding_bandwidth(0),
139 opus_dtx(false), 138 opus_dtx(false),
140 red(false), 139 red(false),
141 nack(false), 140 nack(false),
142 cn8_type(13), 141 cn8_type(13),
143 cn16_type(105), 142 cn16_type(105),
144 red_type(117), 143 red_type(117),
145 nack_max_packets(0), 144 nack_max_packets(0),
146 send_ssrc(0), 145 send_ssrc(0),
147 associate_send_channel(-1), 146 associate_send_channel(-1),
148 recv_codecs(), 147 recv_codecs(),
149 neteq_capacity(-1), 148 neteq_capacity(-1),
150 neteq_fast_accelerate(false) { 149 neteq_fast_accelerate(false) {
151 memset(&send_codec, 0, sizeof(send_codec)); 150 memset(&send_codec, 0, sizeof(send_codec));
152 } 151 }
153 bool external_transport; 152 bool external_transport;
154 bool send;
155 bool playout; 153 bool playout;
156 float volume_scale; 154 float volume_scale;
157 bool vad; 155 bool vad;
158 bool codec_fec; 156 bool codec_fec;
159 int max_encoding_bandwidth; 157 int max_encoding_bandwidth;
160 bool opus_dtx; 158 bool opus_dtx;
161 bool red; 159 bool red;
162 bool nack; 160 bool nack;
163 int cn8_type; 161 int cn8_type;
164 int cn16_type; 162 int cn16_type;
(...skipping 21 matching lines...) Expand all
186 agc_enabled_(false), 184 agc_enabled_(false),
187 highpass_filter_enabled_(false), 185 highpass_filter_enabled_(false),
188 stereo_swapping_enabled_(false), 186 stereo_swapping_enabled_(false),
189 typing_detection_enabled_(false), 187 typing_detection_enabled_(false),
190 ec_mode_(webrtc::kEcDefault), 188 ec_mode_(webrtc::kEcDefault),
191 aecm_mode_(webrtc::kAecmSpeakerphone), 189 aecm_mode_(webrtc::kAecmSpeakerphone),
192 ns_mode_(webrtc::kNsDefault), 190 ns_mode_(webrtc::kNsDefault),
193 agc_mode_(webrtc::kAgcDefault), 191 agc_mode_(webrtc::kAgcDefault),
194 observer_(NULL), 192 observer_(NULL),
195 playout_fail_channel_(-1), 193 playout_fail_channel_(-1),
196 send_fail_channel_(-1),
197 recording_sample_rate_(-1), 194 recording_sample_rate_(-1),
198 playout_sample_rate_(-1) { 195 playout_sample_rate_(-1) {
199 memset(&agc_config_, 0, sizeof(agc_config_)); 196 memset(&agc_config_, 0, sizeof(agc_config_));
200 } 197 }
201 ~FakeWebRtcVoiceEngine() { 198 ~FakeWebRtcVoiceEngine() {
202 RTC_CHECK(channels_.empty()); 199 RTC_CHECK(channels_.empty());
203 } 200 }
204 201
205 bool ec_metrics_enabled() const { return ec_metrics_enabled_; } 202 bool ec_metrics_enabled() const { return ec_metrics_enabled_; }
206 203
207 bool IsInited() const { return inited_; } 204 bool IsInited() const { return inited_; }
208 int GetLastChannel() const { return last_channel_; } 205 int GetLastChannel() const { return last_channel_; }
209 int GetNumChannels() const { return static_cast<int>(channels_.size()); } 206 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
210 uint32_t GetLocalSSRC(int channel) { 207 uint32_t GetLocalSSRC(int channel) {
211 return channels_[channel]->send_ssrc; 208 return channels_[channel]->send_ssrc;
212 } 209 }
213 bool GetPlayout(int channel) { 210 bool GetPlayout(int channel) {
214 return channels_[channel]->playout; 211 return channels_[channel]->playout;
215 } 212 }
216 bool GetSend(int channel) {
217 return channels_[channel]->send;
218 }
219 bool GetVAD(int channel) { 213 bool GetVAD(int channel) {
220 return channels_[channel]->vad; 214 return channels_[channel]->vad;
221 } 215 }
222 bool GetOpusDtx(int channel) { 216 bool GetOpusDtx(int channel) {
223 return channels_[channel]->opus_dtx; 217 return channels_[channel]->opus_dtx;
224 } 218 }
225 bool GetRED(int channel) { 219 bool GetRED(int channel) {
226 return channels_[channel]->red; 220 return channels_[channel]->red;
227 } 221 }
228 bool GetCodecFEC(int channel) { 222 bool GetCodecFEC(int channel) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bool CheckNoPacket(int channel) { 255 bool CheckNoPacket(int channel) {
262 return channels_[channel]->packets.empty(); 256 return channels_[channel]->packets.empty();
263 } 257 }
264 void TriggerCallbackOnError(int channel_num, int err_code) { 258 void TriggerCallbackOnError(int channel_num, int err_code) {
265 RTC_DCHECK(observer_ != NULL); 259 RTC_DCHECK(observer_ != NULL);
266 observer_->CallbackOnError(channel_num, err_code); 260 observer_->CallbackOnError(channel_num, err_code);
267 } 261 }
268 void set_playout_fail_channel(int channel) { 262 void set_playout_fail_channel(int channel) {
269 playout_fail_channel_ = channel; 263 playout_fail_channel_ = channel;
270 } 264 }
271 void set_send_fail_channel(int channel) {
272 send_fail_channel_ = channel;
273 }
274 void set_fail_create_channel(bool fail_create_channel) { 265 void set_fail_create_channel(bool fail_create_channel) {
275 fail_create_channel_ = fail_create_channel; 266 fail_create_channel_ = fail_create_channel;
276 } 267 }
277 int AddChannel(const webrtc::Config& config) { 268 int AddChannel(const webrtc::Config& config) {
278 if (fail_create_channel_) { 269 if (fail_create_channel_) {
279 return -1; 270 return -1;
280 } 271 }
281 Channel* ch = new Channel(); 272 Channel* ch = new Channel();
282 auto db = webrtc::acm2::RentACodec::Database(); 273 auto db = webrtc::acm2::RentACodec::Database();
283 ch->recv_codecs.assign(db.begin(), db.end()); 274 ch->recv_codecs.assign(db.begin(), db.end());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (playout_fail_channel_ != channel) { 331 if (playout_fail_channel_ != channel) {
341 WEBRTC_CHECK_CHANNEL(channel); 332 WEBRTC_CHECK_CHANNEL(channel);
342 channels_[channel]->playout = true; 333 channels_[channel]->playout = true;
343 return 0; 334 return 0;
344 } else { 335 } else {
345 // When playout_fail_channel_ == channel, fail the StartPlayout on this 336 // When playout_fail_channel_ == channel, fail the StartPlayout on this
346 // channel. 337 // channel.
347 return -1; 338 return -1;
348 } 339 }
349 } 340 }
350 WEBRTC_FUNC(StartSend, (int channel)) { 341 WEBRTC_STUB(StartSend, (int channel));
351 if (send_fail_channel_ != channel) {
352 WEBRTC_CHECK_CHANNEL(channel);
353 channels_[channel]->send = true;
354 return 0;
355 } else {
356 // When send_fail_channel_ == channel, fail the StartSend on this
357 // channel.
358 return -1;
359 }
360 }
361 WEBRTC_STUB(StopReceive, (int channel)); 342 WEBRTC_STUB(StopReceive, (int channel));
362 WEBRTC_FUNC(StopPlayout, (int channel)) { 343 WEBRTC_FUNC(StopPlayout, (int channel)) {
363 WEBRTC_CHECK_CHANNEL(channel); 344 WEBRTC_CHECK_CHANNEL(channel);
364 channels_[channel]->playout = false; 345 channels_[channel]->playout = false;
365 return 0; 346 return 0;
366 } 347 }
367 WEBRTC_FUNC(StopSend, (int channel)) { 348 WEBRTC_STUB(StopSend, (int channel));
368 WEBRTC_CHECK_CHANNEL(channel);
369 channels_[channel]->send = false;
370 return 0;
371 }
372 WEBRTC_STUB(GetVersion, (char version[1024])); 349 WEBRTC_STUB(GetVersion, (char version[1024]));
373 WEBRTC_STUB(LastError, ()); 350 WEBRTC_STUB(LastError, ());
374 WEBRTC_FUNC(AssociateSendChannel, (int channel, 351 WEBRTC_FUNC(AssociateSendChannel, (int channel,
375 int accociate_send_channel)) { 352 int accociate_send_channel)) {
376 WEBRTC_CHECK_CHANNEL(channel); 353 WEBRTC_CHECK_CHANNEL(channel);
377 channels_[channel]->associate_send_channel = accociate_send_channel; 354 channels_[channel]->associate_send_channel = accociate_send_channel;
378 return 0; 355 return 0;
379 } 356 }
380 webrtc::RtcEventLog* GetEventLog() { return nullptr; } 357 webrtc::RtcEventLog* GetEventLog() { return nullptr; }
381 358
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 bool highpass_filter_enabled_; 767 bool highpass_filter_enabled_;
791 bool stereo_swapping_enabled_; 768 bool stereo_swapping_enabled_;
792 bool typing_detection_enabled_; 769 bool typing_detection_enabled_;
793 webrtc::EcModes ec_mode_; 770 webrtc::EcModes ec_mode_;
794 webrtc::AecmModes aecm_mode_; 771 webrtc::AecmModes aecm_mode_;
795 webrtc::NsModes ns_mode_; 772 webrtc::NsModes ns_mode_;
796 webrtc::AgcModes agc_mode_; 773 webrtc::AgcModes agc_mode_;
797 webrtc::AgcConfig agc_config_; 774 webrtc::AgcConfig agc_config_;
798 webrtc::VoiceEngineObserver* observer_; 775 webrtc::VoiceEngineObserver* observer_;
799 int playout_fail_channel_; 776 int playout_fail_channel_;
800 int send_fail_channel_;
801 int recording_sample_rate_; 777 int recording_sample_rate_;
802 int playout_sample_rate_; 778 int playout_sample_rate_;
803 FakeAudioProcessing audio_processing_; 779 FakeAudioProcessing audio_processing_;
804 }; 780 };
805 781
806 } // namespace cricket 782 } // namespace cricket
807 783
808 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ 784 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvoiceengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698