OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 highpass_filter_enabled_(false), | 288 highpass_filter_enabled_(false), |
289 stereo_swapping_enabled_(false), | 289 stereo_swapping_enabled_(false), |
290 typing_detection_enabled_(false), | 290 typing_detection_enabled_(false), |
291 ec_mode_(webrtc::kEcDefault), | 291 ec_mode_(webrtc::kEcDefault), |
292 aecm_mode_(webrtc::kAecmSpeakerphone), | 292 aecm_mode_(webrtc::kAecmSpeakerphone), |
293 ns_mode_(webrtc::kNsDefault), | 293 ns_mode_(webrtc::kNsDefault), |
294 agc_mode_(webrtc::kAgcDefault), | 294 agc_mode_(webrtc::kAgcDefault), |
295 observer_(NULL), | 295 observer_(NULL), |
296 playout_fail_channel_(-1), | 296 playout_fail_channel_(-1), |
297 send_fail_channel_(-1), | 297 send_fail_channel_(-1), |
298 fail_start_recording_microphone_(false), | |
299 recording_microphone_(false), | |
300 recording_sample_rate_(-1), | 298 recording_sample_rate_(-1), |
301 playout_sample_rate_(-1), | 299 playout_sample_rate_(-1), |
302 media_processor_(NULL) { | 300 media_processor_(NULL) { |
303 memset(&agc_config_, 0, sizeof(agc_config_)); | 301 memset(&agc_config_, 0, sizeof(agc_config_)); |
304 } | 302 } |
305 ~FakeWebRtcVoiceEngine() { | 303 ~FakeWebRtcVoiceEngine() { |
306 // Ought to have all been deleted by the WebRtcVoiceMediaChannel | 304 // Ought to have all been deleted by the WebRtcVoiceMediaChannel |
307 // destructors, but just in case ... | 305 // destructors, but just in case ... |
308 for (std::map<int, Channel*>::const_iterator i = channels_.begin(); | 306 for (std::map<int, Channel*>::const_iterator i = channels_.begin(); |
309 i != channels_.end(); ++i) { | 307 i != channels_.end(); ++i) { |
(...skipping 14 matching lines...) Expand all Loading... |
324 } | 322 } |
325 return -1; | 323 return -1; |
326 } | 324 } |
327 int GetNumChannels() const { return static_cast<int>(channels_.size()); } | 325 int GetNumChannels() const { return static_cast<int>(channels_.size()); } |
328 bool GetPlayout(int channel) { | 326 bool GetPlayout(int channel) { |
329 return channels_[channel]->playout; | 327 return channels_[channel]->playout; |
330 } | 328 } |
331 bool GetSend(int channel) { | 329 bool GetSend(int channel) { |
332 return channels_[channel]->send; | 330 return channels_[channel]->send; |
333 } | 331 } |
334 bool GetRecordingMicrophone() { | |
335 return recording_microphone_; | |
336 } | |
337 bool GetVAD(int channel) { | 332 bool GetVAD(int channel) { |
338 return channels_[channel]->vad; | 333 return channels_[channel]->vad; |
339 } | 334 } |
340 bool GetOpusDtx(int channel) { | 335 bool GetOpusDtx(int channel) { |
341 return channels_[channel]->opus_dtx; | 336 return channels_[channel]->opus_dtx; |
342 } | 337 } |
343 bool GetRED(int channel) { | 338 bool GetRED(int channel) { |
344 return channels_[channel]->red; | 339 return channels_[channel]->red; |
345 } | 340 } |
346 bool GetCodecFEC(int channel) { | 341 bool GetCodecFEC(int channel) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 void TriggerCallbackOnError(int channel_num, int err_code) { | 380 void TriggerCallbackOnError(int channel_num, int err_code) { |
386 RTC_DCHECK(observer_ != NULL); | 381 RTC_DCHECK(observer_ != NULL); |
387 observer_->CallbackOnError(channel_num, err_code); | 382 observer_->CallbackOnError(channel_num, err_code); |
388 } | 383 } |
389 void set_playout_fail_channel(int channel) { | 384 void set_playout_fail_channel(int channel) { |
390 playout_fail_channel_ = channel; | 385 playout_fail_channel_ = channel; |
391 } | 386 } |
392 void set_send_fail_channel(int channel) { | 387 void set_send_fail_channel(int channel) { |
393 send_fail_channel_ = channel; | 388 send_fail_channel_ = channel; |
394 } | 389 } |
395 void set_fail_start_recording_microphone( | |
396 bool fail_start_recording_microphone) { | |
397 fail_start_recording_microphone_ = fail_start_recording_microphone; | |
398 } | |
399 void set_fail_create_channel(bool fail_create_channel) { | 390 void set_fail_create_channel(bool fail_create_channel) { |
400 fail_create_channel_ = fail_create_channel; | 391 fail_create_channel_ = fail_create_channel; |
401 } | 392 } |
402 void TriggerProcessPacket(MediaProcessorDirection direction) { | 393 void TriggerProcessPacket(MediaProcessorDirection direction) { |
403 webrtc::ProcessingTypes pt = | 394 webrtc::ProcessingTypes pt = |
404 (direction == cricket::MPD_TX) ? | 395 (direction == cricket::MPD_TX) ? |
405 webrtc::kRecordingPerChannel : webrtc::kPlaybackAllChannelsMixed; | 396 webrtc::kRecordingPerChannel : webrtc::kPlaybackAllChannelsMixed; |
406 if (media_processor_ != NULL) { | 397 if (media_processor_ != NULL) { |
407 media_processor_->Process(0, | 398 media_processor_->Process(0, |
408 pt, | 399 pt, |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 WEBRTC_STUB(IsPlayingFileAsMicrophone, (int channel)); | 764 WEBRTC_STUB(IsPlayingFileAsMicrophone, (int channel)); |
774 WEBRTC_STUB(StartRecordingPlayout, (int channel, const char* fileNameUTF8, | 765 WEBRTC_STUB(StartRecordingPlayout, (int channel, const char* fileNameUTF8, |
775 webrtc::CodecInst* compression, | 766 webrtc::CodecInst* compression, |
776 int maxSizeBytes)); | 767 int maxSizeBytes)); |
777 WEBRTC_STUB(StartRecordingPlayout, (int channel, webrtc::OutStream* stream, | 768 WEBRTC_STUB(StartRecordingPlayout, (int channel, webrtc::OutStream* stream, |
778 webrtc::CodecInst* compression)); | 769 webrtc::CodecInst* compression)); |
779 WEBRTC_STUB(StopRecordingPlayout, (int channel)); | 770 WEBRTC_STUB(StopRecordingPlayout, (int channel)); |
780 WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8, | 771 WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8, |
781 webrtc::CodecInst* compression, | 772 webrtc::CodecInst* compression, |
782 int maxSizeBytes)) { | 773 int maxSizeBytes)) { |
783 if (fail_start_recording_microphone_) { | |
784 return -1; | |
785 } | |
786 recording_microphone_ = true; | |
787 return 0; | 774 return 0; |
788 } | 775 } |
789 WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream, | 776 WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream, |
790 webrtc::CodecInst* compression)) { | 777 webrtc::CodecInst* compression)) { |
791 if (fail_start_recording_microphone_) { | |
792 return -1; | |
793 } | |
794 recording_microphone_ = true; | |
795 return 0; | 778 return 0; |
796 } | 779 } |
797 WEBRTC_FUNC(StopRecordingMicrophone, ()) { | 780 WEBRTC_FUNC(StopRecordingMicrophone, ()) { |
798 if (!recording_microphone_) { | |
799 return -1; | |
800 } | |
801 recording_microphone_ = false; | |
802 return 0; | 781 return 0; |
803 } | 782 } |
804 | 783 |
805 // webrtc::VoEHardware | 784 // webrtc::VoEHardware |
806 WEBRTC_FUNC(GetNumOfRecordingDevices, (int& num)) { | 785 WEBRTC_FUNC(GetNumOfRecordingDevices, (int& num)) { |
807 return GetNumDevices(num); | 786 return GetNumDevices(num); |
808 } | 787 } |
809 WEBRTC_FUNC(GetNumOfPlayoutDevices, (int& num)) { | 788 WEBRTC_FUNC(GetNumOfPlayoutDevices, (int& num)) { |
810 return GetNumDevices(num); | 789 return GetNumDevices(num); |
811 } | 790 } |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 bool stereo_swapping_enabled_; | 1249 bool stereo_swapping_enabled_; |
1271 bool typing_detection_enabled_; | 1250 bool typing_detection_enabled_; |
1272 webrtc::EcModes ec_mode_; | 1251 webrtc::EcModes ec_mode_; |
1273 webrtc::AecmModes aecm_mode_; | 1252 webrtc::AecmModes aecm_mode_; |
1274 webrtc::NsModes ns_mode_; | 1253 webrtc::NsModes ns_mode_; |
1275 webrtc::AgcModes agc_mode_; | 1254 webrtc::AgcModes agc_mode_; |
1276 webrtc::AgcConfig agc_config_; | 1255 webrtc::AgcConfig agc_config_; |
1277 webrtc::VoiceEngineObserver* observer_; | 1256 webrtc::VoiceEngineObserver* observer_; |
1278 int playout_fail_channel_; | 1257 int playout_fail_channel_; |
1279 int send_fail_channel_; | 1258 int send_fail_channel_; |
1280 bool fail_start_recording_microphone_; | |
1281 bool recording_microphone_; | |
1282 int recording_sample_rate_; | 1259 int recording_sample_rate_; |
1283 int playout_sample_rate_; | 1260 int playout_sample_rate_; |
1284 DtmfInfo dtmf_info_; | 1261 DtmfInfo dtmf_info_; |
1285 webrtc::VoEMediaProcess* media_processor_; | 1262 webrtc::VoEMediaProcess* media_processor_; |
1286 FakeAudioProcessing audio_processing_; | 1263 FakeAudioProcessing audio_processing_; |
1287 }; | 1264 }; |
1288 | 1265 |
1289 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID | 1266 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID |
1290 | 1267 |
1291 } // namespace cricket | 1268 } // namespace cricket |
1292 | 1269 |
1293 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ | 1270 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |