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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <algorithm> |
9 #include <limits> | 10 #include <limits> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
13 #include "base/numerics/safe_conversions.h" | 14 #include "base/numerics/safe_conversions.h" |
14 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
15 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
18 | 19 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 288 } |
288 | 289 |
289 void AudioOutputController::DoReportError() { | 290 void AudioOutputController::DoReportError() { |
290 DCHECK(message_loop_->BelongsToCurrentThread()); | 291 DCHECK(message_loop_->BelongsToCurrentThread()); |
291 if (state_ != kClosed) | 292 if (state_ != kClosed) |
292 handler_->OnError(); | 293 handler_->OnError(); |
293 } | 294 } |
294 | 295 |
295 int AudioOutputController::OnMoreData(AudioBus* dest, | 296 int AudioOutputController::OnMoreData(AudioBus* dest, |
296 uint32_t total_bytes_delay, | 297 uint32_t total_bytes_delay, |
| 298 base::TimeDelta delay_timestamp, |
297 uint32_t frames_skipped) { | 299 uint32_t frames_skipped) { |
298 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData"); | 300 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData"); |
299 | 301 |
300 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck() | 302 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck() |
301 // may have already fired if OnMoreData() took an abnormal amount of time). | 303 // may have already fired if OnMoreData() took an abnormal amount of time). |
302 // Since this thread is the only writer of |on_more_io_data_called_| once the | 304 // Since this thread is the only writer of |on_more_io_data_called_| once the |
303 // thread starts, its safe to compare and then increment. | 305 // thread starts, its safe to compare and then increment. |
304 if (base::AtomicRefCountIsZero(&on_more_io_data_called_)) | 306 if (base::AtomicRefCountIsZero(&on_more_io_data_called_)) |
305 base::AtomicRefCountInc(&on_more_io_data_called_); | 307 base::AtomicRefCountInc(&on_more_io_data_called_); |
306 | 308 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 DCHECK(message_loop_->BelongsToCurrentThread()); | 507 DCHECK(message_loop_->BelongsToCurrentThread()); |
506 | 508 |
507 // If we should be playing and we haven't, that's a wedge. | 509 // If we should be playing and we haven't, that's a wedge. |
508 if (state_ == kPlaying) { | 510 if (state_ == kPlaying) { |
509 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", | 511 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", |
510 base::AtomicRefCountIsOne(&on_more_io_data_called_)); | 512 base::AtomicRefCountIsOne(&on_more_io_data_called_)); |
511 } | 513 } |
512 } | 514 } |
513 | 515 |
514 } // namespace media | 516 } // namespace media |
OLD | NEW |