OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 EXPECT_EQ(1280 * 2 / 4, send_stream->GetLastWidth()); | 2109 EXPECT_EQ(1280 * 2 / 4, send_stream->GetLastWidth()); |
2110 EXPECT_EQ(720 * 2 / 4, send_stream->GetLastHeight()); | 2110 EXPECT_EQ(720 * 2 / 4, send_stream->GetLastHeight()); |
2111 | 2111 |
2112 // Change input resolution. | 2112 // Change input resolution. |
2113 EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); | 2113 EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); |
2114 EXPECT_EQ(4, send_stream->GetNumberOfSwappedFrames()); | 2114 EXPECT_EQ(4, send_stream->GetNumberOfSwappedFrames()); |
2115 EXPECT_EQ(1284 / 2, send_stream->GetLastWidth()); | 2115 EXPECT_EQ(1284 / 2, send_stream->GetLastWidth()); |
2116 EXPECT_EQ(724 / 2, send_stream->GetLastHeight()); | 2116 EXPECT_EQ(724 / 2, send_stream->GetLastHeight()); |
2117 | 2117 |
2118 // Trigger underuse which should go back up in resolution. | 2118 // Trigger underuse which should go back up in resolution. |
2119 wants.max_pixel_count = rtc::Optional<int>(); | 2119 int current_pixel_count = |
2120 wants.max_pixel_count_step_up = rtc::Optional<int>( | 2120 send_stream->GetLastWidth() * send_stream->GetLastHeight(); |
2121 send_stream->GetLastWidth() * send_stream->GetLastHeight()); | 2121 // Cap the max to 4x the pixel count (assuming max 1/2 x 1/2 scale downs) |
| 2122 // of the current stream, so we don't take too large steps. |
| 2123 wants.max_pixel_count = rtc::Optional<int>(current_pixel_count * 4); |
| 2124 // Default step down is 3/5 pixel count, so go up by 5/3. |
| 2125 wants.target_pixel_count = rtc::Optional<int>((current_pixel_count * 5) / 3); |
2122 send_stream->InjectVideoSinkWants(wants); | 2126 send_stream->InjectVideoSinkWants(wants); |
2123 EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); | 2127 EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); |
2124 EXPECT_EQ(5, send_stream->GetNumberOfSwappedFrames()); | 2128 EXPECT_EQ(5, send_stream->GetNumberOfSwappedFrames()); |
2125 EXPECT_EQ(1284 * 3 / 4, send_stream->GetLastWidth()); | 2129 EXPECT_EQ(1284 * 3 / 4, send_stream->GetLastWidth()); |
2126 EXPECT_EQ(724 * 3 / 4, send_stream->GetLastHeight()); | 2130 EXPECT_EQ(724 * 3 / 4, send_stream->GetLastHeight()); |
2127 | 2131 |
2128 // Trigger underuse which should go back up in resolution. | 2132 // Trigger underuse again, should go back up to full resolution. |
2129 wants.max_pixel_count = rtc::Optional<int>(); | 2133 current_pixel_count = |
2130 wants.max_pixel_count_step_up = rtc::Optional<int>( | 2134 send_stream->GetLastWidth() * send_stream->GetLastHeight(); |
2131 send_stream->GetLastWidth() * send_stream->GetLastHeight()); | 2135 wants.max_pixel_count = rtc::Optional<int>(current_pixel_count * 4); |
| 2136 wants.target_pixel_count = rtc::Optional<int>((current_pixel_count * 5) / 3); |
2132 send_stream->InjectVideoSinkWants(wants); | 2137 send_stream->InjectVideoSinkWants(wants); |
2133 EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); | 2138 EXPECT_TRUE(capturer.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); |
2134 EXPECT_EQ(6, send_stream->GetNumberOfSwappedFrames()); | 2139 EXPECT_EQ(6, send_stream->GetNumberOfSwappedFrames()); |
2135 EXPECT_EQ(1284, send_stream->GetLastWidth()); | 2140 EXPECT_EQ(1284, send_stream->GetLastWidth()); |
2136 EXPECT_EQ(724, send_stream->GetLastHeight()); | 2141 EXPECT_EQ(724, send_stream->GetLastHeight()); |
2137 | 2142 |
2138 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 2143 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
2139 } | 2144 } |
2140 | 2145 |
2141 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { | 2146 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 EXPECT_TRUE(capturer.CaptureFrame()); | 2261 EXPECT_TRUE(capturer.CaptureFrame()); |
2257 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); | 2262 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
2258 | 2263 |
2259 EXPECT_TRUE(capturer.CaptureFrame()); | 2264 EXPECT_TRUE(capturer.CaptureFrame()); |
2260 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); | 2265 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); |
2261 | 2266 |
2262 EXPECT_LT(send_stream->GetLastWidth(), capture_format.width); | 2267 EXPECT_LT(send_stream->GetLastWidth(), capture_format.width); |
2263 EXPECT_LT(send_stream->GetLastHeight(), capture_format.height); | 2268 EXPECT_LT(send_stream->GetLastHeight(), capture_format.height); |
2264 | 2269 |
2265 // Trigger underuse which should go back to normal resolution. | 2270 // Trigger underuse which should go back to normal resolution. |
2266 wants.max_pixel_count = rtc::Optional<int>(); | 2271 int last_pixel_count = |
2267 wants.max_pixel_count_step_up = rtc::Optional<int>( | 2272 send_stream->GetLastWidth() * send_stream->GetLastHeight(); |
2268 send_stream->GetLastWidth() * send_stream->GetLastHeight()); | 2273 wants.max_pixel_count = rtc::Optional<int>(last_pixel_count * 4); |
| 2274 wants.target_pixel_count = rtc::Optional<int>((last_pixel_count * 5) / 3); |
2269 send_stream->InjectVideoSinkWants(wants); | 2275 send_stream->InjectVideoSinkWants(wants); |
2270 | 2276 |
2271 EXPECT_TRUE(capturer.CaptureFrame()); | 2277 EXPECT_TRUE(capturer.CaptureFrame()); |
2272 EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames()); | 2278 EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames()); |
2273 | 2279 |
2274 EXPECT_EQ(capture_format.width, send_stream->GetLastWidth()); | 2280 EXPECT_EQ(capture_format.width, send_stream->GetLastWidth()); |
2275 EXPECT_EQ(capture_format.height, send_stream->GetLastHeight()); | 2281 EXPECT_EQ(capture_format.height, send_stream->GetLastHeight()); |
2276 | 2282 |
2277 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 2283 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
2278 } | 2284 } |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4220 } | 4226 } |
4221 | 4227 |
4222 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { | 4228 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { |
4223 webrtc::test::ScopedFieldTrials override_field_trials_( | 4229 webrtc::test::ScopedFieldTrials override_field_trials_( |
4224 "WebRTC-SimulcastScreenshare/Enabled/"); | 4230 "WebRTC-SimulcastScreenshare/Enabled/"); |
4225 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, | 4231 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, |
4226 true); | 4232 true); |
4227 } | 4233 } |
4228 | 4234 |
4229 } // namespace cricket | 4235 } // namespace cricket |
OLD | NEW |