summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 00:08:58 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 00:08:58 +0000
commit439d75cecba1d3947b405c07b41e3986091b688b (patch)
treebdc58eb63739fefa62ea9332dd6f3d657a1ba66f /media
parent143029c5a5295f9d4cad41b91278a0835cad480a (diff)
downloadchromium_src-439d75cecba1d3947b405c07b41e3986091b688b.zip
chromium_src-439d75cecba1d3947b405c07b41e3986091b688b.tar.gz
chromium_src-439d75cecba1d3947b405c07b41e3986091b688b.tar.bz2
Fix ASAN error in FFmpegVideoDecodeEngineTest.DecodeFrame_SmallerHeight introduced in r103961.
VideoFrame dimensions don't change while AVCodecContext dimensions do, so make sure we keep using AVCodecContext for all dimension calculations for now. Review URL: http://codereview.chromium.org/8133011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104035 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/video/ffmpeg_video_decode_engine.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc
index 46c02d9..0fe4810 100644
--- a/media/video/ffmpeg_video_decode_engine.cc
+++ b/media/video/ffmpeg_video_decode_engine.cc
@@ -107,12 +107,15 @@ void FFmpegVideoDecodeEngine::Initialize(
// Create output buffer pool when direct rendering is not used.
for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) {
+ VideoFrame::Format format =
+ PixelFormatToVideoFormat(codec_context_->pix_fmt);
+
scoped_refptr<VideoFrame> video_frame =
- VideoFrame::CreateFrame(PixelFormatToVideoFormat(codec_context_->pix_fmt),
- config.visible_rect().width(),
- config.visible_rect().height(),
- kNoTimestamp,
- kNoTimestamp);
+ VideoFrame::CreateFrame(format,
+ config.visible_rect().width(),
+ config.visible_rect().height(),
+ kNoTimestamp,
+ kNoTimestamp);
frame_queue_available_.push_back(video_frame);
}
@@ -241,8 +244,14 @@ void FFmpegVideoDecodeEngine::DecodeFrame(scoped_refptr<Buffer> buffer) {
// 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): use VideoFrame dimensions instead and re-allocate
+ // VideoFrame if dimensions changes, but for now adjust size locally.
int y_rows = codec_context_->height;
- int uv_rows = video_frame->rows(VideoFrame::kUPlane);
+ int uv_rows = codec_context_->height;
+ if (codec_context_->pix_fmt == PIX_FMT_YUV420P) {
+ uv_rows /= 2;
+ }
CopyYPlane(av_frame_->data[0], av_frame_->linesize[0], y_rows, video_frame);
CopyUPlane(av_frame_->data[1], av_frame_->linesize[1], uv_rows, video_frame);