summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-02 03:15:28 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-02 03:15:28 +0000
commitf535217b5fc3d569ac2f18fd2a5177a85e934239 (patch)
treecac39d4b03b19c0f4bc2dfdb4bf0eb33a28fb49b /media
parentf649bf548e4cbc6bfa0ab853ea2b0a9d8183fa2b (diff)
downloadchromium_src-f535217b5fc3d569ac2f18fd2a5177a85e934239.zip
chromium_src-f535217b5fc3d569ac2f18fd2a5177a85e934239.tar.gz
chromium_src-f535217b5fc3d569ac2f18fd2a5177a85e934239.tar.bz2
Revert 87578 - Respect pixel aspect ratio of video if it contains one.
BUG=18941 TEST=Check correct AR on http://people.xiph.org/~giles/2009/celt-aspect.html Alternately, fix 59412 and run media/video-display-aspect-ratio layout test Review URL: http://codereview.chromium.org/7086002 TBR=scottfr@chromium.org Review URL: http://codereview.chromium.org/7109002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87579 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/video_decoder_config.cc12
-rw-r--r--media/base/video_decoder_config.h7
-rw-r--r--media/ffmpeg/ffmpeg_common.cc21
-rw-r--r--media/ffmpeg/ffmpeg_common.h6
-rw-r--r--media/filters/ffmpeg_video_decoder.cc11
-rw-r--r--media/filters/omx_video_decoder.cc11
-rw-r--r--media/video/ffmpeg_video_decode_engine.cc4
-rw-r--r--media/video/ffmpeg_video_decode_engine_unittest.cc4
8 files changed, 9 insertions, 67 deletions
diff --git a/media/base/video_decoder_config.cc b/media/base/video_decoder_config.cc
index 5ec7c02d..abcd80b 100644
--- a/media/base/video_decoder_config.cc
+++ b/media/base/video_decoder_config.cc
@@ -11,8 +11,6 @@ namespace media {
VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
int width,
int height,
- int surface_width,
- int surface_height,
int frame_rate_numerator,
int frame_rate_denominator,
uint8* extra_data,
@@ -20,8 +18,6 @@ VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
: codec_(codec),
width_(width),
height_(height),
- surface_width_(surface_width),
- surface_height_(surface_height),
frame_rate_numerator_(frame_rate_numerator),
frame_rate_denominator_(frame_rate_denominator),
extra_data_size_(extra_data_size) {
@@ -46,14 +42,6 @@ int VideoDecoderConfig::height() const {
return height_;
}
-int VideoDecoderConfig::surface_width() const {
- return surface_width_;
-}
-
-int VideoDecoderConfig::surface_height() const {
- return surface_height_;
-}
-
int VideoDecoderConfig::frame_rate_numerator() const {
return frame_rate_numerator_;
}
diff --git a/media/base/video_decoder_config.h b/media/base/video_decoder_config.h
index 011efbf..9ce582b 100644
--- a/media/base/video_decoder_config.h
+++ b/media/base/video_decoder_config.h
@@ -23,7 +23,6 @@ enum VideoCodec {
class VideoDecoderConfig {
public:
VideoDecoderConfig(VideoCodec codec, int width, int height,
- int surface_width, int surface_height,
int frame_rate_numerator, int frame_rate_denominator,
uint8* extra_data, size_t extra_data_size);
~VideoDecoderConfig();
@@ -31,8 +30,6 @@ class VideoDecoderConfig {
VideoCodec codec() const;
int width() const;
int height() const;
- int surface_width() const;
- int surface_height() const;
int frame_rate_numerator() const;
int frame_rate_denominator() const;
uint8* extra_data() const;
@@ -45,10 +42,6 @@ class VideoDecoderConfig {
int width_;
int height_;
- // Width and height of the display surface for this video.
- int surface_width_;
- int surface_height_;
-
// Frame rate in seconds expressed as a fraction.
// TODO(scherkus): fairly certain decoders don't require frame rates.
int frame_rate_numerator_;
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 2ccd4eb..dedc40c 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -185,25 +185,4 @@ bool GetStreamByteCountOverRange(AVStream* stream,
return true;
}
-int GetSurfaceHeight(AVStream* stream) {
- return stream->codec->coded_height;
-}
-
-int GetSurfaceWidth(AVStream* stream) {
- double aspect_ratio;
-
- if (stream->sample_aspect_ratio.num)
- aspect_ratio = av_q2d(stream->sample_aspect_ratio);
- else if (stream->codec->sample_aspect_ratio.num)
- aspect_ratio = av_q2d(stream->codec->sample_aspect_ratio);
- else
- aspect_ratio = 1.0;
-
- int width = floor(stream->codec->coded_width * aspect_ratio + 0.5);
-
- // An even width makes things easier for YV12 and appears to be the behavior
- // expected by WebKit layout tests.
- return width & ~1;
-}
-
} // namespace media
diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
index 07daae1..3d39d52 100644
--- a/media/ffmpeg/ffmpeg_common.h
+++ b/media/ffmpeg/ffmpeg_common.h
@@ -103,12 +103,6 @@ bool GetStreamByteCountOverRange(AVStream* stream,
int64* bytes,
base::TimeDelta* range_start,
base::TimeDelta* range_end);
-
-// Calculates the width and height of the video surface using the video's
-// encoded dimensions and sample_aspect_ratio.
-int GetSurfaceHeight(AVStream* stream);
-int GetSurfaceWidth(AVStream* stream);
-
} // namespace media
#endif // MEDIA_FFMPEG_FFMPEG_COMMON_H_
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 53d28a2..5487398 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -64,13 +64,9 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_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) {
+ if (width > Limits::kMaxDimension ||
+ height > Limits::kMaxDimension ||
+ (width * height) > Limits::kMaxCanvas) {
VideoCodecInfo info = {0};
OnInitializeComplete(info);
return;
@@ -78,7 +74,6 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
VideoDecoderConfig config(CodecIDToVideoCodec(av_stream->codec->codec_id),
width, height,
- surface_width, surface_height,
av_stream->r_frame_rate.num,
av_stream->r_frame_rate.den,
av_stream->codec->extradata,
diff --git a/media/filters/omx_video_decoder.cc b/media/filters/omx_video_decoder.cc
index b58e1c6..b185965 100644
--- a/media/filters/omx_video_decoder.cc
+++ b/media/filters/omx_video_decoder.cc
@@ -64,13 +64,9 @@ void OmxVideoDecoder::Initialize(DemuxerStream* demuxer_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) {
+ if (width > Limits::kMaxDimension ||
+ height > Limits::kMaxDimension ||
+ (width * height) > Limits::kMaxCanvas) {
VideoCodecInfo info = {0};
OnInitializeComplete(info);
return;
@@ -78,7 +74,6 @@ void OmxVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
VideoDecoderConfig config(CodecIDToVideoCodec(av_stream->codec->codec_id),
width, height,
- surface_width, surface_height,
av_stream->r_frame_rate.num,
av_stream->r_frame_rate.den,
av_stream->codec->extradata,
diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc
index c1e1d63..0413092 100644
--- a/media/video/ffmpeg_video_decode_engine.cc
+++ b/media/video/ffmpeg_video_decode_engine.cc
@@ -117,8 +117,8 @@ void FFmpegVideoDecodeEngine::Initialize(
info.provides_buffers = true;
info.stream_info.surface_type = VideoFrame::TYPE_SYSTEM_MEMORY;
info.stream_info.surface_format = GetSurfaceFormat();
- info.stream_info.surface_width = config.surface_width();
- info.stream_info.surface_height = config.surface_height();
+ info.stream_info.surface_width = config.width();
+ info.stream_info.surface_height = config.height();
// If we do not have enough buffers, we will report error too.
bool buffer_allocated = true;
diff --git a/media/video/ffmpeg_video_decode_engine_unittest.cc b/media/video/ffmpeg_video_decode_engine_unittest.cc
index 2589289..8a53f6d 100644
--- a/media/video/ffmpeg_video_decode_engine_unittest.cc
+++ b/media/video/ffmpeg_video_decode_engine_unittest.cc
@@ -23,8 +23,6 @@ namespace media {
static const int kWidth = 320;
static const int kHeight = 240;
-static const int kSurfaceWidth = 522;
-static const int kSurfaceHeight = 288;
static const AVRational kFrameRate = { 100, 1 };
static void InitializeFrame(uint8_t* data, int width, AVFrame* frame) {
@@ -52,7 +50,7 @@ class FFmpegVideoDecodeEngineTest : public testing::Test,
public VideoDecodeEngine::EventHandler {
public:
FFmpegVideoDecodeEngineTest()
- : config_(kCodecH264, kWidth, kHeight, kSurfaceWidth, kSurfaceHeight,
+ : config_(kCodecH264, kWidth, kHeight,
kFrameRate.num, kFrameRate.den, NULL, 0) {
// Setup FFmpeg structures.