| 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(_))
|
|
|