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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 2534193003: To M56: Roll src/third_party/ffmpeg/ 3c7a09882..cdf4accee (3188 commits). (Closed)
Patch Set: Created 4 years 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
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/filters/ffmpeg_audio_decoder.h" 5 #include "media/filters/ffmpeg_audio_decoder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 av_frame_.reset(); 385 av_frame_.reset();
386 } 386 }
387 387
388 bool FFmpegAudioDecoder::ConfigureDecoder() { 388 bool FFmpegAudioDecoder::ConfigureDecoder() {
389 DCHECK(config_.IsValidConfig()); 389 DCHECK(config_.IsValidConfig());
390 DCHECK(!config_.is_encrypted()); 390 DCHECK(!config_.is_encrypted());
391 391
392 // Release existing decoder resources if necessary. 392 // Release existing decoder resources if necessary.
393 ReleaseFFmpegResources(); 393 ReleaseFFmpegResources();
394 394
395 // Use OpusAudioDecoder for Opus for now, even if FFmpeg claims to support
396 // Opus decode. Failure to configure here should lead to fall-back to
397 // OpusAudioDecoder.
398 // TODO(wolenetz,dalecurtis): Remove OpusAudioDecoder and use
399 // FFmpegAudioDecoder instead for Opus.
400 if (config_.codec() == kCodecOpus) {
401 MEDIA_LOG(DEBUG, media_log_)
402 << "Opus decode via FFmpegAudioDecoder is disabled";
403 state_ = kUninitialized;
404 return false;
405 }
406
395 // Initialize AVCodecContext structure. 407 // Initialize AVCodecContext structure.
396 codec_context_.reset(avcodec_alloc_context3(NULL)); 408 codec_context_.reset(avcodec_alloc_context3(NULL));
397 AudioDecoderConfigToAVCodecContext(config_, codec_context_.get()); 409 AudioDecoderConfigToAVCodecContext(config_, codec_context_.get());
398 410
399 codec_context_->opaque = this; 411 codec_context_->opaque = this;
400 codec_context_->get_buffer2 = GetAudioBuffer; 412 codec_context_->get_buffer2 = GetAudioBuffer;
401 codec_context_->refcounted_frames = 1; 413 codec_context_->refcounted_frames = 1;
402 414
403 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); 415 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
404 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { 416 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
(...skipping 23 matching lines...) Expand all
428 return true; 440 return true;
429 } 441 }
430 442
431 void FFmpegAudioDecoder::ResetTimestampState() { 443 void FFmpegAudioDecoder::ResetTimestampState() {
432 discard_helper_.reset(new AudioDiscardHelper(config_.samples_per_second(), 444 discard_helper_.reset(new AudioDiscardHelper(config_.samples_per_second(),
433 config_.codec_delay())); 445 config_.codec_delay()));
434 discard_helper_->Reset(config_.codec_delay()); 446 discard_helper_->Reset(config_.codec_delay());
435 } 447 }
436 448
437 } // namespace media 449 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_aac_bitstream_converter_unittest.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698