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

Unified Diff: media/video/ffmpeg_video_decode_engine_unittest.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/video/ffmpeg_video_decode_engine.cc ('k') | media/video/video_decode_engine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/ffmpeg_video_decode_engine_unittest.cc
diff --git a/media/video/ffmpeg_video_decode_engine_unittest.cc b/media/video/ffmpeg_video_decode_engine_unittest.cc
index 0368e63948a5b7ef75ee9a539412a2883c9fa33d..e8238ffad07c097714cf16f1f23f04fefc290aa8 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(_))
« no previous file with comments | « media/video/ffmpeg_video_decode_engine.cc ('k') | media/video/video_decode_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698