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/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 #include "media/base/scoped_histogram_timer.h" | 10 #include "media/base/scoped_histogram_timer.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 | 195 |
| 196 if (stream_ && !stream_->Open()) { | 196 if (stream_ && !stream_->Open()) { |
| 197 stream_->Close(); | 197 stream_->Close(); |
| 198 stream_ = NULL; | 198 stream_ = NULL; |
| 199 handler_->OnError(this, STREAM_OPEN_ERROR); | 199 handler_->OnError(this, STREAM_OPEN_ERROR); |
| 200 return; | 200 return; |
| 201 } | 201 } |
| 202 | 202 |
| 203 DCHECK(!no_data_timer_.get()); | 203 DCHECK(!no_data_timer_.get()); |
| 204 | 204 |
| 205 #if defined(OS_MACOSX) | |
| 206 // This is a fix for crbug.com/357501. The timer can trigger when closing | 205 // This is a fix for crbug.com/357501. The timer can trigger when closing |
| 207 // the lid on Macs, which causes more problems than the timer fixes. | 206 // the lid on Macs, which causes more problems than the timer fixes. |
| 207 // Also, in crbug.com/357569, the goal is to remove usage of this timer | |
| 208 // since it was added to solve a crach on Windowsw that no longer can be | |
|
tommi (sloooow) - chröme
2014/03/31 11:11:52
nit: s/crach/crash s/Windowsw/Windows s/that no lo
henrika (OOO until Aug 14)
2014/03/31 11:21:53
Done.
| |
| 209 // reproduced. | |
| 210 // TODO(henrika): verify that setting |enable_nodata_timer| to false on all | |
| 211 // platforms is a valid change. | |
|
tommi (sloooow) - chröme
2014/03/31 11:11:52
is this something you intend to do before actually
henrika (OOO until Aug 14)
2014/03/31 11:21:53
Thanks. Will rewrite the TODO. Plan was to use Can
| |
| 208 enable_nodata_timer = false; | 212 enable_nodata_timer = false; |
| 209 #endif | |
| 210 | 213 |
| 211 if (enable_nodata_timer) { | 214 if (enable_nodata_timer) { |
| 212 // Create the data timer which will call DoCheckForNoData(). The timer | 215 // Create the data timer which will call DoCheckForNoData(). The timer |
| 213 // is started in DoRecord() and restarted in each DoCheckForNoData() | 216 // is started in DoRecord() and restarted in each DoCheckForNoData() |
| 214 // callback. | 217 // callback. |
| 215 no_data_timer_.reset(new base::Timer( | 218 no_data_timer_.reset(new base::Timer( |
| 216 FROM_HERE, base::TimeDelta::FromSeconds(kTimerInitialIntervalSeconds), | 219 FROM_HERE, base::TimeDelta::FromSeconds(kTimerInitialIntervalSeconds), |
| 217 base::Bind(&AudioInputController::DoCheckForNoData, | 220 base::Bind(&AudioInputController::DoCheckForNoData, |
| 218 base::Unretained(this)), false)); | 221 base::Unretained(this)), false)); |
| 219 } else { | 222 } else { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 | 396 |
| 394 void AudioInputController::SetDataIsActive(bool enabled) { | 397 void AudioInputController::SetDataIsActive(bool enabled) { |
| 395 base::subtle::Release_Store(&data_is_active_, enabled); | 398 base::subtle::Release_Store(&data_is_active_, enabled); |
| 396 } | 399 } |
| 397 | 400 |
| 398 bool AudioInputController::GetDataIsActive() { | 401 bool AudioInputController::GetDataIsActive() { |
| 399 return (base::subtle::Acquire_Load(&data_is_active_) != false); | 402 return (base::subtle::Acquire_Load(&data_is_active_) != false); |
| 400 } | 403 } |
| 401 | 404 |
| 402 } // namespace media | 405 } // namespace media |
| OLD | NEW |