| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (!_shared->statistics().Initialized()) { | 389 if (!_shared->statistics().Initialized()) { |
| 390 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 390 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 391 return -1; | 391 return -1; |
| 392 } | 392 } |
| 393 if (_shared->transmit_mixer()->StartRecordingMicrophone(fileNameUTF8, | 393 if (_shared->transmit_mixer()->StartRecordingMicrophone(fileNameUTF8, |
| 394 compression)) { | 394 compression)) { |
| 395 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 395 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 396 "StartRecordingMicrophone() failed to start recording"); | 396 "StartRecordingMicrophone() failed to start recording"); |
| 397 return -1; | 397 return -1; |
| 398 } | 398 } |
| 399 if (_shared->audio_device()->Recording()) { | 399 if (!_shared->audio_device()->Recording()) { |
| 400 return 0; | |
| 401 } | |
| 402 if (!_shared->ext_recording()) { | |
| 403 if (_shared->audio_device()->InitRecording() != 0) { | 400 if (_shared->audio_device()->InitRecording() != 0) { |
| 404 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 401 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 405 "StartRecordingMicrophone() failed to initialize recording"); | 402 "StartRecordingMicrophone() failed to initialize recording"); |
| 406 return -1; | 403 return -1; |
| 407 } | 404 } |
| 408 if (_shared->audio_device()->StartRecording() != 0) { | 405 if (_shared->audio_device()->StartRecording() != 0) { |
| 409 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 406 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 410 "StartRecordingMicrophone() failed to start recording"); | 407 "StartRecordingMicrophone() failed to start recording"); |
| 411 return -1; | 408 return -1; |
| 412 } | 409 } |
| 413 } | 410 } |
| 414 return 0; | 411 return 0; |
| 415 } | 412 } |
| 416 | 413 |
| 417 int VoEFileImpl::StartRecordingMicrophone(OutStream* stream, | 414 int VoEFileImpl::StartRecordingMicrophone(OutStream* stream, |
| 418 CodecInst* compression) { | 415 CodecInst* compression) { |
| 419 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 416 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 420 "StartRecordingMicrophone(stream, compression)"); | 417 "StartRecordingMicrophone(stream, compression)"); |
| 421 | 418 |
| 422 if (!_shared->statistics().Initialized()) { | 419 if (!_shared->statistics().Initialized()) { |
| 423 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 420 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 424 return -1; | 421 return -1; |
| 425 } | 422 } |
| 426 if (_shared->transmit_mixer()->StartRecordingMicrophone(stream, | 423 if (_shared->transmit_mixer()->StartRecordingMicrophone(stream, |
| 427 compression) == -1) { | 424 compression) == -1) { |
| 428 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 425 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 429 "StartRecordingMicrophone() failed to start recording"); | 426 "StartRecordingMicrophone() failed to start recording"); |
| 430 return -1; | 427 return -1; |
| 431 } | 428 } |
| 432 if (_shared->audio_device()->Recording()) { | 429 if (!_shared->audio_device()->Recording()) { |
| 433 return 0; | |
| 434 } | |
| 435 if (!_shared->ext_recording()) { | |
| 436 if (_shared->audio_device()->InitRecording() != 0) { | 430 if (_shared->audio_device()->InitRecording() != 0) { |
| 437 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 431 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 438 "StartRecordingMicrophone() failed to initialize recording"); | 432 "StartRecordingMicrophone() failed to initialize recording"); |
| 439 return -1; | 433 return -1; |
| 440 } | 434 } |
| 441 if (_shared->audio_device()->StartRecording() != 0) { | 435 if (_shared->audio_device()->StartRecording() != 0) { |
| 442 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 436 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 443 "StartRecordingMicrophone() failed to start recording"); | 437 "StartRecordingMicrophone() failed to start recording"); |
| 444 return -1; | 438 return -1; |
| 445 } | 439 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 475 "StopRecordingMicrophone() failed to stop recording to mixer"); | 469 "StopRecordingMicrophone() failed to stop recording to mixer"); |
| 476 err = -1; | 470 err = -1; |
| 477 } | 471 } |
| 478 | 472 |
| 479 return err; | 473 return err; |
| 480 } | 474 } |
| 481 | 475 |
| 482 #endif // #ifdef WEBRTC_VOICE_ENGINE_FILE_API | 476 #endif // #ifdef WEBRTC_VOICE_ENGINE_FILE_API |
| 483 | 477 |
| 484 } // namespace webrtc | 478 } // namespace webrtc |
| OLD | NEW |