| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/api/video/i420_buffer.h" | 13 #include "webrtc/api/video/i420_buffer.h" |
| 14 #include "webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h
" | 14 #include "webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h
" |
| 15 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" | 15 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" |
| 16 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" | 16 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" |
| 17 #include "webrtc/modules/video_coding/include/video_coding.h" | 17 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 18 #include "webrtc/rtc_base/ptr_util.h" | 18 #include "webrtc/rtc_base/ptr_util.h" |
| 19 #include "webrtc/test/gmock.h" | 19 #include "webrtc/test/gmock.h" |
| 20 #include "webrtc/test/gtest.h" | 20 #include "webrtc/test/gtest.h" |
| 21 #include "webrtc/test/testsupport/mock/mock_frame_reader.h" | 21 #include "webrtc/test/testsupport/mock/mock_frame_reader.h" |
| 22 #include "webrtc/test/testsupport/mock/mock_frame_writer.h" | 22 #include "webrtc/test/testsupport/mock/mock_frame_writer.h" |
| 23 #include "webrtc/test/testsupport/packet_reader.h" | 23 #include "webrtc/test/testsupport/packet_reader.h" |
| 24 #include "webrtc/test/testsupport/unittest_utils.h" | 24 #include "webrtc/test/testsupport/unittest_utils.h" |
| 25 #include "webrtc/test/video_codec_settings.h" |
| 25 #include "webrtc/typedefs.h" | 26 #include "webrtc/typedefs.h" |
| 26 | 27 |
| 27 using ::testing::_; | 28 using ::testing::_; |
| 28 using ::testing::AtLeast; | 29 using ::testing::AtLeast; |
| 29 using ::testing::Return; | 30 using ::testing::Return; |
| 30 | 31 |
| 31 namespace webrtc { | 32 namespace webrtc { |
| 32 namespace test { | 33 namespace test { |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 const int kWidth = 352; | 37 const int kWidth = 352; |
| 37 const int kHeight = 288; | 38 const int kHeight = 288; |
| 38 const int kFrameSize = kWidth * kHeight * 3 / 2; // I420. | 39 const int kFrameSize = kWidth * kHeight * 3 / 2; // I420. |
| 39 const int kFramerate = 30; | 40 const int kFramerate = 30; |
| 40 const int kNumFrames = 2; | 41 const int kNumFrames = 2; |
| 41 | 42 |
| 42 } // namespace | 43 } // namespace |
| 43 | 44 |
| 44 class VideoProcessorTest : public testing::Test { | 45 class VideoProcessorTest : public testing::Test { |
| 45 protected: | 46 protected: |
| 46 VideoProcessorTest() { | 47 VideoProcessorTest() { |
| 47 // Get a codec configuration struct and configure it. | 48 // Get a codec configuration struct and configure it. |
| 48 VideoCodingModule::Codec(kVideoCodecVP8, &config_.codec_settings); | 49 webrtc::test::CodecSettings(kVideoCodecVP8, &config_.codec_settings); |
| 49 config_.codec_settings.width = kWidth; | 50 config_.codec_settings.width = kWidth; |
| 50 config_.codec_settings.height = kHeight; | 51 config_.codec_settings.height = kHeight; |
| 51 config_.codec_settings.maxFramerate = kFramerate; | 52 config_.codec_settings.maxFramerate = kFramerate; |
| 52 | 53 |
| 53 EXPECT_CALL(frame_reader_mock_, NumberOfFrames()) | 54 EXPECT_CALL(frame_reader_mock_, NumberOfFrames()) |
| 54 .WillRepeatedly(Return(kNumFrames)); | 55 .WillRepeatedly(Return(kNumFrames)); |
| 55 EXPECT_CALL(frame_reader_mock_, FrameLength()) | 56 EXPECT_CALL(frame_reader_mock_, FrameLength()) |
| 56 .WillRepeatedly(Return(kFrameSize)); | 57 .WillRepeatedly(Return(kFrameSize)); |
| 57 video_processor_ = rtc::MakeUnique<VideoProcessor>( | 58 video_processor_ = rtc::MakeUnique<VideoProcessor>( |
| 58 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, | 59 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 100 |
| 100 EXPECT_CALL(encoder_mock_, Encode(testing::Property(&VideoFrame::timestamp, | 101 EXPECT_CALL(encoder_mock_, Encode(testing::Property(&VideoFrame::timestamp, |
| 101 2 * 90000 / kFramerate), | 102 2 * 90000 / kFramerate), |
| 102 _, _)) | 103 _, _)) |
| 103 .Times(1); | 104 .Times(1); |
| 104 video_processor_->ProcessFrame(1); | 105 video_processor_->ProcessFrame(1); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace test | 108 } // namespace test |
| 108 } // namespace webrtc | 109 } // namespace webrtc |
| OLD | NEW |