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

Side by Side Diff: webrtc/modules/audio_device/ios/audio_device_ios.mm

Issue 2780263002: Add logging around audio session interruptions (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 int AudioDeviceIOS::GetRecordAudioParameters(AudioParameters* params) const { 319 int AudioDeviceIOS::GetRecordAudioParameters(AudioParameters* params) const {
320 LOGI() << "GetRecordAudioParameters"; 320 LOGI() << "GetRecordAudioParameters";
321 RTC_DCHECK(record_parameters_.is_valid()); 321 RTC_DCHECK(record_parameters_.is_valid());
322 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 322 RTC_DCHECK(thread_checker_.CalledOnValidThread());
323 *params = record_parameters_; 323 *params = record_parameters_;
324 return 0; 324 return 0;
325 } 325 }
326 326
327 void AudioDeviceIOS::OnInterruptionBegin() { 327 void AudioDeviceIOS::OnInterruptionBegin() {
328 RTC_DCHECK(thread_); 328 RTC_DCHECK(thread_);
329 LOGI() << "OnInterruptionBegin";
329 thread_->Post(RTC_FROM_HERE, this, kMessageTypeInterruptionBegin); 330 thread_->Post(RTC_FROM_HERE, this, kMessageTypeInterruptionBegin);
330 } 331 }
331 332
332 void AudioDeviceIOS::OnInterruptionEnd() { 333 void AudioDeviceIOS::OnInterruptionEnd() {
333 RTC_DCHECK(thread_); 334 RTC_DCHECK(thread_);
335 LOGI() << "OnInterruptionEnd";
334 thread_->Post(RTC_FROM_HERE, this, kMessageTypeInterruptionEnd); 336 thread_->Post(RTC_FROM_HERE, this, kMessageTypeInterruptionEnd);
335 } 337 }
336 338
337 void AudioDeviceIOS::OnValidRouteChange() { 339 void AudioDeviceIOS::OnValidRouteChange() {
338 RTC_DCHECK(thread_); 340 RTC_DCHECK(thread_);
339 thread_->Post(RTC_FROM_HERE, this, kMessageTypeValidRouteChange); 341 thread_->Post(RTC_FROM_HERE, this, kMessageTypeValidRouteChange);
340 } 342 }
341 343
342 void AudioDeviceIOS::OnCanPlayOrRecordChange(bool can_play_or_record) { 344 void AudioDeviceIOS::OnCanPlayOrRecordChange(bool can_play_or_record) {
343 RTC_DCHECK(thread_); 345 RTC_DCHECK(thread_);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 HandleCanPlayOrRecordChange(data->data()); 463 HandleCanPlayOrRecordChange(data->data());
462 delete data; 464 delete data;
463 break; 465 break;
464 } 466 }
465 } 467 }
466 } 468 }
467 469
468 void AudioDeviceIOS::HandleInterruptionBegin() { 470 void AudioDeviceIOS::HandleInterruptionBegin() {
469 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 471 RTC_DCHECK(thread_checker_.CalledOnValidThread());
470 472
473 RTCLog(@"Handling interruption begin.");
471 if (audio_unit_ && 474 if (audio_unit_ &&
472 audio_unit_->GetState() == VoiceProcessingAudioUnit::kStarted) { 475 audio_unit_->GetState() == VoiceProcessingAudioUnit::kStarted) {
473 RTCLog(@"Stopping the audio unit due to interruption begin."); 476 RTCLog(@"Stopping the audio unit due to interruption begin.");
474 if (!audio_unit_->Stop()) { 477 if (!audio_unit_->Stop()) {
475 RTCLogError(@"Failed to stop the audio unit for interruption begin."); 478 RTCLogError(@"Failed to stop the audio unit for interruption begin.");
476 } 479 }
477 } 480 }
478 is_interrupted_ = true; 481 is_interrupted_ = true;
479 } 482 }
480 483
481 void AudioDeviceIOS::HandleInterruptionEnd() { 484 void AudioDeviceIOS::HandleInterruptionEnd() {
482 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 485 RTC_DCHECK(thread_checker_.CalledOnValidThread());
483 486
487 RTCLog(@"Interruption ended. IsInterrupted=%d. Updating audio unit state.",
tkchin_webrtc 2017/03/29 20:02:51 nit: maybe for both these logs do "Interruption ch
Chuck 2017/03/29 20:29:18 Done.
488 is_interrupted_);
484 is_interrupted_ = false; 489 is_interrupted_ = false;
485 RTCLog(@"Interruption ended. Updating audio unit state.");
486 UpdateAudioUnit([RTCAudioSession sharedInstance].canPlayOrRecord); 490 UpdateAudioUnit([RTCAudioSession sharedInstance].canPlayOrRecord);
487 } 491 }
488 492
489 void AudioDeviceIOS::HandleValidRouteChange() { 493 void AudioDeviceIOS::HandleValidRouteChange() {
490 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 494 RTC_DCHECK(thread_checker_.CalledOnValidThread());
491 495
492 RTCAudioSession* session = [RTCAudioSession sharedInstance]; 496 RTCAudioSession* session = [RTCAudioSession sharedInstance];
493 RTCLog(@"%@", session); 497 RTCLog(@"%@", session);
494 HandleSampleRateChange(session.sampleRate); 498 HandleSampleRateChange(session.sampleRate);
495 } 499 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 830
827 // All I/O should be stopped or paused prior to deactivating the audio 831 // All I/O should be stopped or paused prior to deactivating the audio
828 // session, hence we deactivate as last action. 832 // session, hence we deactivate as last action.
829 [session lockForConfiguration]; 833 [session lockForConfiguration];
830 UnconfigureAudioSession(); 834 UnconfigureAudioSession();
831 [session endWebRTCSession:nil]; 835 [session endWebRTCSession:nil];
832 [session unlockForConfiguration]; 836 [session unlockForConfiguration];
833 } 837 }
834 838
835 } // namespace webrtc 839 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698