Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 239423005: Wire up codec_delay() to MP3StreamParser and FFmpegAudioDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch codec_delay() to frames. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // as it's valid, the true sample format is selected inside the decoder. 290 // as it's valid, the true sample format is selected inside the decoder.
291 sample_format = kSampleFormatF32; 291 sample_format = kSampleFormatF32;
292 } 292 }
293 293
294 base::TimeDelta seek_preroll; 294 base::TimeDelta seek_preroll;
295 if (codec_context->seek_preroll > 0) { 295 if (codec_context->seek_preroll > 0) {
296 seek_preroll = base::TimeDelta::FromMicroseconds( 296 seek_preroll = base::TimeDelta::FromMicroseconds(
297 codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate); 297 codec_context->seek_preroll * 1000000.0 / codec_context->sample_rate);
298 } 298 }
299 299
300 base::TimeDelta codec_delay;
301 if (codec_context->delay > 0) {
302 codec_delay = base::TimeDelta::FromMicroseconds(
303 codec_context->delay * 1000000.0 / codec_context->sample_rate);
304 }
305
306 config->Initialize(codec, 300 config->Initialize(codec,
307 sample_format, 301 sample_format,
308 channel_layout, 302 channel_layout,
309 codec_context->sample_rate, 303 codec_context->sample_rate,
310 codec_context->extradata, 304 codec_context->extradata,
311 codec_context->extradata_size, 305 codec_context->extradata_size,
312 is_encrypted, 306 is_encrypted,
313 record_stats, 307 record_stats,
314 seek_preroll, 308 seek_preroll,
315 codec_delay); 309 codec_context->delay);
316 if (codec != kCodecOpus) { 310 if (codec != kCodecOpus) {
317 DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, 311 DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8,
318 config->bits_per_channel()); 312 config->bits_per_channel());
319 } 313 }
320 } 314 }
321 315
322 void AVStreamToAudioDecoderConfig( 316 void AVStreamToAudioDecoderConfig(
323 const AVStream* stream, 317 const AVStream* stream,
324 AudioDecoderConfig* config, 318 AudioDecoderConfig* config,
325 bool record_stats) { 319 bool record_stats) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 return PIX_FMT_YUVJ420P; 538 return PIX_FMT_YUVJ420P;
545 case VideoFrame::YV12A: 539 case VideoFrame::YV12A:
546 return PIX_FMT_YUVA420P; 540 return PIX_FMT_YUVA420P;
547 default: 541 default:
548 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format; 542 DVLOG(1) << "Unsupported VideoFrame::Format: " << video_format;
549 } 543 }
550 return PIX_FMT_NONE; 544 return PIX_FMT_NONE;
551 } 545 }
552 546
553 } // namespace media 547 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698