Reland: Implement true negotiation for DatagramTransport with fallback to RTP.
In short, the caller places a x-opaque line in SDP for each m= section that uses datagram transport. If the answerer supports datagram transport, it will parse this line and create a datagram transport. It will then echo the x-opaque line into the answer (to indicate that it accepted use of datagram transport). If the offer and answer contain exactly the same x-opaque line, both peers will use datagram transport. If the x-opaque line is omitted from the answer (or is different in the answer) they will fall back to RTP. Note that a different x-opaque line in the answer means the answerer did not understand something in the negotiation proto. Since WebRTC cannot know what was misunderstood, or whether it's still possible to use the datagram transport, it must fall back to RTP. This may change in the future, possibly by passing the answer to the datagram transport, but it's good enough for now. Negotiation consists of four parts: 1. DatagramTransport exposes transport parameters for both client and server perspectives. The client just echoes what it received from the server (modulo any fields it might not have understood). 2. SDP adds a x-opaque line for opaque transport parameters. Identical to x-mt, but this is specific to datagram transport and goes in each m= section, and appears in the answer as well as the offer. - This is propagated to Jsep as part of the TransportDescription. - SDP files: transport_description.h,cc, transport_description_factory.h,cc, media_session.cc, webrtc_sdp.cc 3. JsepTransport/Controller: - Exposes opaque parameters for each mid (m= section). On offerer, this means pre-allocating a datagram transport and getting its parameters. On the answerer, this means echoing the offerer's parameters. - Uses a composite RTP transport to receive from either default RTP or datagram transport until both offer and answer arrive. - If a provisional answer arrives, sets the composite to send on the provisionally selected transport. - Once both offer and answer are set, deletes the unneeded transports and keeps whichever transport is selected. 4. PeerConnection pulls transport parameters out of Jsep and adds them to SDP. Bug: webrtc:9719 Change-Id: Ifcc428c8d76fb77dcc8abaa79507c620bcfb31b9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140920 Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Bjorn Mellem <mellem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28198}
This commit is contained in:

committed by
Commit Bot

parent
17031afe18
commit
c85ebbe766
@ -1577,6 +1577,8 @@ class WebRtcSdpTest : public ::testing::Test {
|
||||
}
|
||||
EXPECT_EQ(transport1.description.transport_options,
|
||||
transport2.description.transport_options);
|
||||
EXPECT_EQ(transport1.description.opaque_parameters,
|
||||
transport2.description.opaque_parameters);
|
||||
}
|
||||
|
||||
// global attributes
|
||||
@ -1670,6 +1672,15 @@ class WebRtcSdpTest : public ::testing::Test {
|
||||
desc_.AddTransportInfo(transport_info);
|
||||
}
|
||||
|
||||
void AddOpaqueTransportParameters(const std::string& content_name,
|
||||
cricket::OpaqueTransportParameters params) {
|
||||
ASSERT_TRUE(desc_.GetTransportInfoByName(content_name) != NULL);
|
||||
cricket::TransportInfo info = *(desc_.GetTransportInfoByName(content_name));
|
||||
desc_.RemoveTransportInfoByName(content_name);
|
||||
info.description.opaque_parameters = params;
|
||||
desc_.AddTransportInfo(info);
|
||||
}
|
||||
|
||||
void AddFingerprint() {
|
||||
desc_.RemoveTransportInfoByName(kAudioContentName);
|
||||
desc_.RemoveTransportInfoByName(kVideoContentName);
|
||||
@ -2203,6 +2214,25 @@ TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithIceOptions) {
|
||||
EXPECT_EQ(sdp_with_ice_options, message);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithOpaqueTransportParams) {
|
||||
cricket::OpaqueTransportParameters params;
|
||||
params.protocol = "foo";
|
||||
params.parameters = "test64";
|
||||
AddOpaqueTransportParameters(kAudioContentName, params);
|
||||
AddOpaqueTransportParameters(kVideoContentName, params);
|
||||
|
||||
ASSERT_TRUE(jdesc_.Initialize(desc_.Clone(), jdesc_.session_id(),
|
||||
jdesc_.session_version()));
|
||||
std::string message = webrtc::SdpSerialize(jdesc_);
|
||||
|
||||
std::string sdp_with_transport_parameters = kSdpFullString;
|
||||
InjectAfter(kAttributeIcePwdVoice, "a=x-opaque:foo:dGVzdDY0\r\n",
|
||||
&sdp_with_transport_parameters);
|
||||
InjectAfter(kAttributeIcePwdVideo, "a=x-opaque:foo:dGVzdDY0\r\n",
|
||||
&sdp_with_transport_parameters);
|
||||
EXPECT_EQ(message, sdp_with_transport_parameters);
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, SerializeSessionDescriptionWithRecvOnlyContent) {
|
||||
EXPECT_TRUE(TestSerializeDirection(RtpTransceiverDirection::kRecvOnly));
|
||||
}
|
||||
@ -2591,6 +2621,30 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithIceOptions) {
|
||||
EXPECT_TRUE(CompareSessionDescription(jdesc_, jdesc_with_ice_options));
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithOpaqueTransportParams) {
|
||||
std::string sdp_with_transport_parameters = kSdpFullString;
|
||||
InjectAfter(kAttributeIcePwdVoice, "a=x-opaque:foo:dGVzdDY0\r\n",
|
||||
&sdp_with_transport_parameters);
|
||||
InjectAfter(kAttributeIcePwdVideo, "a=x-opaque:foo:dGVzdDY0\r\n",
|
||||
&sdp_with_transport_parameters);
|
||||
|
||||
JsepSessionDescription jdesc_with_transport_parameters(kDummyType);
|
||||
EXPECT_TRUE(SdpDeserialize(sdp_with_transport_parameters,
|
||||
&jdesc_with_transport_parameters));
|
||||
|
||||
cricket::OpaqueTransportParameters params;
|
||||
params.protocol = "foo";
|
||||
params.parameters = "test64";
|
||||
|
||||
AddOpaqueTransportParameters(kAudioContentName, params);
|
||||
AddOpaqueTransportParameters(kVideoContentName, params);
|
||||
|
||||
ASSERT_TRUE(jdesc_.Initialize(desc_.Clone(), jdesc_.session_id(),
|
||||
jdesc_.session_version()));
|
||||
EXPECT_TRUE(
|
||||
CompareSessionDescription(jdesc_, jdesc_with_transport_parameters));
|
||||
}
|
||||
|
||||
TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithUfragPwd) {
|
||||
// Remove the original ice-ufrag and ice-pwd
|
||||
JsepSessionDescription jdesc_with_ufrag_pwd(kDummyType);
|
||||
|
Reference in New Issue
Block a user