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_device.h" | 5 #include "media/audio/audio_output_device.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (callback_num_ == 2) { | 475 if (callback_num_ == 2) { |
476 TRACE_EVENT_ASYNC_END0("audio", "StartingPlayback", this); | 476 TRACE_EVENT_ASYNC_END0("audio", "StartingPlayback", this); |
477 } | 477 } |
478 | 478 |
479 // Read and reset the number of frames skipped. | 479 // Read and reset the number of frames skipped. |
480 AudioOutputBuffer* buffer = | 480 AudioOutputBuffer* buffer = |
481 reinterpret_cast<AudioOutputBuffer*>(shared_memory_.memory()); | 481 reinterpret_cast<AudioOutputBuffer*>(shared_memory_.memory()); |
482 uint32_t frames_skipped = buffer->params.frames_skipped; | 482 uint32_t frames_skipped = buffer->params.frames_skipped; |
483 buffer->params.frames_skipped = 0; | 483 buffer->params.frames_skipped = 0; |
484 | 484 |
485 DVLOG(4) << __FUNCTION__ << " pending_data:" << pending_data | 485 DVLOG(4) << __func__ << " pending_data:" << pending_data |
486 << " frames_delayed(pre-round):" << frames_delayed | 486 << " frames_delayed(pre-round):" << frames_delayed |
487 << " frames_skipped:" << frames_skipped; | 487 << " frames_skipped:" << frames_skipped; |
488 | 488 |
489 // Update the audio-delay measurement, inform about the number of skipped | 489 // Update the audio-delay measurement, inform about the number of skipped |
490 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 490 // frames, and ask client to render audio. Since |output_bus_| is wrapping |
491 // the shared memory the Render() call is writing directly into the shared | 491 // the shared memory the Render() call is writing directly into the shared |
492 // memory. | 492 // memory. |
493 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 493 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
494 frames_skipped); | 494 frames_skipped); |
495 } | 495 } |
496 | 496 |
497 bool AudioOutputDevice::AudioThreadCallback:: | 497 bool AudioOutputDevice::AudioThreadCallback:: |
498 CurrentThreadIsAudioDeviceThread() { | 498 CurrentThreadIsAudioDeviceThread() { |
499 return thread_checker_.CalledOnValidThread(); | 499 return thread_checker_.CalledOnValidThread(); |
500 } | 500 } |
501 | 501 |
502 } // namespace media | 502 } // namespace media |
OLD | NEW |