[PCLF] Add GetMaxResolution among resolutions
Bug: b/213863770 Change-Id: I5f90cc5345be8630a2ededf93e1648d4c9bb1be2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259504 Reviewed-by: Andrey Logvin <landrey@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36593}
This commit is contained in:
parent
ed21d96e13
commit
83962d9182
@ -50,20 +50,31 @@ operator==(const Resolution& other) const {
|
||||
absl::optional<VideoSubscription::Resolution>
|
||||
PeerConnectionE2EQualityTestFixture::VideoSubscription::GetMaxResolution(
|
||||
rtc::ArrayView<const VideoConfig> video_configs) {
|
||||
if (video_configs.empty()) {
|
||||
std::vector<VideoSubscription::Resolution> 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<VideoSubscription::Resolution>
|
||||
PeerConnectionE2EQualityTestFixture::VideoSubscription::GetMaxResolution(
|
||||
rtc::ArrayView<const VideoSubscription::Resolution> 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;
|
||||
|
||||
@ -372,6 +372,8 @@ class PeerConnectionE2EQualityTestFixture {
|
||||
// dimensions: width, height and fps.
|
||||
static absl::optional<VideoSubscription::Resolution> GetMaxResolution(
|
||||
rtc::ArrayView<const VideoConfig> video_configs);
|
||||
static absl::optional<VideoSubscription::Resolution> GetMaxResolution(
|
||||
rtc::ArrayView<const VideoSubscription::Resolution> resolutions);
|
||||
|
||||
// Subscribes receiver to all streams sent by the specified peer with
|
||||
// specified resolution. It will override any resolution that was used in
|
||||
|
||||
@ -59,7 +59,7 @@ TEST(PclfVideoSubscription, WhenSpecIsNotSetFieldsAreCompared) {
|
||||
|
||||
TEST(PclfVideoSubscription, GetMaxResolutionForEmptyReturnsNullopt) {
|
||||
absl::optional<VideoSubscription::Resolution> resolution =
|
||||
VideoSubscription::GetMaxResolution({});
|
||||
VideoSubscription::GetMaxResolution(std::vector<VideoConfig>{});
|
||||
ASSERT_FALSE(resolution.has_value());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user