Fix simulcast tests and PC framework for conference mode support
Bug: webrtc:10138
Change-Id: I19dce2c9b7a066d517861774fd888ad0a0d74103
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150648
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28988}
diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
index ca5e09f..d6bef2b 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc
@@ -143,6 +143,13 @@
captured_frames_in_flight_.at(frame_id).set_id(frame_id);
frame_stats_.insert(std::pair<uint16_t, FrameStats>(
frame_id, FrameStats(stream_label, /*captured_time=*/Now())));
+
+ // Update history stream<->frame mapping
+ for (auto it = stream_to_frame_id_history_.begin();
+ it != stream_to_frame_id_history_.end(); ++it) {
+ it->second.erase(frame_id);
+ }
+ stream_to_frame_id_history_[stream_label].insert(frame_id);
}
return frame_id;
}
@@ -331,8 +338,17 @@
std::string DefaultVideoQualityAnalyzer::GetStreamLabel(uint16_t frame_id) {
rtc::CritScope crit1(&lock_);
auto it = frame_stats_.find(frame_id);
- RTC_DCHECK(it != frame_stats_.end()) << "Unknown frame_id=" << frame_id;
- return it->second.stream_label;
+ if (it != frame_stats_.end()) {
+ return it->second.stream_label;
+ }
+ for (auto hist_it = stream_to_frame_id_history_.begin();
+ hist_it != stream_to_frame_id_history_.end(); ++hist_it) {
+ auto hist_set_it = hist_it->second.find(frame_id);
+ if (hist_set_it != hist_it->second.end()) {
+ return hist_it->first;
+ }
+ }
+ RTC_CHECK(false) << "Unknown frame_id=" << frame_id;
}
std::set<std::string> DefaultVideoQualityAnalyzer::GetKnownVideoStreams()
diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h
index 45814cc..8d7f8c0 100644
--- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h
+++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h
@@ -268,6 +268,13 @@
std::map<uint16_t, FrameStats> frame_stats_ RTC_GUARDED_BY(lock_);
std::map<std::string, StreamState> stream_states_ RTC_GUARDED_BY(lock_);
+ // Stores history mapping between stream labels and frame ids. Updated when
+ // frame id overlap. It required to properly return stream label after 1st
+ // frame from simulcast streams was already rendered and last is still
+ // encoding.
+ std::map<std::string, std::set<uint16_t>> stream_to_frame_id_history_
+ RTC_GUARDED_BY(lock_);
+
rtc::CriticalSection comparison_lock_;
std::map<std::string, StreamStats> stream_stats_
RTC_GUARDED_BY(comparison_lock_);
diff --git a/test/pc/e2e/sdp/sdp_changer.cc b/test/pc/e2e/sdp/sdp_changer.cc
index 4025d88..3b02daf 100644
--- a/test/pc/e2e/sdp/sdp_changer.cc
+++ b/test/pc/e2e/sdp/sdp_changer.cc
@@ -339,6 +339,18 @@
LocalAndRemoteSdp SignalingInterceptor::PatchAnswer(
std::unique_ptr<SessionDescriptionInterface> answer) {
+ for (auto& content : answer->description()->contents()) {
+ cricket::MediaContentDescription* media_desc = content.media_description();
+ if (media_desc->type() != cricket::MediaType::MEDIA_TYPE_VIDEO) {
+ continue;
+ }
+ if (content.media_description()->direction() !=
+ RtpTransceiverDirection::kRecvOnly) {
+ continue;
+ }
+ media_desc->set_conference_mode(params_.use_conference_mode);
+ }
+
if (params_.video_codec_name == cricket::kVp8CodecName) {
return PatchVp8Answer(std::move(answer));
}
diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc
index 717c2f3..0534874 100644
--- a/video/pc_full_stack_tests.cc
+++ b/video/pc_full_stack_tests.cc
@@ -1132,9 +1132,10 @@
CreateTwoNetworkLinks(network_emulation_manager.get(),
BuiltInNetworkBehaviorConfig()),
[](PeerConfigurer* alice) {
- VideoConfig video(1850, 1110, 60);
+ VideoConfig video(1850, 1110, 30);
video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10));
- video.simulcast_config = VideoSimulcastConfig(2, 0);
+ video.simulcast_config = VideoSimulcastConfig(2, 1);
+ video.temporal_layers_count = 2;
video.stream_label = "alice-video";
alice->AddVideoConfig(std::move(video));
},
@@ -1154,9 +1155,10 @@
CreateTwoNetworkLinks(network_emulation_manager.get(),
BuiltInNetworkBehaviorConfig()),
[](PeerConfigurer* alice) {
- VideoConfig video(1850, 1110, 60);
+ VideoConfig video(1850, 1110, 30);
video.screen_share_config = ScreenShareConfig(TimeDelta::seconds(10));
- video.simulcast_config = VideoSimulcastConfig(2, 0);
+ video.simulcast_config = VideoSimulcastConfig(2, 1);
+ video.temporal_layers_count = 2;
video.stream_label = "alice-video";
alice->AddVideoConfig(std::move(video));
},
@@ -1640,6 +1642,7 @@
VideoConfig video(1920, 1080, 30);
video.generator = VideoGeneratorType::kDefault;
video.simulcast_config = VideoSimulcastConfig(3, 2);
+ video.temporal_layers_count = 3;
video.stream_label = "alice-video";
alice->AddVideoConfig(std::move(video));
},