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_output_controller.h" | 5 #include "media/audio/audio_output_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 // WedgeCheck() will look to see if |on_more_io_data_called_| is true after | 208 // WedgeCheck() will look to see if |on_more_io_data_called_| is true after |
| 209 // the timeout expires. Care must be taken to ensure the wedge check delay is | 209 // the timeout expires. Care must be taken to ensure the wedge check delay is |
| 210 // large enough that the value isn't queried while OnMoreDataIO() is setting | 210 // large enough that the value isn't queried while OnMoreDataIO() is setting |
| 211 // it. | 211 // it. |
| 212 // | 212 // |
| 213 // Timer self-manages its lifetime and WedgeCheck() will only record the UMA | 213 // Timer self-manages its lifetime and WedgeCheck() will only record the UMA |
| 214 // statistic if state is still kPlaying. Additional Start() calls will | 214 // statistic if state is still kPlaying. Additional Start() calls will |
| 215 // invalidate the previous timer. | 215 // invalidate the previous timer. |
| 216 wedge_timer_.reset(new base::OneShotTimer<AudioOutputController>()); | 216 wedge_timer_.reset(new base::OneShotTimer<AudioOutputController>()); |
| 217 wedge_timer_->Start( | 217 wedge_timer_->Start( |
| 218 FROM_HERE, TimeDelta::FromSeconds(5), this, | 218 FROM_HERE, TimeDelta::FromSeconds(1), this, |
|
scherkus (not reviewing)
2013/12/02 21:49:37
FYI changing this value will impact the results of
DaleCurtis
2013/12/02 22:23:59
For safety I'm going to revert this change. Since
| |
| 219 &AudioOutputController::WedgeCheck); | 219 &AudioOutputController::WedgeCheck); |
| 220 | 220 |
| 221 handler_->OnPlaying(); | 221 handler_->OnPlaying(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 #if defined(AUDIO_POWER_MONITORING) | 224 #if defined(AUDIO_POWER_MONITORING) |
| 225 void AudioOutputController::ReportPowerMeasurementPeriodically() { | 225 void AudioOutputController::ReportPowerMeasurementPeriodically() { |
| 226 DCHECK(message_loop_->BelongsToCurrentThread()); | 226 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 227 const std::pair<float, bool>& reading = | 227 const std::pair<float, bool>& reading = |
| 228 power_monitor_.ReadCurrentPowerAndClip(); | 228 power_monitor_.ReadCurrentPowerAndClip(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 void AudioOutputController::DisallowEntryToOnMoreIOData() { | 468 void AudioOutputController::DisallowEntryToOnMoreIOData() { |
| 469 const bool is_zero = !base::AtomicRefCountDec(&num_allowed_io_); | 469 const bool is_zero = !base::AtomicRefCountDec(&num_allowed_io_); |
| 470 DCHECK(is_zero); | 470 DCHECK(is_zero); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void AudioOutputController::WedgeCheck() { | 473 void AudioOutputController::WedgeCheck() { |
| 474 DCHECK(message_loop_->BelongsToCurrentThread()); | 474 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 475 | 475 |
| 476 // If we should be playing and we haven't, that's a wedge. | 476 // If we should be playing and we haven't, that's a wedge. |
| 477 if (state_ == kPlaying) { | 477 if (state_ == kPlaying) { |
| 478 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", | 478 const bool playback_success = |
| 479 base::AtomicRefCountIsOne(&on_more_io_data_called_)); | 479 base::AtomicRefCountIsOne(&on_more_io_data_called_); |
| 480 | |
| 481 UMA_HISTOGRAM_BOOLEAN( | |
| 482 "Media.AudioOutputControllerPlaybackStartupSuccess", playback_success); | |
| 483 | |
| 484 // Let the AudioManager try and fix it. | |
| 485 if (!playback_success) | |
| 486 audio_manager_->FixWedgedAudio(); | |
|
scherkus (not reviewing)
2013/12/02 21:49:37
Hmm I was under the impression we'd be landing a M
DaleCurtis
2013/12/02 22:23:59
(3) is fine, I wanted to get the idea sanitized be
DaleCurtis
2013/12/02 22:52:08
Actually 3 wasn't possible since the fix requires
| |
| 480 } | 487 } |
| 481 } | 488 } |
| 482 | 489 |
| 483 } // namespace media | 490 } // namespace media |
| OLD | NEW |