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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 | 351 |
352 if (_shared->audio_device()->SetStereoRecording(available) != 0) { | 352 if (_shared->audio_device()->SetStereoRecording(available) != 0) { |
353 _shared->SetLastError( | 353 _shared->SetLastError( |
354 VE_SOUNDCARD_ERROR, kTraceWarning, | 354 VE_SOUNDCARD_ERROR, kTraceWarning, |
355 "SetRecordingDevice() failed to set mono recording mode"); | 355 "SetRecordingDevice() failed to set mono recording mode"); |
356 } | 356 } |
357 | 357 |
358 // Restore recording if it was enabled already when calling this function. | 358 // Restore recording if it was enabled already when calling this function. |
359 if (isRecording) { | 359 if (isRecording) { |
360 if (!_shared->ext_recording()) { | 360 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), |
361 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), | 361 "SetRecordingDevice() recording is now being restored..."); |
362 "SetRecordingDevice() recording is now being restored..."); | 362 if (_shared->audio_device()->InitRecording() != 0) { |
363 if (_shared->audio_device()->InitRecording() != 0) { | 363 WEBRTC_TRACE(kTraceError, kTraceVoice, |
364 WEBRTC_TRACE(kTraceError, kTraceVoice, | 364 VoEId(_shared->instance_id(), -1), |
365 VoEId(_shared->instance_id(), -1), | 365 "SetRecordingDevice() failed to initialize recording"); |
366 "SetRecordingDevice() failed to initialize recording"); | 366 return -1; |
367 return -1; | 367 } |
368 } | 368 if (_shared->audio_device()->StartRecording() != 0) { |
369 if (_shared->audio_device()->StartRecording() != 0) { | 369 WEBRTC_TRACE(kTraceError, kTraceVoice, |
370 WEBRTC_TRACE(kTraceError, kTraceVoice, | 370 VoEId(_shared->instance_id(), -1), |
371 VoEId(_shared->instance_id(), -1), | 371 "SetRecordingDevice() failed to start recording"); |
372 "SetRecordingDevice() failed to start recording"); | 372 return -1; |
373 return -1; | |
374 } | |
375 } | 373 } |
376 } | 374 } |
377 | 375 |
378 return 0; | 376 return 0; |
379 } | 377 } |
380 | 378 |
381 int VoEHardwareImpl::SetPlayoutDevice(int index) { | 379 int VoEHardwareImpl::SetPlayoutDevice(int index) { |
382 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 380 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
383 "SetPlayoutDevice(index=%d)", index); | 381 "SetPlayoutDevice(index=%d)", index); |
384 CriticalSectionScoped cs(_shared->crit_sec()); | 382 CriticalSectionScoped cs(_shared->crit_sec()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 bool available = false; | 436 bool available = false; |
439 _shared->audio_device()->StereoPlayoutIsAvailable(&available); | 437 _shared->audio_device()->StereoPlayoutIsAvailable(&available); |
440 if (_shared->audio_device()->SetStereoPlayout(available) != 0) { | 438 if (_shared->audio_device()->SetStereoPlayout(available) != 0) { |
441 _shared->SetLastError( | 439 _shared->SetLastError( |
442 VE_SOUNDCARD_ERROR, kTraceWarning, | 440 VE_SOUNDCARD_ERROR, kTraceWarning, |
443 "SetPlayoutDevice() failed to set stereo playout mode"); | 441 "SetPlayoutDevice() failed to set stereo playout mode"); |
444 } | 442 } |
445 | 443 |
446 // Restore playout if it was enabled already when calling this function. | 444 // Restore playout if it was enabled already when calling this function. |
447 if (isPlaying) { | 445 if (isPlaying) { |
448 if (!_shared->ext_playout()) { | 446 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), |
449 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), | 447 "SetPlayoutDevice() playout is now being restored..."); |
450 "SetPlayoutDevice() playout is now being restored..."); | 448 if (_shared->audio_device()->InitPlayout() != 0) { |
451 if (_shared->audio_device()->InitPlayout() != 0) { | 449 WEBRTC_TRACE(kTraceError, kTraceVoice, |
452 WEBRTC_TRACE(kTraceError, kTraceVoice, | 450 VoEId(_shared->instance_id(), -1), |
453 VoEId(_shared->instance_id(), -1), | 451 "SetPlayoutDevice() failed to initialize playout"); |
454 "SetPlayoutDevice() failed to initialize playout"); | 452 return -1; |
455 return -1; | 453 } |
456 } | 454 if (_shared->audio_device()->StartPlayout() != 0) { |
457 if (_shared->audio_device()->StartPlayout() != 0) { | 455 WEBRTC_TRACE(kTraceError, kTraceVoice, |
458 WEBRTC_TRACE(kTraceError, kTraceVoice, | 456 VoEId(_shared->instance_id(), -1), |
459 VoEId(_shared->instance_id(), -1), | 457 "SetPlayoutDevice() failed to start playout"); |
460 "SetPlayoutDevice() failed to start playout"); | 458 return -1; |
461 return -1; | |
462 } | |
463 } | 459 } |
464 } | 460 } |
465 | 461 |
466 return 0; | 462 return 0; |
467 } | 463 } |
468 | 464 |
469 int VoEHardwareImpl::SetRecordingSampleRate(unsigned int samples_per_sec) { | 465 int VoEHardwareImpl::SetRecordingSampleRate(unsigned int samples_per_sec) { |
470 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 466 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
471 "%s", __FUNCTION__); | 467 "%s", __FUNCTION__); |
472 if (!_shared->statistics().Initialized()) { | 468 if (!_shared->statistics().Initialized()) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 if (!_shared->statistics().Initialized()) { | 514 if (!_shared->statistics().Initialized()) { |
519 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 515 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
520 return -1; | 516 return -1; |
521 } | 517 } |
522 return _shared->audio_device()->EnableBuiltInAEC(enable); | 518 return _shared->audio_device()->EnableBuiltInAEC(enable); |
523 } | 519 } |
524 | 520 |
525 #endif // WEBRTC_VOICE_ENGINE_HARDWARE_API | 521 #endif // WEBRTC_VOICE_ENGINE_HARDWARE_API |
526 | 522 |
527 } // namespace webrtc | 523 } // namespace webrtc |
OLD | NEW |