| Index: media/video/ffmpeg_video_decode_engine.cc
|
| diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc
|
| index 65edc2fc2d4a8dd6af8c789824e7096c72239231..d2f7b3f7521a80a479140a927e9c373f76653b6a 100644
|
| --- a/media/video/ffmpeg_video_decode_engine.cc
|
| +++ b/media/video/ffmpeg_video_decode_engine.cc
|
| @@ -56,9 +56,7 @@ void FFmpegVideoDecodeEngine::Initialize(
|
|
|
| // Initialize AVCodecContext structure.
|
| codec_context_ = avcodec_alloc_context();
|
| -
|
| - // TODO(scherkus): should video format get passed in via VideoDecoderConfig?
|
| - codec_context_->pix_fmt = PIX_FMT_YUV420P;
|
| + codec_context_->pix_fmt = VideoFormatToPixelFormat(config.video_format());
|
| codec_context_->codec_type = AVMEDIA_TYPE_VIDEO;
|
| codec_context_->codec_id = VideoCodecToCodecID(config.codec());
|
| codec_context_->coded_width = config.coded_size().width();
|
| @@ -112,11 +110,11 @@ void FFmpegVideoDecodeEngine::Initialize(
|
| // Create output buffer pool when direct rendering is not used.
|
| for (size_t i = 0; i < Limits::kMaxVideoFrames; ++i) {
|
| scoped_refptr<VideoFrame> video_frame =
|
| - VideoFrame::CreateFrame(VideoFrame::YV12,
|
| - config.visible_rect().width(),
|
| - config.visible_rect().height(),
|
| - kNoTimestamp,
|
| - kNoTimestamp);
|
| + VideoFrame::CreateFrame(PixelFormatToVideoFormat(codec_context_->pix_fmt),
|
| + config.visible_rect().width(),
|
| + config.visible_rect().height(),
|
| + kNoTimestamp,
|
| + kNoTimestamp);
|
| frame_queue_available_.push_back(video_frame);
|
| }
|
|
|
| @@ -250,7 +248,8 @@ void FFmpegVideoDecodeEngine::DecodeFrame(scoped_refptr<Buffer> buffer) {
|
| // output, meaning the data is only valid until the next
|
| // avcodec_decode_video() call.
|
| int y_rows = codec_context_->height;
|
| - int uv_rows = codec_context_->height / 2;
|
| + int uv_rows = video_frame->rows(VideoFrame::kUPlane);
|
| +
|
| 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);
|
| CopyVPlane(av_frame_->data[2], av_frame_->linesize[2], uv_rows, video_frame);
|
|
|