move removal of CN codecs to a later stage
to avoid conflicts between createOffer({voiceActivityDetection: false}) and the transceiver setCodecPreferences API BUG=webrtc:12365 Change-Id: I369227103ab543f593b27145a37d3e5c19a59cd5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/218343 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <phancke@nvidia.com> Cr-Commit-Position: refs/heads/master@{#33992}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
3acdb0ac01
commit
3ac73bd0aa
@ -1515,10 +1515,6 @@ std::unique_ptr<SessionDescription> MediaSessionDescriptionFactory::CreateOffer(
|
||||
VideoCodecs offer_video_codecs;
|
||||
GetCodecsForOffer(current_active_contents, &offer_audio_codecs,
|
||||
&offer_video_codecs);
|
||||
if (!session_options.vad_enabled) {
|
||||
// If application doesn't want CN codecs in offer.
|
||||
StripCNCodecs(&offer_audio_codecs);
|
||||
}
|
||||
AudioVideoRtpHeaderExtensions extensions_with_ids =
|
||||
GetOfferedRtpHeaderExtensionsWithIds(
|
||||
current_active_contents, session_options.offer_extmap_allow_mixed,
|
||||
@ -1664,11 +1660,6 @@ MediaSessionDescriptionFactory::CreateAnswer(
|
||||
GetCodecsForAnswer(current_active_contents, *offer, &answer_audio_codecs,
|
||||
&answer_video_codecs);
|
||||
|
||||
if (!session_options.vad_enabled) {
|
||||
// If application doesn't want CN codecs in answer.
|
||||
StripCNCodecs(&answer_audio_codecs);
|
||||
}
|
||||
|
||||
auto answer = std::make_unique<SessionDescription>();
|
||||
|
||||
// If the offer supports BUNDLE, and we want to use it too, create a BUNDLE
|
||||
@ -2183,6 +2174,10 @@ bool MediaSessionDescriptionFactory::AddAudioContentForOffer(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!session_options.vad_enabled) {
|
||||
// If application doesn't want CN codecs in offer.
|
||||
StripCNCodecs(&filtered_codecs);
|
||||
}
|
||||
|
||||
cricket::SecurePolicy sdes_policy =
|
||||
IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED
|
||||
@ -2458,6 +2453,10 @@ bool MediaSessionDescriptionFactory::AddAudioContentForAnswer(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!session_options.vad_enabled) {
|
||||
// If application doesn't want CN codecs in answer.
|
||||
StripCNCodecs(&filtered_codecs);
|
||||
}
|
||||
|
||||
bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) &&
|
||||
session_options.bundle_enabled;
|
||||
|
@ -1736,6 +1736,26 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
|
||||
EXPECT_TRUE(CompareCodecs(video_codecs_vpx_reverse, recv_codecs));
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionMediaTestUnifiedPlan,
|
||||
SetCodecPreferencesVoiceActivityDetection) {
|
||||
auto fake_engine = std::make_unique<FakeMediaEngine>();
|
||||
AddComfortNoiseCodecsToSend(fake_engine.get());
|
||||
auto caller = CreatePeerConnectionWithAudio(std::move(fake_engine));
|
||||
|
||||
RTCOfferAnswerOptions options;
|
||||
auto offer = caller->CreateOffer(options);
|
||||
EXPECT_TRUE(HasAnyComfortNoiseCodecs(offer->description()));
|
||||
|
||||
auto transceiver = caller->pc()->GetTransceivers().front();
|
||||
auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities(
|
||||
cricket::MediaType::MEDIA_TYPE_AUDIO);
|
||||
EXPECT_TRUE(transceiver->SetCodecPreferences(capabilities.codecs).ok());
|
||||
|
||||
options.voice_activity_detection = false;
|
||||
offer = caller->CreateOffer(options);
|
||||
EXPECT_FALSE(HasAnyComfortNoiseCodecs(offer->description()));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PeerConnectionMediaTest,
|
||||
PeerConnectionMediaTest,
|
||||
Values(SdpSemantics::kPlanB,
|
||||
|
Reference in New Issue
Block a user