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/audio_media_codec_decoder.h" | 5 #include "media/base/android/audio_media_codec_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_statistics.h" | 9 #include "media/base/android/media_statistics.h" |
10 #include "media/base/android/sdk_media_codec_bridge.h" | 10 #include "media/base/android/sdk_media_codec_bridge.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 configs_.audio_seek_preroll_ns, true, media_crypto)) { | 152 configs_.audio_seek_preroll_ns, true, media_crypto)) { |
153 DVLOG(0) << class_name() << "::" << __FUNCTION__ | 153 DVLOG(0) << class_name() << "::" << __FUNCTION__ |
154 << " failed: cannot start audio codec"; | 154 << " failed: cannot start audio codec"; |
155 | 155 |
156 media_codec_bridge_.reset(); | 156 media_codec_bridge_.reset(); |
157 return kConfigFailure; | 157 return kConfigFailure; |
158 } | 158 } |
159 | 159 |
160 DVLOG(0) << class_name() << "::" << __FUNCTION__ << " succeeded"; | 160 DVLOG(0) << class_name() << "::" << __FUNCTION__ << " succeeded"; |
161 | 161 |
| 162 // ConfigureAndStart() creates AudioTrack with sampling rate and channel count |
| 163 // from |configs_|. Keep |output_...| in sync to detect the changes that might |
| 164 // come with OnOutputFormatChanged(). |
| 165 output_sampling_rate_ = configs_.audio_sampling_rate; |
| 166 output_num_channels_ = configs_.audio_channels; |
| 167 |
162 SetVolumeInternal(); | 168 SetVolumeInternal(); |
163 | 169 |
164 frame_count_ = 0; | 170 frame_count_ = 0; |
165 ResetTimestampHelper(); | 171 ResetTimestampHelper(); |
166 | 172 |
167 if (!codec_created_for_tests_cb_.is_null()) | 173 if (!codec_created_for_tests_cb_.is_null()) |
168 media_task_runner_->PostTask(FROM_HERE, codec_created_for_tests_cb_); | 174 media_task_runner_->PostTask(FROM_HERE, codec_created_for_tests_cb_); |
169 | 175 |
170 return kConfigOk; | 176 return kConfigOk; |
171 } | 177 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 if (audio_timestamp_helper_) | 327 if (audio_timestamp_helper_) |
322 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); | 328 base_timestamp_ = audio_timestamp_helper_->GetTimestamp(); |
323 | 329 |
324 audio_timestamp_helper_.reset( | 330 audio_timestamp_helper_.reset( |
325 new AudioTimestampHelper(output_sampling_rate_)); | 331 new AudioTimestampHelper(output_sampling_rate_)); |
326 | 332 |
327 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); | 333 audio_timestamp_helper_->SetBaseTimestamp(base_timestamp_); |
328 } | 334 } |
329 | 335 |
330 } // namespace media | 336 } // namespace media |
OLD | NEW |