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}
This commit is contained in:
parent
149dc72dfa
commit
4b9701e065
@ -143,6 +143,13 @@ uint16_t DefaultVideoQualityAnalyzer::OnFrameCaptured(
|
||||
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 @@ 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<std::string> DefaultVideoQualityAnalyzer::GetKnownVideoStreams()
|
||||
|
||||
@ -268,6 +268,13 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface {
|
||||
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_);
|
||||
|
||||
@ -339,6 +339,18 @@ LocalAndRemoteSdp SignalingInterceptor::PatchVp9Offer(
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@ -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));
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user