| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 238   if (!recording_ && | 238   if (!recording_ && | 
| 239       audio_unit_->GetState() == VoiceProcessingAudioUnit::kInitialized) { | 239       audio_unit_->GetState() == VoiceProcessingAudioUnit::kInitialized) { | 
| 240     if (!audio_unit_->Start()) { | 240     if (!audio_unit_->Start()) { | 
| 241       RTCLogError(@"StartPlayout failed to start audio unit."); | 241       RTCLogError(@"StartPlayout failed to start audio unit."); | 
| 242       return -1; | 242       return -1; | 
| 243     } | 243     } | 
| 244     LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started"; | 244     LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started"; | 
| 245   } | 245   } | 
| 246   rtc::AtomicOps::ReleaseStore(&playing_, 1); | 246   rtc::AtomicOps::ReleaseStore(&playing_, 1); | 
| 247   num_playout_callbacks_ = 0; | 247   num_playout_callbacks_ = 0; | 
|  | 248   num_detected_playout_glitches_ = 0; | 
| 248   return 0; | 249   return 0; | 
| 249 } | 250 } | 
| 250 | 251 | 
| 251 int32_t AudioDeviceIOS::StopPlayout() { | 252 int32_t AudioDeviceIOS::StopPlayout() { | 
| 252   LOGI() << "StopPlayout"; | 253   LOGI() << "StopPlayout"; | 
| 253   RTC_DCHECK_RUN_ON(&thread_checker_); | 254   RTC_DCHECK_RUN_ON(&thread_checker_); | 
| 254   if (!audio_is_initialized_ || !playing_) { | 255   if (!audio_is_initialized_ || !playing_) { | 
| 255     return 0; | 256     return 0; | 
| 256   } | 257   } | 
| 257   if (!recording_) { | 258   if (!recording_) { | 
| 258     ShutdownPlayOrRecord(); | 259     ShutdownPlayOrRecord(); | 
| 259     audio_is_initialized_ = false; | 260     audio_is_initialized_ = false; | 
| 260   } | 261   } | 
| 261   rtc::AtomicOps::ReleaseStore(&playing_, 0); | 262   rtc::AtomicOps::ReleaseStore(&playing_, 0); | 
| 262 | 263 | 
| 263   // Derive average number of calls to OnGetPlayoutData() between detected | 264   // Derive average number of calls to OnGetPlayoutData() between detected | 
| 264   // audio glitches and add the result to a histogram. | 265   // audio glitches and add the result to a histogram. | 
| 265   int average_number_of_playout_callbacks_between_glitches = 100000; | 266   int average_number_of_playout_callbacks_between_glitches = 100000; | 
|  | 267   RTC_DCHECK_GE(num_playout_callbacks_, num_detected_playout_glitches_); | 
| 266   if (num_detected_playout_glitches_ > 0) { | 268   if (num_detected_playout_glitches_ > 0) { | 
| 267     average_number_of_playout_callbacks_between_glitches = | 269     average_number_of_playout_callbacks_between_glitches = | 
| 268         num_playout_callbacks_ / num_detected_playout_glitches_; | 270         num_playout_callbacks_ / num_detected_playout_glitches_; | 
| 269   } | 271   } | 
| 270   RTC_HISTOGRAM_COUNTS_100000( | 272   RTC_HISTOGRAM_COUNTS_100000( | 
| 271       "WebRTC.Audio.AveragePlayoutCallbacksBetweenGlitches", | 273       "WebRTC.Audio.AveragePlayoutCallbacksBetweenGlitches", | 
| 272       average_number_of_playout_callbacks_between_glitches); | 274       average_number_of_playout_callbacks_between_glitches); | 
| 273   RTCLog(@"Average number of playout callbacks between glitches: %d", | 275   RTCLog(@"Average number of playout callbacks between glitches: %d", | 
| 274          average_number_of_playout_callbacks_between_glitches); | 276          average_number_of_playout_callbacks_between_glitches); | 
| 275   return 0; | 277   return 0; | 
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 938 | 940 | 
| 939   // All I/O should be stopped or paused prior to deactivating the audio | 941   // All I/O should be stopped or paused prior to deactivating the audio | 
| 940   // session, hence we deactivate as last action. | 942   // session, hence we deactivate as last action. | 
| 941   [session lockForConfiguration]; | 943   [session lockForConfiguration]; | 
| 942   UnconfigureAudioSession(); | 944   UnconfigureAudioSession(); | 
| 943   [session endWebRTCSession:nil]; | 945   [session endWebRTCSession:nil]; | 
| 944   [session unlockForConfiguration]; | 946   [session unlockForConfiguration]; | 
| 945 } | 947 } | 
| 946 | 948 | 
| 947 }  // namespace webrtc | 949 }  // namespace webrtc | 
| OLD | NEW | 
|---|