OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // as it's valid, the true sample format is selected inside the decoder. | 291 // as it's valid, the true sample format is selected inside the decoder. |
292 sample_format = kSampleFormatF32; | 292 sample_format = kSampleFormatF32; |
293 } | 293 } |
294 | 294 |
295 base::TimeDelta seek_preroll; | 295 base::TimeDelta seek_preroll; |
296 if (codec_context->seek_preroll > 0) { | 296 if (codec_context->seek_preroll > 0) { |
297 seek_preroll = base::TimeDelta::FromMicroseconds( | 297 seek_preroll = base::TimeDelta::FromMicroseconds( |
298 codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate); | 298 codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate); |
299 } | 299 } |
300 | 300 |
| 301 base::TimeDelta codec_delay; |
| 302 if (codec_context->delay > 0) { |
| 303 codec_delay = base::TimeDelta::FromMicroseconds( |
| 304 codec_context->delay * 1000000.0 / codec_context->sample_rate); |
| 305 } |
| 306 |
301 config->Initialize(codec, | 307 config->Initialize(codec, |
302 sample_format, | 308 sample_format, |
303 channel_layout, | 309 channel_layout, |
304 codec_context->sample_rate, | 310 codec_context->sample_rate, |
305 codec_context->extradata, | 311 codec_context->extradata, |
306 codec_context->extradata_size, | 312 codec_context->extradata_size, |
307 is_encrypted, | 313 is_encrypted, |
308 record_stats, | 314 record_stats, |
309 seek_preroll, | 315 seek_preroll, |
310 codec_context->delay); | 316 codec_delay); |
311 if (codec != kCodecOpus) { | 317 if (codec != kCodecOpus) { |
312 DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, | 318 DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, |
313 config->bits_per_channel()); | 319 config->bits_per_channel()); |
314 } | 320 } |
315 } | 321 } |
316 | 322 |
317 void AVStreamToAudioDecoderConfig( | 323 void AVStreamToAudioDecoderConfig( |
318 const AVStream* stream, | 324 const AVStream* stream, |
319 AudioDecoderConfig* config, | 325 AudioDecoderConfig* config, |
320 bool record_stats) { | 326 bool record_stats) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 return false; | 578 return false; |
573 | 579 |
574 *out = parsed_time; | 580 *out = parsed_time; |
575 return true; | 581 return true; |
576 } | 582 } |
577 | 583 |
578 return false; | 584 return false; |
579 } | 585 } |
580 | 586 |
581 } // namespace media | 587 } // namespace media |
OLD | NEW |