diff --git a/api/test/peerconnection_quality_test_fixture.cc b/api/test/peerconnection_quality_test_fixture.cc index 707c52e0f3..b5393c219d 100644 --- a/api/test/peerconnection_quality_test_fixture.cc +++ b/api/test/peerconnection_quality_test_fixture.cc @@ -50,20 +50,31 @@ operator==(const Resolution& other) const { absl::optional PeerConnectionE2EQualityTestFixture::VideoSubscription::GetMaxResolution( rtc::ArrayView video_configs) { - if (video_configs.empty()) { + std::vector resolutions; + for (const auto& video_config : video_configs) { + resolutions.push_back(VideoSubscription::Resolution( + video_config.width, video_config.height, video_config.fps)); + } + return GetMaxResolution(resolutions); +} + +absl::optional +PeerConnectionE2EQualityTestFixture::VideoSubscription::GetMaxResolution( + rtc::ArrayView resolutions) { + if (resolutions.empty()) { return absl::nullopt; } VideoSubscription::Resolution max_resolution; - for (const VideoConfig& config : video_configs) { - if (max_resolution.width() < config.width) { - max_resolution.set_width(config.width); + for (const VideoSubscription::Resolution& resolution : resolutions) { + if (max_resolution.width() < resolution.width()) { + max_resolution.set_width(resolution.width()); } - if (max_resolution.height() < config.height) { - max_resolution.set_height(config.height); + if (max_resolution.height() < resolution.height()) { + max_resolution.set_height(resolution.height()); } - if (max_resolution.fps() < config.fps) { - max_resolution.set_fps(config.fps); + if (max_resolution.fps() < resolution.fps()) { + max_resolution.set_fps(resolution.fps()); } } return max_resolution; diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h index 240cf31993..bbeb7ca3e4 100644 --- a/api/test/peerconnection_quality_test_fixture.h +++ b/api/test/peerconnection_quality_test_fixture.h @@ -372,6 +372,8 @@ class PeerConnectionE2EQualityTestFixture { // dimensions: width, height and fps. static absl::optional GetMaxResolution( rtc::ArrayView video_configs); + static absl::optional GetMaxResolution( + rtc::ArrayView resolutions); // Subscribes receiver to all streams sent by the specified peer with // specified resolution. It will override any resolution that was used in diff --git a/api/test/peerconnection_quality_test_fixture_unittest.cc b/api/test/peerconnection_quality_test_fixture_unittest.cc index 8bde0aa7c3..a4d972d48f 100644 --- a/api/test/peerconnection_quality_test_fixture_unittest.cc +++ b/api/test/peerconnection_quality_test_fixture_unittest.cc @@ -59,7 +59,7 @@ TEST(PclfVideoSubscription, WhenSpecIsNotSetFieldsAreCompared) { TEST(PclfVideoSubscription, GetMaxResolutionForEmptyReturnsNullopt) { absl::optional resolution = - VideoSubscription::GetMaxResolution({}); + VideoSubscription::GetMaxResolution(std::vector{}); ASSERT_FALSE(resolution.has_value()); }