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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 7932005: Reland r101418: Fix aspect ratio and clarify video frame dimensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 4920a17fe71e08a03ddc5cdabb2b84d7b5b82800..9bc9beae51c5be16c99ed1e931dc4ee167258703 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -17,6 +17,7 @@
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/video/ffmpeg_video_decode_engine.h"
#include "media/video/video_decode_context.h"
+#include "ui/gfx/rect.h"
namespace media {
@@ -69,23 +70,25 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
pts_stream_.Initialize(GetFrameDuration(av_stream));
- int width = av_stream->codec->coded_width;
- int height = av_stream->codec->coded_height;
-
- int surface_width = GetSurfaceWidth(av_stream);
- int surface_height = GetSurfaceHeight(av_stream);
-
- if (surface_width > Limits::kMaxDimension ||
- surface_height > Limits::kMaxDimension ||
- (surface_width * surface_height) > Limits::kMaxCanvas) {
+ gfx::Size coded_size(
+ av_stream->codec->coded_width, av_stream->codec->coded_height);
+ // TODO(vrk): This assumes decoded frame data starts at (0, 0), which is true
+ // for now, but may not always be true forever. Fix this in the future.
+ gfx::Rect visible_rect(
+ av_stream->codec->width, av_stream->codec->height);
+ gfx::Size natural_size(
+ GetNaturalWidth(av_stream), GetNaturalHeight(av_stream));
+
+ if (natural_size.width() > Limits::kMaxDimension ||
+ natural_size.height() > Limits::kMaxDimension ||
+ natural_size.GetArea() > Limits::kMaxCanvas) {
VideoCodecInfo info = {0};
OnInitializeComplete(info);
return;
}
VideoDecoderConfig config(CodecIDToVideoCodec(av_stream->codec->codec_id),
- width, height,
- surface_width, surface_height,
+ coded_size, visible_rect, natural_size,
av_stream->r_frame_rate.num,
av_stream->r_frame_rate.den,
av_stream->codec->extradata,
@@ -339,14 +342,9 @@ void FFmpegVideoDecoder::ProduceVideoSample(
this));
}
-int FFmpegVideoDecoder::width() {
- DCHECK(info_.success);
- return info_.surface_width;
-}
-
-int FFmpegVideoDecoder::height() {
+gfx::Size FFmpegVideoDecoder::natural_size() {
DCHECK(info_.success);
- return info_.surface_height;
+ return info_.natural_size;
}
void FFmpegVideoDecoder::FlushBuffers() {
« 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