diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 00:35:55 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 00:35:55 +0000 |
commit | 8624ef98b5564b398429b90fcc34cafe232c7e90 (patch) | |
tree | 45a8c82c4ea62eefd2505604264aaf04a3b69a2a /media | |
parent | d9ad8baa4e77fd602f87881db9b7432206a7143f (diff) | |
download | chromium_src-8624ef98b5564b398429b90fcc34cafe232c7e90.zip chromium_src-8624ef98b5564b398429b90fcc34cafe232c7e90.tar.gz chromium_src-8624ef98b5564b398429b90fcc34cafe232c7e90.tar.bz2 |
Relax decoding error handling requirements.
Set the error_recognition and error_concealment flags in the codec context similar to ffplay.c. Also silently drops frames that didn't decode properly instead of stops the entire pipeline.
Review URL: http://codereview.chromium.org/113653
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/ffmpeg_video_decoder.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index 89d44df..6d5505a4 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -57,6 +57,10 @@ bool FFmpegVideoDecoder::OnInitialize(DemuxerStream* demuxer_stream) { codec_context_ = ffmpeg_demuxer_stream->av_stream()->codec; codec_context_->flags2 |= CODEC_FLAG2_FAST; // Enable faster H264 decode. + // Enable motion vector search (potentially slow), strong deblocking filter + // for damaged macroblocks, and set our error detection sensitivity. + codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; + codec_context_->error_recognition = FF_ER_CAREFUL; AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); if (!codec || avcodec_thread_init(codec_context_, kDecodeThreads) < 0 || @@ -89,14 +93,21 @@ void FFmpegVideoDecoder::OnDecode(Buffer* buffer) { int result = avcodec_decode_video(codec_context_, yuv_frame.get(), &decoded, data_in, size_in); + // Log the problem if we can't decode a video frame. if (result < 0) { - host_->Error(PIPELINE_ERROR_DECODE); - return; + LOG(INFO) << "Error decoding a video frame with timestamp: " + << buffer->GetTimestamp().InMicroseconds() << " us" + << " , duration: " + << buffer->GetDuration().InMicroseconds() << " us" + << " , packet size: " + << buffer->GetDataSize() << " bytes"; } - if (result == 0 || decoded == 0) { + // Check for a decoded frame instead of checking the return value of + // avcodec_decode_video(). We don't need to stop the pipeline on + // decode errors. + if (!decoded) return; - } // J (Motion JPEG) versions of YUV are full range 0..255. // Regular (MPEG) YUV is 16..240. |