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" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 curr.audio_extra_data.size() != next.audio_extra_data.size() || | 100 curr.audio_extra_data.size() != next.audio_extra_data.size() || |
101 !std::equal(curr.audio_extra_data.begin(), curr.audio_extra_data.end(), | 101 !std::equal(curr.audio_extra_data.begin(), curr.audio_extra_data.end(), |
102 next.audio_extra_data.begin()); | 102 next.audio_extra_data.begin()); |
103 } | 103 } |
104 | 104 |
105 MediaCodecDecoder::ConfigStatus MediaCodecAudioDecoder::ConfigureInternal() { | 105 MediaCodecDecoder::ConfigStatus MediaCodecAudioDecoder::ConfigureInternal() { |
106 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 106 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
107 | 107 |
108 DVLOG(1) << class_name() << "::" << __FUNCTION__; | 108 DVLOG(1) << class_name() << "::" << __FUNCTION__; |
109 | 109 |
| 110 if (configs_.audio_codec == kUnknownAudioCodec) { |
| 111 DVLOG(0) << class_name() << "::" << __FUNCTION__ |
| 112 << " configuration parameters are required"; |
| 113 return CONFIG_FAILURE; |
| 114 } |
| 115 |
110 media_codec_bridge_.reset(AudioCodecBridge::Create(configs_.audio_codec)); | 116 media_codec_bridge_.reset(AudioCodecBridge::Create(configs_.audio_codec)); |
111 if (!media_codec_bridge_) | 117 if (!media_codec_bridge_) |
112 return CONFIG_FAILURE; | 118 return CONFIG_FAILURE; |
113 | 119 |
114 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) | 120 if (!(static_cast<AudioCodecBridge*>(media_codec_bridge_.get())) |
115 ->Start( | 121 ->Start( |
116 configs_.audio_codec, | 122 configs_.audio_codec, |
117 configs_.audio_sampling_rate, | 123 configs_.audio_sampling_rate, |
118 configs_.audio_channels, | 124 configs_.audio_channels, |
119 &configs_.audio_extra_data[0], | 125 &configs_.audio_extra_data[0], |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (audio_timestamp_helper_) | 213 if (audio_timestamp_helper_) |
208 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); | 214 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); |
209 | 215 |
210 audio_timestamp_helper_.reset( | 216 audio_timestamp_helper_.reset( |
211 new AudioTimestampHelper(configs_.audio_sampling_rate)); | 217 new AudioTimestampHelper(configs_.audio_sampling_rate)); |
212 | 218 |
213 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); | 219 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); |
214 } | 220 } |
215 | 221 |
216 } // namespace media | 222 } // namespace media |
OLD | NEW |