| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/base/android/media_codec_audio_decoder.h" | 5 #include "media/base/android/media_codec_audio_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/base/android/media_codec_bridge.h" | 9 #include "media/base/android/media_codec_bridge.h" |
| 10 #include "media/base/audio_timestamp_helper.h" | 10 #include "media/base/audio_timestamp_helper.h" |
| 11 #include "media/base/demuxer_stream.h" | 11 #include "media/base/demuxer_stream.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // Use 16bit PCM for audio output. Keep this value in sync with the output | 15 // Use 16bit PCM for audio output. Keep this value in sync with the output |
| 16 // format we passed to AudioTrack in MediaCodecBridge. | 16 // format we passed to AudioTrack in MediaCodecBridge. |
| 17 const int kBytesPerAudioOutputSample = 2; | 17 const int kBytesPerAudioOutputSample = 2; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 MediaCodecAudioDecoder::MediaCodecAudioDecoder( | 22 MediaCodecAudioDecoder::MediaCodecAudioDecoder( |
| 23 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, | 23 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner, |
| 24 const base::Closure& request_data_cb, | 24 const base::Closure& request_data_cb, |
| 25 const base::Closure& starvation_cb, | 25 const base::Closure& starvation_cb, |
| 26 const base::Closure& preroll_done_cb, |
| 26 const base::Closure& stop_done_cb, | 27 const base::Closure& stop_done_cb, |
| 27 const base::Closure& error_cb, | 28 const base::Closure& error_cb, |
| 28 const SetTimeCallback& update_current_time_cb) | 29 const SetTimeCallback& update_current_time_cb) |
| 29 : MediaCodecDecoder(media_task_runner, | 30 : MediaCodecDecoder(media_task_runner, |
| 30 request_data_cb, | 31 request_data_cb, |
| 31 starvation_cb, | 32 starvation_cb, |
| 33 preroll_done_cb, |
| 32 stop_done_cb, | 34 stop_done_cb, |
| 33 error_cb, | 35 error_cb, |
| 34 "AudioDecoder"), | 36 "AudioDecoder"), |
| 35 volume_(-1.0), | 37 volume_(-1.0), |
| 36 bytes_per_frame_(0), | 38 bytes_per_frame_(0), |
| 37 output_sampling_rate_(0), | 39 output_sampling_rate_(0), |
| 38 frame_count_(0), | 40 frame_count_(0), |
| 39 update_current_time_cb_(update_current_time_cb) { | 41 update_current_time_cb_(update_current_time_cb) { |
| 40 } | 42 } |
| 41 | 43 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (audio_timestamp_helper_) | 215 if (audio_timestamp_helper_) |
| 214 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); | 216 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); |
| 215 | 217 |
| 216 audio_timestamp_helper_.reset( | 218 audio_timestamp_helper_.reset( |
| 217 new AudioTimestampHelper(configs_.audio_sampling_rate)); | 219 new AudioTimestampHelper(configs_.audio_sampling_rate)); |
| 218 | 220 |
| 219 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); | 221 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); |
| 220 } | 222 } |
| 221 | 223 |
| 222 } // namespace media | 224 } // namespace media |
| OLD | NEW |