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 | |
307 config->Initialize(codec, | 301 config->Initialize(codec, |
308 sample_format, | 302 sample_format, |
309 channel_layout, | 303 channel_layout, |
310 codec_context->sample_rate, | 304 codec_context->sample_rate, |
311 codec_context->extradata, | 305 codec_context->extradata, |
312 codec_context->extradata_size, | 306 codec_context->extradata_size, |
313 is_encrypted, | 307 is_encrypted, |
314 record_stats, | 308 record_stats, |
315 seek_preroll, | 309 seek_preroll, |
316 codec_delay); | 310 codec_context->delay); |
317 if (codec != kCodecOpus) { | 311 if (codec != kCodecOpus) { |
318 DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, | 312 DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, |
319 config->bits_per_channel()); | 313 config->bits_per_channel()); |
320 } | 314 } |
321 } | 315 } |
322 | 316 |
323 void AVStreamToAudioDecoderConfig( | 317 void AVStreamToAudioDecoderConfig( |
324 const AVStream* stream, | 318 const AVStream* stream, |
325 AudioDecoderConfig* config, | 319 AudioDecoderConfig* config, |
326 bool record_stats) { | 320 bool record_stats) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 return false; | 572 return false; |
579 | 573 |
580 *out = parsed_time; | 574 *out = parsed_time; |
581 return true; | 575 return true; |
582 } | 576 } |
583 | 577 |
584 return false; | 578 return false; |
585 } | 579 } |
586 | 580 |
587 } // namespace media | 581 } // namespace media |
OLD | NEW |