diff options
author | vrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-19 20:18:33 +0000 |
---|---|---|
committer | vrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-19 20:18:33 +0000 |
commit | 2975fa5391dfd5c57def10929408d814c4acaf6d (patch) | |
tree | 32e17ca77ac82b2adf3e36b23f3f7b7918b6b509 /media/video/ffmpeg_video_decode_engine_unittest.cc | |
parent | ef03e1ded45fe5dff2b3a783b1be554b5064dfea (diff) | |
download | chromium_src-2975fa5391dfd5c57def10929408d814c4acaf6d.zip chromium_src-2975fa5391dfd5c57def10929408d814c4acaf6d.tar.gz chromium_src-2975fa5391dfd5c57def10929408d814c4acaf6d.tar.bz2 |
Reland r101418: Fix aspect ratio and clarify video frame dimensions
Fixes shared build errors for windows and linux.
BUG=18941,94861
TEST=shared builds compile
TBR=acolwell
Review URL: http://codereview.chromium.org/7932005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/video/ffmpeg_video_decode_engine_unittest.cc')
-rw-r--r-- | media/video/ffmpeg_video_decode_engine_unittest.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/media/video/ffmpeg_video_decode_engine_unittest.cc b/media/video/ffmpeg_video_decode_engine_unittest.cc index 0368e63..e8238ff 100644 --- a/media/video/ffmpeg_video_decode_engine_unittest.cc +++ b/media/video/ffmpeg_video_decode_engine_unittest.cc @@ -23,10 +23,9 @@ using ::testing::StrictMock; namespace media { -static const size_t kWidth = 320; -static const size_t kHeight = 240; -static const size_t kSurfaceWidth = 522; -static const size_t kSurfaceHeight = 288; +static const gfx::Size kCodedSize(320, 240); +static const gfx::Rect kVisibleRect(320, 240); +static const gfx::Size kNaturalSize(522, 288); static const AVRational kFrameRate = { 100, 1 }; ACTION_P2(DemuxComplete, engine, buffer) { @@ -38,12 +37,12 @@ class FFmpegVideoDecodeEngineTest public VideoDecodeEngine::EventHandler { public: FFmpegVideoDecodeEngineTest() - : config_(kCodecVP8, kWidth, kHeight, kSurfaceWidth, kSurfaceHeight, + : config_(kCodecVP8, kCodedSize, kVisibleRect, kNaturalSize, kFrameRate.num, kFrameRate.den, NULL, 0) { CHECK(FFmpegGlue::GetInstance()); // Setup FFmpeg structures. - frame_buffer_.reset(new uint8[kWidth * kHeight]); + frame_buffer_.reset(new uint8[kCodedSize.GetArea()]); test_engine_.reset(new FFmpegVideoDecodeEngine()); @@ -105,10 +104,13 @@ class FFmpegVideoDecodeEngineTest CallProduceVideoFrame(); CallProduceVideoFrame(); - EXPECT_EQ(kSurfaceWidth, video_frame_a->width()); - EXPECT_EQ(kSurfaceHeight, video_frame_a->height()); - EXPECT_EQ(kSurfaceWidth, video_frame_b->width()); - EXPECT_EQ(kSurfaceHeight, video_frame_b->height()); + size_t expected_width = static_cast<size_t>(kVisibleRect.width()); + size_t expected_height = static_cast<size_t>(kVisibleRect.height()); + + EXPECT_EQ(expected_width, video_frame_a->width()); + EXPECT_EQ(expected_height, video_frame_a->height()); + EXPECT_EQ(expected_width, video_frame_b->width()); + EXPECT_EQ(expected_height, video_frame_b->height()); } // VideoDecodeEngine::EventHandler implementation. @@ -125,11 +127,9 @@ class FFmpegVideoDecodeEngineTest MOCK_METHOD0(OnError, void()); void CallProduceVideoFrame() { - test_engine_->ProduceVideoFrame(VideoFrame::CreateFrame(VideoFrame::YV12, - kWidth, - kHeight, - kNoTimestamp, - kNoTimestamp)); + test_engine_->ProduceVideoFrame(VideoFrame::CreateFrame( + VideoFrame::YV12, kVisibleRect.width(), kVisibleRect.height(), + kNoTimestamp, kNoTimestamp)); } protected: @@ -149,9 +149,8 @@ TEST_F(FFmpegVideoDecodeEngineTest, Initialize_Normal) { } TEST_F(FFmpegVideoDecodeEngineTest, Initialize_FindDecoderFails) { - VideoDecoderConfig config(kUnknown, kWidth, kHeight, kSurfaceWidth, - kSurfaceHeight, kFrameRate.num, kFrameRate.den, - NULL, 0); + VideoDecoderConfig config(kUnknown, kCodedSize, kVisibleRect, kNaturalSize, + kFrameRate.num, kFrameRate.den, NULL, 0); // Test avcodec_find_decoder() returning NULL. VideoCodecInfo info; EXPECT_CALL(*this, OnInitializeComplete(_)) @@ -162,8 +161,8 @@ TEST_F(FFmpegVideoDecodeEngineTest, Initialize_FindDecoderFails) { TEST_F(FFmpegVideoDecodeEngineTest, Initialize_OpenDecoderFails) { // Specify Theora w/o extra data so that avcodec_open() fails. - VideoDecoderConfig config(kCodecTheora, kWidth, kHeight, kSurfaceWidth, - kSurfaceHeight, kFrameRate.num, kFrameRate.den, + VideoDecoderConfig config(kCodecTheora, kCodedSize, kVisibleRect, + kNaturalSize, kFrameRate.num, kFrameRate.den, NULL, 0); VideoCodecInfo info; EXPECT_CALL(*this, OnInitializeComplete(_)) |