Propagate multicodec support to other places of PC level framework

Bug: webrtc:10138
Change-Id: I9258db991053abfa40f2a5112eddfa7f3e0d41a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167062
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30346}
This commit is contained in:
Artem Titov
2020-01-22 11:20:01 +01:00
committed by Commit Bot
parent 33aaa35d54
commit ee558dcca8
3 changed files with 31 additions and 15 deletions

View File

@ -510,6 +510,7 @@ void PeerConnectionE2EQualityTest::ValidateParams(
std::set<std::string> audio_labels;
int media_streams_count = 0;
bool has_simulcast = false;
for (size_t i = 0; i < params.size(); ++i) {
Params* p = params[i];
if (p->audio_config) {
@ -574,6 +575,7 @@ void PeerConnectionE2EQualityTest::ValidateParams(
}
}
if (video_config.simulcast_config) {
has_simulcast = true;
// We support simulcast only from caller.
RTC_CHECK_EQ(i, 0)
<< "Only simulcast stream from first peer is supported";
@ -601,6 +603,11 @@ void PeerConnectionE2EQualityTest::ValidateParams(
}
}
}
if (has_simulcast) {
RTC_CHECK_EQ(run_params.video_codecs.size(), 1)
<< "Only 1 video codec is supported when simulcast is enabled in at "
<< "least 1 video config";
}
RTC_CHECK_GT(media_streams_count, 0) << "No media in the call.";
}
@ -673,7 +680,8 @@ void PeerConnectionE2EQualityTest::SetupCallOnSignalingThread(
RtpTransceiverInit transceiver_params;
if (video_config.simulcast_config) {
transceiver_params.direction = RtpTransceiverDirection::kSendOnly;
if (run_params.video_codec_name == cricket::kVp8CodecName) {
// Because simulcast enabled |run_params.video_codecs| has only 1 element.
if (run_params.video_codecs[0].name == cricket::kVp8CodecName) {
// For Vp8 simulcast we need to add as many RtpEncodingParameters to the
// track as many simulcast streams requested.
for (int i = 0;
@ -937,7 +945,7 @@ void PeerConnectionE2EQualityTest::SetupCall(const RunParams& run_params) {
video_config.simulcast_config->simulcast_streams_count});
}
}
PatchingParams patching_params(run_params.video_codec_name,
PatchingParams patching_params(run_params.video_codecs,
run_params.use_conference_mode,
stream_label_to_simulcast_streams_count);
SignalingInterceptor signaling_interceptor(patching_params);

View File

@ -165,12 +165,15 @@ LocalAndRemoteSdp SignalingInterceptor::PatchOffer(
media_desc->set_conference_mode(params_.use_conference_mode);
}
if (params_.video_codec_name == cricket::kVp8CodecName) {
return PatchVp8Offer(std::move(offer));
}
if (params_.stream_label_to_simulcast_streams_count.size() > 0) {
// Because simulcast enabled |params_.video_codecs| has only 1 element.
if (params_.video_codecs[0].name == cricket::kVp8CodecName) {
return PatchVp8Offer(std::move(offer));
}
if (params_.video_codec_name == cricket::kVp9CodecName) {
return PatchVp9Offer(std::move(offer));
if (params_.video_codecs[0].name == cricket::kVp9CodecName) {
return PatchVp9Offer(std::move(offer));
}
}
auto offer_for_remote = CloneSessionDescription(offer.get());
@ -353,12 +356,15 @@ LocalAndRemoteSdp SignalingInterceptor::PatchAnswer(
media_desc->set_conference_mode(params_.use_conference_mode);
}
if (params_.video_codec_name == cricket::kVp8CodecName) {
return PatchVp8Answer(std::move(answer));
}
if (params_.stream_label_to_simulcast_streams_count.size() > 0) {
// Because simulcast enabled |params_.video_codecs| has only 1 element.
if (params_.video_codecs[0].name == cricket::kVp8CodecName) {
return PatchVp8Answer(std::move(answer));
}
if (params_.video_codec_name == cricket::kVp9CodecName) {
return PatchVp9Answer(std::move(answer));
if (params_.video_codecs[0].name == cricket::kVp9CodecName) {
return PatchVp9Answer(std::move(answer));
}
}
auto answer_for_remote = CloneSessionDescription(answer.get());

View File

@ -61,15 +61,17 @@ struct LocalAndRemoteSdp {
struct PatchingParams {
PatchingParams(
std::string video_codec_name,
std::vector<PeerConnectionE2EQualityTestFixture::VideoCodecConfig>
video_codecs,
bool use_conference_mode,
std::map<std::string, int> stream_label_to_simulcast_streams_count)
: video_codec_name(video_codec_name),
: video_codecs(std::move(video_codecs)),
use_conference_mode(use_conference_mode),
stream_label_to_simulcast_streams_count(
stream_label_to_simulcast_streams_count) {}
std::string video_codec_name;
std::vector<PeerConnectionE2EQualityTestFixture::VideoCodecConfig>
video_codecs;
bool use_conference_mode;
std::map<std::string, int> stream_label_to_simulcast_streams_count;
};