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

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

Issue 2780263002: Add logging around audio session interruptions (Closed)
Patch Set: Modify logging to be clearer. 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
« no previous file with comments | « no previous file | webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm » ('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) 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(@"Interruption begin. IsInterrupted changed from %d to 1.",
474 is_interrupted_);
471 if (audio_unit_ && 475 if (audio_unit_ &&
472 audio_unit_->GetState() == VoiceProcessingAudioUnit::kStarted) { 476 audio_unit_->GetState() == VoiceProcessingAudioUnit::kStarted) {
473 RTCLog(@"Stopping the audio unit due to interruption begin."); 477 RTCLog(@"Stopping the audio unit due to interruption begin.");
474 if (!audio_unit_->Stop()) { 478 if (!audio_unit_->Stop()) {
475 RTCLogError(@"Failed to stop the audio unit for interruption begin."); 479 RTCLogError(@"Failed to stop the audio unit for interruption begin.");
476 } 480 }
477 } 481 }
478 is_interrupted_ = true; 482 is_interrupted_ = true;
479 } 483 }
480 484
481 void AudioDeviceIOS::HandleInterruptionEnd() { 485 void AudioDeviceIOS::HandleInterruptionEnd() {
482 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 486 RTC_DCHECK(thread_checker_.CalledOnValidThread());
483 487
488 RTCLog(@"Interruption ended. IsInterrupted changed from %d to 0. "
489 "Updating audio unit state.", is_interrupted_);
484 is_interrupted_ = false; 490 is_interrupted_ = false;
485 RTCLog(@"Interruption ended. Updating audio unit state.");
486 UpdateAudioUnit([RTCAudioSession sharedInstance].canPlayOrRecord); 491 UpdateAudioUnit([RTCAudioSession sharedInstance].canPlayOrRecord);
487 } 492 }
488 493
489 void AudioDeviceIOS::HandleValidRouteChange() { 494 void AudioDeviceIOS::HandleValidRouteChange() {
490 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 495 RTC_DCHECK(thread_checker_.CalledOnValidThread());
491 496
492 RTCAudioSession* session = [RTCAudioSession sharedInstance]; 497 RTCAudioSession* session = [RTCAudioSession sharedInstance];
493 RTCLog(@"%@", session); 498 RTCLog(@"%@", session);
494 HandleSampleRateChange(session.sampleRate); 499 HandleSampleRateChange(session.sampleRate);
495 } 500 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 831
827 // All I/O should be stopped or paused prior to deactivating the audio 832 // All I/O should be stopped or paused prior to deactivating the audio
828 // session, hence we deactivate as last action. 833 // session, hence we deactivate as last action.
829 [session lockForConfiguration]; 834 [session lockForConfiguration];
830 UnconfigureAudioSession(); 835 UnconfigureAudioSession();
831 [session endWebRTCSession:nil]; 836 [session endWebRTCSession:nil];
832 [session unlockForConfiguration]; 837 [session unlockForConfiguration];
833 } 838 }
834 839
835 } // namespace webrtc 840 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698