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 ca5e09ff90..d6bef2b1d6 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 @@ uint16_t DefaultVideoQualityAnalyzer::OnFrameCaptured( captured_frames_in_flight_.at(frame_id).set_id(frame_id); frame_stats_.insert(std::pair( 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 @@ void DefaultVideoQualityAnalyzer::Stop() { 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 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 45814cc3a7..8d7f8c0d8c 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 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface { std::map frame_stats_ RTC_GUARDED_BY(lock_); std::map 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> stream_to_frame_id_history_ + RTC_GUARDED_BY(lock_); + rtc::CriticalSection comparison_lock_; std::map 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 4025d889f3..3b02daf18d 100644 --- a/test/pc/e2e/sdp/sdp_changer.cc +++ b/test/pc/e2e/sdp/sdp_changer.cc @@ -339,6 +339,18 @@ LocalAndRemoteSdp SignalingInterceptor::PatchVp9Offer( LocalAndRemoteSdp SignalingInterceptor::PatchAnswer( std::unique_ptr 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 717c2f3f6c..05348744d8 100644 --- a/video/pc_full_stack_tests.cc +++ b/video/pc_full_stack_tests.cc @@ -1132,9 +1132,10 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_Simulcast_NoConferenceMode) { 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 @@ TEST(PCFullStackTest, ScreenshareSlidesVP8_2TL_Simulcast) { 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 @@ TEST(PCFullStackTest, MAYBE_SimulcastFullHdOveruse) { 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)); },