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_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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 // Read and reset the number of frames skipped. | 469 // Read and reset the number of frames skipped. |
| 470 AudioOutputBuffer* buffer = | 470 AudioOutputBuffer* buffer = |
| 471 reinterpret_cast<AudioOutputBuffer*>(shared_memory_.memory()); | 471 reinterpret_cast<AudioOutputBuffer*>(shared_memory_.memory()); |
| 472 uint32_t frames_skipped = buffer->params.frames_skipped; | 472 uint32_t frames_skipped = buffer->params.frames_skipped; |
| 473 buffer->params.frames_skipped = 0; | 473 buffer->params.frames_skipped = 0; |
| 474 | 474 |
| 475 DVLOG(4) << __func__ << " pending_data:" << pending_data | 475 DVLOG(4) << __func__ << " pending_data:" << pending_data |
| 476 << " frames_delayed(pre-round):" << frames_delayed | 476 << " frames_delayed(pre-round):" << frames_delayed |
| 477 << " frames_skipped:" << frames_skipped; | 477 << " frames_skipped:" << frames_skipped; |
| 478 | 478 |
| 479 output_bus_->set_is_raw_format(audio_parameters_.IsRawFormat()); | |
|
DaleCurtis
2016/11/04 21:24:53
What happens if you output zeros when in bitstream
chcunningham
2017/06/14 20:03:08
Also curious about the meaning of zeroes.
| |
| 480 if (audio_parameters_.IsRawFormat()) { | |
| 481 // Reset the data size and frame count. | |
| 482 // For compressed audio formats, the data size and frame count will be | |
| 483 // updated by |render_callback_|. | |
| 484 output_bus_->set_data_size(0); | |
| 485 output_bus_->set_frames(audio_parameters_.frames_per_buffer()); | |
| 486 ; | |
| 487 } | |
| 479 // Update the audio-delay measurement, inform about the number of skipped | 488 // Update the audio-delay measurement, inform about the number of skipped |
| 480 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 489 // frames, and ask client to render audio. Since |output_bus_| is wrapping |
| 481 // the shared memory the Render() call is writing directly into the shared | 490 // the shared memory the Render() call is writing directly into the shared |
| 482 // memory. | 491 // memory. |
| 483 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 492 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
| 484 frames_skipped); | 493 frames_skipped); |
| 494 buffer->params.frames = output_bus_->frames(); | |
| 495 buffer->params.data_size = output_bus_->data_size(); | |
| 485 } | 496 } |
| 486 | 497 |
| 487 bool AudioOutputDevice::AudioThreadCallback:: | 498 bool AudioOutputDevice::AudioThreadCallback:: |
| 488 CurrentThreadIsAudioDeviceThread() { | 499 CurrentThreadIsAudioDeviceThread() { |
| 489 return thread_checker_.CalledOnValidThread(); | 500 return thread_checker_.CalledOnValidThread(); |
| 490 } | 501 } |
| 491 | 502 |
| 492 } // namespace media | 503 } // namespace media |
| OLD | NEW |