diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 05:44:07 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 05:44:07 +0000 |
commit | c9e07cc5bbce5f0cb177c86f98277794c69d93de (patch) | |
tree | 11902a0818c12c44b93ff89d08d259e09f770ce1 /media | |
parent | 874190c24578f3b6e41425b7b7d12df4a958c858 (diff) | |
download | chromium_src-c9e07cc5bbce5f0cb177c86f98277794c69d93de.zip chromium_src-c9e07cc5bbce5f0cb177c86f98277794c69d93de.tar.gz chromium_src-c9e07cc5bbce5f0cb177c86f98277794c69d93de.tar.bz2 |
Fix nested ifs and incorrect indentation in ffmpeg_video_decode_engine.cc.
No logic change, just inserting returns and de-nesting ifs.
BUG=none
TEST=media_unittests
Review URL: http://codereview.chromium.org/1735012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45788 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/ffmpeg_video_decode_engine.cc | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/media/filters/ffmpeg_video_decode_engine.cc b/media/filters/ffmpeg_video_decode_engine.cc index d13a247..15cddc3 100644 --- a/media/filters/ffmpeg_video_decode_engine.cc +++ b/media/filters/ffmpeg_video_decode_engine.cc @@ -122,47 +122,49 @@ void FFmpegVideoDecodeEngine::DecodeFrame( << " , packet size: " << buffer->GetDataSize() << " bytes"; *got_frame = false; - } else { - // If frame_decoded == 0, then no frame was produced. - *got_frame = frame_decoded != 0; - - if (*got_frame) { - // TODO(fbarchard): Work around for FFmpeg http://crbug.com/27675 - // The decoder is in a bad state and not decoding correctly. - // Checking for NULL avoids a crash in CopyPlane(). - if (!av_frame_->data[VideoFrame::kYPlane] || - !av_frame_->data[VideoFrame::kUPlane] || - !av_frame_->data[VideoFrame::kVPlane]) { - // TODO(jiesun): this is also an error case handled as normal. - *got_frame = false; - return; - } - - VideoFrame::CreateFrame(GetSurfaceFormat(), - codec_context_->width, - codec_context_->height, - StreamSample::kInvalidTimestamp, - StreamSample::kInvalidTimestamp, - video_frame); - if (!video_frame->get()) { - // TODO(jiesun): this is also an error case handled as normal. - *got_frame = false; - return; - } - - // Copy the frame data since FFmpeg reuses internal buffers for AVFrame - // output, meaning the data is only valid until the next - // avcodec_decode_video() call. - // TODO(scherkus): figure out pre-allocation/buffer cycling scheme. - // TODO(scherkus): is there a cleaner way to figure out the # of planes? - CopyPlane(VideoFrame::kYPlane, video_frame->get(), av_frame_.get()); - CopyPlane(VideoFrame::kUPlane, video_frame->get(), av_frame_.get()); - CopyPlane(VideoFrame::kVPlane, video_frame->get(), av_frame_.get()); - - DCHECK_LE(av_frame_->repeat_pict, 2); // Sanity check. - (*video_frame)->SetRepeatCount(av_frame_->repeat_pict); - } + return; + } + + // If frame_decoded == 0, then no frame was produced. + *got_frame = frame_decoded != 0; + if (!*got_frame) { + return; + } + + // TODO(fbarchard): Work around for FFmpeg http://crbug.com/27675 + // The decoder is in a bad state and not decoding correctly. + // Checking for NULL avoids a crash in CopyPlane(). + if (!av_frame_->data[VideoFrame::kYPlane] || + !av_frame_->data[VideoFrame::kUPlane] || + !av_frame_->data[VideoFrame::kVPlane]) { + // TODO(jiesun): this is also an error case handled as normal. + *got_frame = false; + return; } + + VideoFrame::CreateFrame(GetSurfaceFormat(), + codec_context_->width, + codec_context_->height, + StreamSample::kInvalidTimestamp, + StreamSample::kInvalidTimestamp, + video_frame); + if (!video_frame->get()) { + // TODO(jiesun): this is also an error case handled as normal. + *got_frame = false; + return; + } + + // Copy the frame data since FFmpeg reuses internal buffers for AVFrame + // output, meaning the data is only valid until the next + // avcodec_decode_video() call. + // TODO(scherkus): figure out pre-allocation/buffer cycling scheme. + // TODO(scherkus): is there a cleaner way to figure out the # of planes? + CopyPlane(VideoFrame::kYPlane, video_frame->get(), av_frame_.get()); + CopyPlane(VideoFrame::kUPlane, video_frame->get(), av_frame_.get()); + CopyPlane(VideoFrame::kVPlane, video_frame->get(), av_frame_.get()); + + DCHECK_LE(av_frame_->repeat_pict, 2); // Sanity check. + (*video_frame)->SetRepeatCount(av_frame_->repeat_pict); } void FFmpegVideoDecodeEngine::Flush(Task* done_cb) { |