OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/audio_decoder_job.h" | 5 #include "media/base/android/audio_decoder_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 audio_extra_data_.end(), | 154 audio_extra_data_.end(), |
155 configs.audio_extra_data.begin()); | 155 configs.audio_extra_data.begin()); |
156 } | 156 } |
157 | 157 |
158 MediaDecoderJob::MediaDecoderJobStatus | 158 MediaDecoderJob::MediaDecoderJobStatus |
159 AudioDecoderJob::CreateMediaCodecBridgeInternal() { | 159 AudioDecoderJob::CreateMediaCodecBridgeInternal() { |
160 media_codec_bridge_.reset(AudioCodecBridge::Create(audio_codec_)); | 160 media_codec_bridge_.reset(AudioCodecBridge::Create(audio_codec_)); |
161 if (!media_codec_bridge_) | 161 if (!media_codec_bridge_) |
162 return STATUS_FAILURE; | 162 return STATUS_FAILURE; |
163 | 163 |
164 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get()))->Start( | 164 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) |
165 audio_codec_, config_sampling_rate_, num_channels_, &audio_extra_data_[0], | 165 ->Start(audio_codec_, config_sampling_rate_, num_channels_, |
166 audio_extra_data_.size(), audio_codec_delay_ns_, audio_seek_preroll_ns_, | 166 &audio_extra_data_[0], audio_extra_data_.size(), |
167 true, GetMediaCrypto().obj())) { | 167 audio_codec_delay_ns_, audio_seek_preroll_ns_, true, |
| 168 GetMediaCrypto())) { |
168 media_codec_bridge_.reset(); | 169 media_codec_bridge_.reset(); |
169 return STATUS_FAILURE; | 170 return STATUS_FAILURE; |
170 } | 171 } |
171 | 172 |
172 SetVolumeInternal(); | 173 SetVolumeInternal(); |
173 | 174 |
174 // Reset values used to track codec bridge output | 175 // Reset values used to track codec bridge output |
175 frame_count_ = 0; | 176 frame_count_ = 0; |
176 ResetTimestampHelper(); | 177 ResetTimestampHelper(); |
177 | 178 |
(...skipping 10 matching lines...) Expand all Loading... |
188 void AudioDecoderJob::OnOutputFormatChanged() { | 189 void AudioDecoderJob::OnOutputFormatChanged() { |
189 DCHECK(media_codec_bridge_); | 190 DCHECK(media_codec_bridge_); |
190 | 191 |
191 int old_sampling_rate = output_sampling_rate_; | 192 int old_sampling_rate = output_sampling_rate_; |
192 output_sampling_rate_ = media_codec_bridge_->GetOutputSamplingRate(); | 193 output_sampling_rate_ = media_codec_bridge_->GetOutputSamplingRate(); |
193 if (output_sampling_rate_ != old_sampling_rate) | 194 if (output_sampling_rate_ != old_sampling_rate) |
194 ResetTimestampHelper(); | 195 ResetTimestampHelper(); |
195 } | 196 } |
196 | 197 |
197 } // namespace media | 198 } // namespace media |
OLD | NEW |