| 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/sdk_media_codec_bridge.h" | 10 #include "media/base/android/sdk_media_codec_bridge.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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())) | 164 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) |
| 165 ->ConfigureAndStart(audio_codec_, config_sampling_rate_, | 165 ->ConfigureAndStart(audio_codec_, config_sampling_rate_, |
| 166 num_channels_, &audio_extra_data_[0], | 166 num_channels_, &audio_extra_data_[0], |
| 167 audio_extra_data_.size(), audio_codec_delay_ns_, | 167 audio_extra_data_.size(), audio_codec_delay_ns_, |
| 168 audio_seek_preroll_ns_, true, | 168 audio_seek_preroll_ns_, true, |
| 169 GetMediaCrypto().obj())) { | 169 GetMediaCrypto())) { |
| 170 media_codec_bridge_.reset(); | 170 media_codec_bridge_.reset(); |
| 171 return STATUS_FAILURE; | 171 return STATUS_FAILURE; |
| 172 } | 172 } |
| 173 | 173 |
| 174 SetVolumeInternal(); | 174 SetVolumeInternal(); |
| 175 | 175 |
| 176 // Reset values used to track codec bridge output | 176 // Reset values used to track codec bridge output |
| 177 frame_count_ = 0; | 177 frame_count_ = 0; |
| 178 ResetTimestampHelper(); | 178 ResetTimestampHelper(); |
| 179 | 179 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 190 void AudioDecoderJob::OnOutputFormatChanged() { | 190 void AudioDecoderJob::OnOutputFormatChanged() { |
| 191 DCHECK(media_codec_bridge_); | 191 DCHECK(media_codec_bridge_); |
| 192 | 192 |
| 193 int old_sampling_rate = output_sampling_rate_; | 193 int old_sampling_rate = output_sampling_rate_; |
| 194 output_sampling_rate_ = media_codec_bridge_->GetOutputSamplingRate(); | 194 output_sampling_rate_ = media_codec_bridge_->GetOutputSamplingRate(); |
| 195 if (output_sampling_rate_ != old_sampling_rate) | 195 if (output_sampling_rate_ != old_sampling_rate) |
| 196 ResetTimestampHelper(); | 196 ResetTimestampHelper(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace media | 199 } // namespace media |
| OLD | NEW |