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/audio_input_controller.h" | 5 #include "media/audio/audio_input_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
9 #include "media/base/limits.h" | 9 #include "media/base/limits.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 const int kMaxInputChannels = 2; | 12 const int kMaxInputChannels = 2; |
13 const int kTimerResetIntervalSeconds = 1; | 13 const int kTimerResetIntervalSeconds = 1; |
14 #if defined(OS_IOS) | 14 #if defined(OS_IOS) |
15 // The first callback on iOS is received after the current background | 15 // The first callback on iOS is received after the current background |
16 // audio has faded away. | 16 // audio has faded away. |
17 const int kTimerInitialIntervalSeconds = 4; | 17 const int kTimerInitialIntervalSeconds = 4; |
18 #else | 18 #else |
19 const int kTimerInitialIntervalSeconds = 1; | 19 // We have received reports that the timer can be too trigger happy on some |
| 20 // Mac devices and the initial timer interval has therefore been increased |
| 21 // from 1 second to 5 seconds. |
| 22 // TODO(henrika): remove usage of timers and add support for proper |
| 23 // notification of when the input device is removed. |
| 24 // See http://crbug.com/226327 for details. |
| 25 const int kTimerInitialIntervalSeconds = 5; |
20 #endif // defined(OS_IOS) | 26 #endif // defined(OS_IOS) |
21 } | 27 } |
22 | 28 |
23 namespace media { | 29 namespace media { |
24 | 30 |
25 // static | 31 // static |
26 AudioInputController::Factory* AudioInputController::factory_ = NULL; | 32 AudioInputController::Factory* AudioInputController::factory_ = NULL; |
27 | 33 |
28 AudioInputController::AudioInputController(EventHandler* handler, | 34 AudioInputController::AudioInputController(EventHandler* handler, |
29 SyncWriter* sync_writer) | 35 SyncWriter* sync_writer) |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 347 |
342 void AudioInputController::SetDataIsActive(bool enabled) { | 348 void AudioInputController::SetDataIsActive(bool enabled) { |
343 base::subtle::Release_Store(&data_is_active_, enabled); | 349 base::subtle::Release_Store(&data_is_active_, enabled); |
344 } | 350 } |
345 | 351 |
346 bool AudioInputController::GetDataIsActive() { | 352 bool AudioInputController::GetDataIsActive() { |
347 return (base::subtle::Acquire_Load(&data_is_active_) != false); | 353 return (base::subtle::Acquire_Load(&data_is_active_) != false); |
348 } | 354 } |
349 | 355 |
350 } // namespace media | 356 } // namespace media |
OLD | NEW |