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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 base::TimeDelta delay = | 487 base::TimeDelta delay = |
488 base::TimeDelta::FromMicroseconds(buffer->params.delay); | 488 base::TimeDelta::FromMicroseconds(buffer->params.delay); |
489 | 489 |
490 base::TimeTicks delay_timestamp = | 490 base::TimeTicks delay_timestamp = |
491 base::TimeTicks() + | 491 base::TimeTicks() + |
492 base::TimeDelta::FromMicroseconds(buffer->params.delay_timestamp); | 492 base::TimeDelta::FromMicroseconds(buffer->params.delay_timestamp); |
493 | 493 |
494 DVLOG(4) << __func__ << " delay:" << delay << " delay_timestamp:" << delay | 494 DVLOG(4) << __func__ << " delay:" << delay << " delay_timestamp:" << delay |
495 << " frames_skipped:" << frames_skipped; | 495 << " frames_skipped:" << frames_skipped; |
496 | 496 |
497 output_bus_->set_is_bitstream_format(audio_parameters_.IsBitstreamFormat()); | |
DaleCurtis
2017/06/15 21:46:31
if (audio_parameters_.IsBitstreamFormat()) {
out
AndyWu
2017/08/02 01:43:39
Done.
| |
498 if (audio_parameters_.IsBitstreamFormat()) { | |
499 // Reset the data size and frame count. | |
500 // For compressed audio formats, the data size and frame count will be | |
501 // updated by |render_callback_|. | |
502 output_bus_->set_data_size(0); | |
503 output_bus_->set_frames(audio_parameters_.frames_per_buffer()); | |
504 } | |
505 | |
497 // Update the audio-delay measurement, inform about the number of skipped | 506 // Update the audio-delay measurement, inform about the number of skipped |
498 // frames, and ask client to render audio. Since |output_bus_| is wrapping | 507 // frames, and ask client to render audio. Since |output_bus_| is wrapping |
499 // the shared memory the Render() call is writing directly into the shared | 508 // the shared memory the Render() call is writing directly into the shared |
500 // memory. | 509 // memory. |
501 render_callback_->Render(delay, delay_timestamp, frames_skipped, | 510 render_callback_->Render(delay, delay_timestamp, frames_skipped, |
502 output_bus_.get()); | 511 output_bus_.get()); |
512 buffer->params.frames = output_bus_->frames(); | |
DaleCurtis
2017/06/15 21:46:31
Hmm, this is always audio_parameters_.frames_per_b
AndyWu
2017/08/02 01:43:39
To make things clear, I changed to GetBitstreamFra
| |
513 buffer->params.data_size = output_bus_->data_size(); | |
503 } | 514 } |
504 | 515 |
505 bool AudioOutputDevice::AudioThreadCallback:: | 516 bool AudioOutputDevice::AudioThreadCallback:: |
506 CurrentThreadIsAudioDeviceThread() { | 517 CurrentThreadIsAudioDeviceThread() { |
507 return thread_checker_.CalledOnValidThread(); | 518 return thread_checker_.CalledOnValidThread(); |
508 } | 519 } |
509 | 520 |
510 } // namespace media | 521 } // namespace media |
OLD | NEW |