From 739cfb2f58577b774d848cc4794d71b8828bd1b1 Mon Sep 17 00:00:00 2001 From: Andrey Logvin Date: Tue, 30 Jun 2020 07:24:30 +0000 Subject: [PATCH] Add sync group validation in pc level test framework Bug: webrtc:11381 Change-Id: I4ef62675c0cb688abccc130fb91a69c3c78bf837 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178383 Reviewed-by: Karl Wiberg Reviewed-by: Artem Titov Commit-Queue: Andrey Logvin Cr-Commit-Position: refs/heads/master@{#31587} --- .../peerconnection_quality_test_fixture.h | 6 ++--- test/pc/e2e/peer_configurer.cc | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/api/test/peerconnection_quality_test_fixture.h b/api/test/peerconnection_quality_test_fixture.h index 35736876cc..4cdca81350 100644 --- a/api/test/peerconnection_quality_test_fixture.h +++ b/api/test/peerconnection_quality_test_fixture.h @@ -229,8 +229,7 @@ class PeerConnectionE2EQualityTestFixture { bool show_on_screen = false; // If specified, determines a sync group to which this video stream belongs. // According to bugs.webrtc.org/4762 WebRTC supports synchronization only - // for pair of single audio and single video stream. Framework won't do any - // enforcements on this field. + // for pair of single audio and single video stream. absl::optional sync_group; }; @@ -257,8 +256,7 @@ class PeerConnectionE2EQualityTestFixture { int sampling_frequency_in_hz = 48000; // If specified, determines a sync group to which this audio stream belongs. // According to bugs.webrtc.org/4762 WebRTC supports synchronization only - // for pair of single audio and single video stream. Framework won't do any - // enforcements on this field. + // for pair of single audio and single video stream. absl::optional sync_group; }; diff --git a/test/pc/e2e/peer_configurer.cc b/test/pc/e2e/peer_configurer.cc index d1d5b7f8d7..b5616b5d68 100644 --- a/test/pc/e2e/peer_configurer.cc +++ b/test/pc/e2e/peer_configurer.cc @@ -107,6 +107,8 @@ void ValidateParams( std::set peer_names; std::set video_labels; std::set audio_labels; + std::set video_sync_groups; + std::set audio_sync_groups; int media_streams_count = 0; for (size_t i = 0; i < peers.size(); ++i) { @@ -123,7 +125,8 @@ void ValidateParams( } media_streams_count += p->video_configs.size(); - // Validate that all video stream labels are unique. + // Validate that all video stream labels are unique and sync groups are + // valid. for (const VideoConfig& video_config : p->video_configs) { RTC_CHECK(video_config.stream_label); bool inserted = @@ -131,6 +134,17 @@ void ValidateParams( RTC_CHECK(inserted) << "Duplicate video_config.stream_label=" << video_config.stream_label.value(); + // TODO(bugs.webrtc.org/4762): remove this check after synchronization of + // more than two streams is supported. + if (video_config.sync_group.has_value()) { + bool sync_group_inserted = + video_sync_groups.insert(video_config.sync_group.value()).second; + RTC_CHECK(sync_group_inserted) + << "Sync group shouldn't consist of more than two streams (one " + "video and one audio). Duplicate video_config.sync_group=" + << video_config.sync_group.value(); + } + if (video_config.simulcast_config) { if (video_config.simulcast_config->target_spatial_index) { RTC_CHECK_GE(*video_config.simulcast_config->target_spatial_index, 0); @@ -158,6 +172,17 @@ void ValidateParams( audio_labels.insert(p->audio_config->stream_label.value()).second; RTC_CHECK(inserted) << "Duplicate audio_config.stream_label=" << p->audio_config->stream_label.value(); + // TODO(bugs.webrtc.org/4762): remove this check after synchronization of + // more than two streams is supported. + if (p->audio_config->sync_group.has_value()) { + bool sync_group_inserted = + audio_sync_groups.insert(p->audio_config->sync_group.value()) + .second; + RTC_CHECK(sync_group_inserted) + << "Sync group shouldn't consist of more than two streams (one " + "video and one audio). Duplicate audio_config.sync_group=" + << p->audio_config->sync_group.value(); + } // Check that if mode input file name specified only if mode is kFile. if (p->audio_config.value().mode == AudioConfig::Mode::kGenerated) { RTC_CHECK(!p->audio_config.value().input_file_name);