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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 10824141: Remove VideoDecoder::natural_size() & added VideoFrame::natural_size(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright year. Created 8 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index c2d34c28d0b77d57d31f5a8121c75ca587c6ef7e..f8931e0eae42dcd17a83f995ae7da063f737f76c 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -75,14 +75,22 @@ int FFmpegVideoDecoder::GetVideoBuffer(AVCodecContext* codec_context,
return AVERROR(EINVAL);
DCHECK(format == VideoFrame::YV12 || format == VideoFrame::YV16);
- int width = codec_context->width;
- int height = codec_context->height;
+ gfx::Size size(codec_context->width, codec_context->height);
int ret;
- if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
+ if ((ret = av_image_check_size(size.width(), size.height(), 0, NULL)) < 0)
return ret;
+ gfx::Size natural_size;
+ if (codec_context->sample_aspect_ratio.num > 0) {
+ natural_size = GetNaturalSize(size,
+ codec_context->sample_aspect_ratio.num,
+ codec_context->sample_aspect_ratio.den);
+ } else {
+ natural_size = demuxer_stream_->video_decoder_config().natural_size();
+ }
+
scoped_refptr<VideoFrame> video_frame =
- VideoFrame::CreateFrame(format, width, height, kNoTimestamp());
+ VideoFrame::CreateFrame(format, size, natural_size, kNoTimestamp());
for (int i = 0; i < 3; i++) {
frame->base[i] = video_frame->data(i);
@@ -185,7 +193,6 @@ void FFmpegVideoDecoder::Initialize(const scoped_refptr<DemuxerStream>& stream,
// Success!
state_ = kNormal;
av_frame_ = avcodec_alloc_frame();
- natural_size_ = config.natural_size();
status_cb.Run(PIPELINE_OK);
}
@@ -243,10 +250,6 @@ void FFmpegVideoDecoder::DoStop() {
base::ResetAndReturn(&stop_cb_).Run();
}
-const gfx::Size& FFmpegVideoDecoder::natural_size() {
- return natural_size_;
-}
-
void FFmpegVideoDecoder::set_decryptor(Decryptor* decryptor) {
DCHECK_EQ(state_, kUninitialized);
decryptor_ = decryptor;
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698