Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/mac/audio_manager_mac.h" | 5 #include "media/audio/mac/audio_manager_mac.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 // We are now in shutdown mode. This flag disables MaybeChangeBufferSize() | 383 // We are now in shutdown mode. This flag disables MaybeChangeBufferSize() |
| 384 // and IncreaseIOBufferSizeIfPossible() which both touches native Core Audio | 384 // and IncreaseIOBufferSizeIfPossible() which both touches native Core Audio |
| 385 // APIs and they can fail and disrupt tests during shutdown. | 385 // APIs and they can fail and disrupt tests during shutdown. |
| 386 in_shutdown_ = true; | 386 in_shutdown_ = true; |
| 387 // We have seen cases where active input audio is not closed down properly | 387 // We have seen cases where active input audio is not closed down properly |
| 388 // at browser shutdown. AudioInputController::Close() is called but tasks | 388 // at browser shutdown. AudioInputController::Close() is called but tasks |
| 389 // in AudioInputController::DoClose() are not executed. Hence, input streams | 389 // in AudioInputController::DoClose() are not executed. Hence, input streams |
| 390 // might remain even at this late state. | 390 // might remain even at this late state. |
| 391 // TODO(henrika): figure out the real cause why streams are not closed | 391 // TODO(henrika): figure out the real cause why streams are not closed |
| 392 // properly by the AIC for all cases and then remove this loop. | 392 // properly by the AIC for all cases and then remove this loop. |
| 393 for (auto* stream : low_latency_input_streams_) { | 393 auto low_latency_input_streams_copy = low_latency_input_streams_; |
|
tommi (sloooow) - chröme
2016/07/08 12:06:59
nit: add a comment above this line that explains w
henrika (OOO until Aug 14)
2016/07/08 12:19:38
Good idea, thanks!
| |
| 394 for (auto* stream : low_latency_input_streams_copy) { | |
| 394 LOG(WARNING) << "Closing existing audio input stream at destruction"; | 395 LOG(WARNING) << "Closing existing audio input stream at destruction"; |
| 395 // Prevents active Core Audio callbacks to use possibly invalid objects | 396 // Prevents active Core Audio callbacks to use possibly invalid objects |
| 396 // in its OnData() callback. | 397 // in its OnData() callback. |
| 397 stream->Stop(); | 398 stream->Stop(); |
| 398 // Avoids hitting CHECK in dtor of AudioManagerBase. | 399 // Avoids hitting CHECK in dtor of AudioManagerBase. |
| 399 stream->Close(); | 400 stream->Close(); |
| 400 } | 401 } |
| 401 Shutdown(); | 402 Shutdown(); |
| 402 } | 403 } |
| 403 | 404 |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1094 ScopedAudioManagerPtr CreateAudioManager( | 1095 ScopedAudioManagerPtr CreateAudioManager( |
| 1095 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 1096 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 1096 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 1097 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| 1097 AudioLogFactory* audio_log_factory) { | 1098 AudioLogFactory* audio_log_factory) { |
| 1098 return ScopedAudioManagerPtr( | 1099 return ScopedAudioManagerPtr( |
| 1099 new AudioManagerMac(std::move(task_runner), std::move(worker_task_runner), | 1100 new AudioManagerMac(std::move(task_runner), std::move(worker_task_runner), |
| 1100 audio_log_factory)); | 1101 audio_log_factory)); |
| 1101 } | 1102 } |
| 1102 | 1103 |
| 1103 } // namespace media | 1104 } // namespace media |
| OLD | NEW |