| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 const int kBitrateKbps = 456; | 102 const int kBitrateKbps = 456; |
| 103 const int kFramerateFps = 31; | 103 const int kFramerateFps = 31; |
| 104 video_processor_->SetRates(kBitrateKbps, kFramerateFps); | 104 video_processor_->SetRates(kBitrateKbps, kFramerateFps); |
| 105 | 105 |
| 106 EXPECT_CALL(frame_reader_mock_, ReadFrame()) | 106 EXPECT_CALL(frame_reader_mock_, ReadFrame()) |
| 107 .WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight))); | 107 .WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight))); |
| 108 EXPECT_CALL( | 108 EXPECT_CALL( |
| 109 encoder_mock_, | 109 encoder_mock_, |
| 110 Encode(Property(&VideoFrame::timestamp, 1 * 90000 / kFramerateFps), _, _)) | 110 Encode(Property(&VideoFrame::timestamp, 1 * 90000 / kFramerateFps), _, _)) |
| 111 .Times(1); | 111 .Times(1); |
| 112 video_processor_->ProcessFrame(0); | 112 video_processor_->ProcessFrame(); |
| 113 | 113 |
| 114 EXPECT_CALL( | 114 EXPECT_CALL( |
| 115 encoder_mock_, | 115 encoder_mock_, |
| 116 Encode(Property(&VideoFrame::timestamp, 2 * 90000 / kFramerateFps), _, _)) | 116 Encode(Property(&VideoFrame::timestamp, 2 * 90000 / kFramerateFps), _, _)) |
| 117 .Times(1); | 117 .Times(1); |
| 118 video_processor_->ProcessFrame(1); | 118 video_processor_->ProcessFrame(); |
| 119 | 119 |
| 120 ExpectRelease(); | 120 ExpectRelease(); |
| 121 video_processor_->Release(); | 121 video_processor_->Release(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 TEST_F(VideoProcessorTest, ProcessFrames_VariableFramerate) { | 124 TEST_F(VideoProcessorTest, ProcessFrames_VariableFramerate) { |
| 125 ExpectInit(); | 125 ExpectInit(); |
| 126 video_processor_->Init(); | 126 video_processor_->Init(); |
| 127 | 127 |
| 128 const int kBitrateKbps = 456; | 128 const int kBitrateKbps = 456; |
| 129 const int kStartFramerateFps = 27; | 129 const int kStartFramerateFps = 27; |
| 130 video_processor_->SetRates(kBitrateKbps, kStartFramerateFps); | 130 video_processor_->SetRates(kBitrateKbps, kStartFramerateFps); |
| 131 | 131 |
| 132 EXPECT_CALL(frame_reader_mock_, ReadFrame()) | 132 EXPECT_CALL(frame_reader_mock_, ReadFrame()) |
| 133 .WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight))); | 133 .WillRepeatedly(Return(I420Buffer::Create(kWidth, kHeight))); |
| 134 EXPECT_CALL(encoder_mock_, Encode(Property(&VideoFrame::timestamp, | 134 EXPECT_CALL(encoder_mock_, Encode(Property(&VideoFrame::timestamp, |
| 135 1 * 90000 / kStartFramerateFps), | 135 1 * 90000 / kStartFramerateFps), |
| 136 _, _)) | 136 _, _)) |
| 137 .Times(1); | 137 .Times(1); |
| 138 video_processor_->ProcessFrame(0); | 138 video_processor_->ProcessFrame(); |
| 139 | 139 |
| 140 const int kNewFramerateFps = 13; | 140 const int kNewFramerateFps = 13; |
| 141 video_processor_->SetRates(kBitrateKbps, kNewFramerateFps); | 141 video_processor_->SetRates(kBitrateKbps, kNewFramerateFps); |
| 142 | 142 |
| 143 EXPECT_CALL(encoder_mock_, Encode(Property(&VideoFrame::timestamp, | 143 EXPECT_CALL(encoder_mock_, Encode(Property(&VideoFrame::timestamp, |
| 144 2 * 90000 / kNewFramerateFps), | 144 2 * 90000 / kNewFramerateFps), |
| 145 _, _)) | 145 _, _)) |
| 146 .Times(1); | 146 .Times(1); |
| 147 video_processor_->ProcessFrame(1); | 147 video_processor_->ProcessFrame(); |
| 148 | 148 |
| 149 ExpectRelease(); | 149 ExpectRelease(); |
| 150 video_processor_->Release(); | 150 video_processor_->Release(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 TEST_F(VideoProcessorTest, SetRates) { | 153 TEST_F(VideoProcessorTest, SetRates) { |
| 154 ExpectInit(); | 154 ExpectInit(); |
| 155 video_processor_->Init(); | 155 video_processor_->Init(); |
| 156 | 156 |
| 157 const int kBitrateKbps = 123; | 157 const int kBitrateKbps = 123; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 179 ElementsAre(0, 0)); | 179 ElementsAre(0, 0)); |
| 180 EXPECT_THAT(video_processor_->NumberSpatialResizesPerRateUpdate(), | 180 EXPECT_THAT(video_processor_->NumberSpatialResizesPerRateUpdate(), |
| 181 ElementsAre(0, 0)); | 181 ElementsAre(0, 0)); |
| 182 | 182 |
| 183 ExpectRelease(); | 183 ExpectRelease(); |
| 184 video_processor_->Release(); | 184 video_processor_->Release(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace test | 187 } // namespace test |
| 188 } // namespace webrtc | 188 } // namespace webrtc |
| OLD | NEW |