| 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 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 config_.codec_settings = &codec_settings_; | 49 config_.codec_settings = &codec_settings_; |
| 50 config_.codec_settings->startBitrate = 100; | 50 config_.codec_settings->startBitrate = 100; |
| 51 config_.codec_settings->width = kWidth; | 51 config_.codec_settings->width = kWidth; |
| 52 config_.codec_settings->height = kHeight; | 52 config_.codec_settings->height = kHeight; |
| 53 config_.codec_settings->maxFramerate = kFramerate; | 53 config_.codec_settings->maxFramerate = kFramerate; |
| 54 | 54 |
| 55 EXPECT_CALL(frame_reader_mock_, NumberOfFrames()) | 55 EXPECT_CALL(frame_reader_mock_, NumberOfFrames()) |
| 56 .WillRepeatedly(Return(kNumFrames)); | 56 .WillRepeatedly(Return(kNumFrames)); |
| 57 EXPECT_CALL(frame_reader_mock_, FrameLength()) | 57 EXPECT_CALL(frame_reader_mock_, FrameLength()) |
| 58 .WillRepeatedly(Return(kFrameSize)); | 58 .WillRepeatedly(Return(kFrameSize)); |
| 59 video_processor_ = rtc::MakeUnique<VideoProcessorImpl>( | 59 video_processor_ = rtc::MakeUnique<VideoProcessor>( |
| 60 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, | 60 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, |
| 61 &frame_writer_mock_, &packet_manipulator_mock_, config_, &stats_, | 61 &frame_writer_mock_, &packet_manipulator_mock_, config_, &stats_, |
| 62 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, | 62 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, |
| 63 nullptr /* decoded_frame_writer */); | 63 nullptr /* decoded_frame_writer */); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ExpectInit() { | 66 void ExpectInit() { |
| 67 EXPECT_CALL(encoder_mock_, InitEncode(_, _, _)).Times(1); | 67 EXPECT_CALL(encoder_mock_, InitEncode(_, _, _)).Times(1); |
| 68 EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)) | 68 EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)) |
| 69 .Times(AtLeast(1)); | 69 .Times(AtLeast(1)); |
| 70 EXPECT_CALL(decoder_mock_, InitDecode(_, _)).Times(1); | 70 EXPECT_CALL(decoder_mock_, InitDecode(_, _)).Times(1); |
| 71 EXPECT_CALL(decoder_mock_, RegisterDecodeCompleteCallback(_)) | 71 EXPECT_CALL(decoder_mock_, RegisterDecodeCompleteCallback(_)) |
| 72 .Times(AtLeast(1)); | 72 .Times(AtLeast(1)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 MockVideoEncoder encoder_mock_; | 75 MockVideoEncoder encoder_mock_; |
| 76 MockVideoDecoder decoder_mock_; | 76 MockVideoDecoder decoder_mock_; |
| 77 MockFrameReader frame_reader_mock_; | 77 MockFrameReader frame_reader_mock_; |
| 78 MockFrameWriter frame_writer_mock_; | 78 MockFrameWriter frame_writer_mock_; |
| 79 MockPacketManipulator packet_manipulator_mock_; | 79 MockPacketManipulator packet_manipulator_mock_; |
| 80 VideoCodec codec_settings_; | 80 VideoCodec codec_settings_; |
| 81 TestConfig config_; | 81 TestConfig config_; |
| 82 Stats stats_; | 82 Stats stats_; |
| 83 std::unique_ptr<VideoProcessorImpl> video_processor_; | 83 std::unique_ptr<VideoProcessor> video_processor_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 TEST_F(VideoProcessorTest, Init) { | 86 TEST_F(VideoProcessorTest, Init) { |
| 87 ExpectInit(); | 87 ExpectInit(); |
| 88 video_processor_->Init(); | 88 video_processor_->Init(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 TEST_F(VideoProcessorTest, ProcessFrames) { | 91 TEST_F(VideoProcessorTest, ProcessFrames) { |
| 92 ExpectInit(); | 92 ExpectInit(); |
| 93 video_processor_->Init(); | 93 video_processor_->Init(); |
| 94 | 94 |
| 95 EXPECT_CALL(frame_reader_mock_, ReadFrame()) | 95 EXPECT_CALL(frame_reader_mock_, ReadFrame()) |
| 96 .WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight))); | 96 .WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight))); |
| 97 EXPECT_CALL(encoder_mock_, Encode(testing::Property(&VideoFrame::timestamp, | 97 EXPECT_CALL(encoder_mock_, Encode(testing::Property(&VideoFrame::timestamp, |
| 98 1 * 90000 / kFramerate), | 98 1 * 90000 / kFramerate), |
| 99 _, _)) | 99 _, _)) |
| 100 .Times(1); | 100 .Times(1); |
| 101 video_processor_->ProcessFrame(0); | 101 video_processor_->ProcessFrame(0); |
| 102 | 102 |
| 103 EXPECT_CALL(encoder_mock_, Encode(testing::Property(&VideoFrame::timestamp, | 103 EXPECT_CALL(encoder_mock_, Encode(testing::Property(&VideoFrame::timestamp, |
| 104 2 * 90000 / kFramerate), | 104 2 * 90000 / kFramerate), |
| 105 _, _)) | 105 _, _)) |
| 106 .Times(1); | 106 .Times(1); |
| 107 video_processor_->ProcessFrame(1); | 107 video_processor_->ProcessFrame(1); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace test | 110 } // namespace test |
| 111 } // namespace webrtc | 111 } // namespace webrtc |
| OLD | NEW |