| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 void AudioOutputController::AllowEntryToOnMoreIOData() { | 437 void AudioOutputController::AllowEntryToOnMoreIOData() { |
| 438 DCHECK(base::AtomicRefCountIsZero(&num_allowed_io_)); | 438 DCHECK(base::AtomicRefCountIsZero(&num_allowed_io_)); |
| 439 base::AtomicRefCountInc(&num_allowed_io_); | 439 base::AtomicRefCountInc(&num_allowed_io_); |
| 440 } | 440 } |
| 441 | 441 |
| 442 void AudioOutputController::DisallowEntryToOnMoreIOData() { | 442 void AudioOutputController::DisallowEntryToOnMoreIOData() { |
| 443 const bool is_zero = !base::AtomicRefCountDec(&num_allowed_io_); | 443 const bool is_zero = !base::AtomicRefCountDec(&num_allowed_io_); |
| 444 DCHECK(is_zero); | 444 DCHECK(is_zero); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void AudioOutputController::WedgeCheck() { |
| 448 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 449 |
| 450 // If we should be playing and we haven't, that's a wedge. |
| 451 if (state_ == kPlaying) { |
| 452 const bool playback_success = |
| 453 base::AtomicRefCountIsOne(&on_more_io_data_called_); |
| 454 |
| 455 UMA_HISTOGRAM_BOOLEAN( |
| 456 "Media.AudioOutputControllerPlaybackStartupSuccess", playback_success); |
| 457 |
| 458 // Let the AudioManager try and fix it. |
| 459 if (!playback_success) |
| 460 audio_manager_->FixWedgedAudio(); |
| 461 } |
| 462 } |
| 463 |
| 447 } // namespace media | 464 } // namespace media |
| OLD | NEW |