Delete OpaqueTransportParameters and SDP attribute x-otp
It was used only to provide parameters for MediaTransport. Bug: webrtc:9719 Change-Id: I42e451ef84251ecf2b15010c7a3923b6fa2436be Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177350 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Taylor <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31541}
This commit is contained in:
parent
976faae028
commit
c6d6e06a5c
@ -172,8 +172,7 @@ TransportDescription::TransportDescription(const TransportDescription& from)
|
||||
ice_pwd(from.ice_pwd),
|
||||
ice_mode(from.ice_mode),
|
||||
connection_role(from.connection_role),
|
||||
identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())),
|
||||
opaque_parameters(from.opaque_parameters) {}
|
||||
identity_fingerprint(CopyFingerprint(from.identity_fingerprint.get())) {}
|
||||
|
||||
TransportDescription::~TransportDescription() = default;
|
||||
|
||||
@ -190,7 +189,6 @@ TransportDescription& TransportDescription::operator=(
|
||||
connection_role = from.connection_role;
|
||||
|
||||
identity_fingerprint.reset(CopyFingerprint(from.identity_fingerprint.get()));
|
||||
opaque_parameters = from.opaque_parameters;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -100,28 +100,6 @@ constexpr auto* ICE_OPTION_RENOMINATION = "renomination";
|
||||
bool StringToConnectionRole(const std::string& role_str, ConnectionRole* role);
|
||||
bool ConnectionRoleToString(const ConnectionRole& role, std::string* role_str);
|
||||
|
||||
// Parameters for an opaque transport protocol which may be plugged into WebRTC.
|
||||
struct OpaqueTransportParameters {
|
||||
// Protocol used by this opaque transport. Two endpoints that support the
|
||||
// same protocol are expected to be able to understand the contents of each
|
||||
// others' |parameters| fields. If those parameters are compatible, the
|
||||
// endpoints are expected to use this transport protocol.
|
||||
std::string protocol;
|
||||
|
||||
// Opaque parameters for this transport. These parameters are serialized in a
|
||||
// manner determined by the |protocol|. They can be parsed and understood by
|
||||
// the plugin that supports |protocol|.
|
||||
std::string parameters;
|
||||
|
||||
bool operator==(const OpaqueTransportParameters& other) const {
|
||||
return protocol == other.protocol && parameters == other.parameters;
|
||||
}
|
||||
|
||||
bool operator!=(const OpaqueTransportParameters& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
struct TransportDescription {
|
||||
TransportDescription();
|
||||
TransportDescription(const std::vector<std::string>& transport_options,
|
||||
@ -168,7 +146,6 @@ struct TransportDescription {
|
||||
ConnectionRole connection_role;
|
||||
|
||||
std::unique_ptr<rtc::SSLFingerprint> identity_fingerprint;
|
||||
absl::optional<OpaqueTransportParameters> opaque_parameters;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -55,8 +55,6 @@ std::unique_ptr<TransportDescription> TransportDescriptionFactory::CreateOffer(
|
||||
}
|
||||
}
|
||||
|
||||
desc->opaque_parameters = options.opaque_parameters;
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
@ -110,13 +108,6 @@ std::unique_ptr<TransportDescription> TransportDescriptionFactory::CreateAnswer(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Answers may only attach opaque parameters if the offer contained them as
|
||||
// well. The answer's parameters may differ, and it's up to the opaque
|
||||
// transport implementation to decide if the difference is acceptable.
|
||||
if (offer->opaque_parameters && options.opaque_parameters) {
|
||||
desc->opaque_parameters = options.opaque_parameters;
|
||||
}
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
@ -29,9 +29,6 @@ struct TransportOptions {
|
||||
// If true, ICE renomination is supported and will be used if it is also
|
||||
// supported by the remote side.
|
||||
bool enable_ice_renomination = false;
|
||||
|
||||
// Opaque parameters for plug-in transports.
|
||||
absl::optional<OpaqueTransportParameters> opaque_parameters;
|
||||
};
|
||||
|
||||
// Creates transport descriptions according to the supplied configuration.
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
using cricket::OpaqueTransportParameters;
|
||||
using cricket::TransportDescription;
|
||||
using cricket::TransportDescriptionFactory;
|
||||
using cricket::TransportOptions;
|
||||
@ -210,73 +209,6 @@ TEST_F(TransportDescriptionFactoryTest, TestOfferDtlsReofferDtls) {
|
||||
CheckDesc(desc.get(), "", old_desc->ice_ufrag, old_desc->ice_pwd, digest_alg);
|
||||
}
|
||||
|
||||
TEST_F(TransportDescriptionFactoryTest, TestOfferOpaqueTransportParameters) {
|
||||
OpaqueTransportParameters params;
|
||||
params.protocol = "fake";
|
||||
params.parameters = "foobar";
|
||||
|
||||
TransportOptions options;
|
||||
options.opaque_parameters = params;
|
||||
|
||||
std::unique_ptr<TransportDescription> desc =
|
||||
f1_.CreateOffer(options, NULL, &ice_credentials_);
|
||||
|
||||
CheckDesc(desc.get(), "", "", "", "");
|
||||
EXPECT_EQ(desc->opaque_parameters, params);
|
||||
}
|
||||
|
||||
TEST_F(TransportDescriptionFactoryTest, TestAnswerOpaqueTransportParameters) {
|
||||
OpaqueTransportParameters params;
|
||||
params.protocol = "fake";
|
||||
params.parameters = "foobar";
|
||||
|
||||
TransportOptions options;
|
||||
options.opaque_parameters = params;
|
||||
|
||||
std::unique_ptr<TransportDescription> offer =
|
||||
f1_.CreateOffer(options, NULL, &ice_credentials_);
|
||||
std::unique_ptr<TransportDescription> answer =
|
||||
f2_.CreateAnswer(offer.get(), options, true, NULL, &ice_credentials_);
|
||||
|
||||
CheckDesc(answer.get(), "", "", "", "");
|
||||
EXPECT_EQ(answer->opaque_parameters, params);
|
||||
}
|
||||
|
||||
TEST_F(TransportDescriptionFactoryTest, TestAnswerNoOpaqueTransportParameters) {
|
||||
OpaqueTransportParameters params;
|
||||
params.protocol = "fake";
|
||||
params.parameters = "foobar";
|
||||
|
||||
TransportOptions options;
|
||||
options.opaque_parameters = params;
|
||||
|
||||
std::unique_ptr<TransportDescription> offer =
|
||||
f1_.CreateOffer(options, NULL, &ice_credentials_);
|
||||
std::unique_ptr<TransportDescription> answer = f2_.CreateAnswer(
|
||||
offer.get(), TransportOptions(), true, NULL, &ice_credentials_);
|
||||
|
||||
CheckDesc(answer.get(), "", "", "", "");
|
||||
EXPECT_EQ(answer->opaque_parameters, absl::nullopt);
|
||||
}
|
||||
|
||||
TEST_F(TransportDescriptionFactoryTest,
|
||||
TestAnswerNoOpaqueTransportParametersInOffer) {
|
||||
std::unique_ptr<TransportDescription> offer =
|
||||
f1_.CreateOffer(TransportOptions(), NULL, &ice_credentials_);
|
||||
|
||||
OpaqueTransportParameters params;
|
||||
params.protocol = "fake";
|
||||
params.parameters = "foobar";
|
||||
|
||||
TransportOptions options;
|
||||
options.opaque_parameters = params;
|
||||
std::unique_ptr<TransportDescription> answer =
|
||||
f2_.CreateAnswer(offer.get(), options, true, NULL, &ice_credentials_);
|
||||
|
||||
CheckDesc(answer.get(), "", "", "", "");
|
||||
EXPECT_EQ(answer->opaque_parameters, absl::nullopt);
|
||||
}
|
||||
|
||||
TEST_F(TransportDescriptionFactoryTest, TestAnswerDefault) {
|
||||
std::unique_ptr<TransportDescription> offer =
|
||||
f1_.CreateOffer(TransportOptions(), NULL, &ice_credentials_);
|
||||
|
||||
@ -1496,10 +1496,4 @@ void JsepTransportController::OnDtlsHandshakeError(
|
||||
SignalDtlsHandshakeError(error);
|
||||
}
|
||||
|
||||
// TODO(nisse): Delete
|
||||
absl::optional<cricket::OpaqueTransportParameters>
|
||||
JsepTransportController::GetTransportParameters(const std::string& mid) {
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -191,13 +191,6 @@ class JsepTransportController : public sigslot::has_slots<> {
|
||||
// and deletes unused transports, but doesn't consider anything more complex.
|
||||
void RollbackTransports();
|
||||
|
||||
// Gets the transport parameters for the transport identified by |mid|.
|
||||
// If |mid| is bundled, returns the parameters for the bundled transport.
|
||||
// If the transport for |mid| has not been created yet, it may be allocated in
|
||||
// order to generate transport parameters.
|
||||
absl::optional<cricket::OpaqueTransportParameters> GetTransportParameters(
|
||||
const std::string& mid);
|
||||
|
||||
// All of these signals are fired on the signaling thread.
|
||||
|
||||
// If any transport failed => failed,
|
||||
|
||||
@ -439,15 +439,12 @@ static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group,
|
||||
selected_transport_info->description.ice_pwd;
|
||||
ConnectionRole selected_connection_role =
|
||||
selected_transport_info->description.connection_role;
|
||||
const absl::optional<OpaqueTransportParameters>& selected_opaque_parameters =
|
||||
selected_transport_info->description.opaque_parameters;
|
||||
for (TransportInfo& transport_info : sdesc->transport_infos()) {
|
||||
if (bundle_group.HasContentName(transport_info.content_name) &&
|
||||
transport_info.content_name != selected_content_name) {
|
||||
transport_info.description.ice_ufrag = selected_ufrag;
|
||||
transport_info.description.ice_pwd = selected_pwd;
|
||||
transport_info.description.connection_role = selected_connection_role;
|
||||
transport_info.description.opaque_parameters = selected_opaque_parameters;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -541,9 +541,6 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
|
||||
EXPECT_EQ(
|
||||
media_desc_options_it->transport_options.enable_ice_renomination,
|
||||
GetIceRenomination(ti_audio));
|
||||
EXPECT_EQ(media_desc_options_it->transport_options.opaque_parameters,
|
||||
ti_audio->description.opaque_parameters);
|
||||
|
||||
} else {
|
||||
EXPECT_TRUE(ti_audio == NULL);
|
||||
}
|
||||
@ -556,8 +553,6 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
|
||||
EXPECT_EQ(ti_audio->description.ice_ufrag,
|
||||
ti_video->description.ice_ufrag);
|
||||
EXPECT_EQ(ti_audio->description.ice_pwd, ti_video->description.ice_pwd);
|
||||
EXPECT_EQ(ti_audio->description.opaque_parameters,
|
||||
ti_video->description.opaque_parameters);
|
||||
} else {
|
||||
if (has_current_desc) {
|
||||
EXPECT_EQ(current_video_ufrag, ti_video->description.ice_ufrag);
|
||||
@ -568,8 +563,6 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
|
||||
EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
|
||||
ti_video->description.ice_pwd.size());
|
||||
}
|
||||
EXPECT_EQ(media_desc_options_it->transport_options.opaque_parameters,
|
||||
ti_video->description.opaque_parameters);
|
||||
}
|
||||
EXPECT_EQ(
|
||||
media_desc_options_it->transport_options.enable_ice_renomination,
|
||||
@ -3631,46 +3624,6 @@ TEST_F(MediaSessionDescriptionFactoryTest,
|
||||
TestTransportInfo(false, options, true);
|
||||
}
|
||||
|
||||
TEST_F(MediaSessionDescriptionFactoryTest,
|
||||
TestTransportInfoOfferBundlesTransportOptions) {
|
||||
MediaSessionOptions options;
|
||||
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &options);
|
||||
|
||||
cricket::OpaqueTransportParameters audio_params;
|
||||
audio_params.protocol = "audio-transport";
|
||||
audio_params.parameters = "audio-params";
|
||||
FindFirstMediaDescriptionByMid("audio", &options)
|
||||
->transport_options.opaque_parameters = audio_params;
|
||||
|
||||
cricket::OpaqueTransportParameters video_params;
|
||||
video_params.protocol = "video-transport";
|
||||
video_params.parameters = "video-params";
|
||||
FindFirstMediaDescriptionByMid("video", &options)
|
||||
->transport_options.opaque_parameters = video_params;
|
||||
|
||||
TestTransportInfo(/*offer=*/true, options, /*has_current_desc=*/false);
|
||||
}
|
||||
|
||||
TEST_F(MediaSessionDescriptionFactoryTest,
|
||||
TestTransportInfoAnswerBundlesTransportOptions) {
|
||||
MediaSessionOptions options;
|
||||
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &options);
|
||||
|
||||
cricket::OpaqueTransportParameters audio_params;
|
||||
audio_params.protocol = "audio-transport";
|
||||
audio_params.parameters = "audio-params";
|
||||
FindFirstMediaDescriptionByMid("audio", &options)
|
||||
->transport_options.opaque_parameters = audio_params;
|
||||
|
||||
cricket::OpaqueTransportParameters video_params;
|
||||
video_params.protocol = "video-transport";
|
||||
video_params.parameters = "video-params";
|
||||
FindFirstMediaDescriptionByMid("video", &options)
|
||||
->transport_options.opaque_parameters = video_params;
|
||||
|
||||
TestTransportInfo(/*offer=*/false, options, /*has_current_desc=*/false);
|
||||
}
|
||||
|
||||
TEST_F(MediaSessionDescriptionFactoryTest, AltProtocolAddedToOffer) {
|
||||
MediaSessionOptions options;
|
||||
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &options);
|
||||
|
||||
@ -229,9 +229,6 @@ static const char kApplicationSpecificMaximum[] = "AS";
|
||||
|
||||
static const char kDefaultSctpmapProtocol[] = "webrtc-datachannel";
|
||||
|
||||
// This is a non-standardized setting for plugin transports.
|
||||
static const char kOpaqueTransportParametersLine[] = "x-opaque";
|
||||
|
||||
// This is a non-standardized setting for plugin transports.
|
||||
static const char kAltProtocolLine[] = "x-alt-protocol";
|
||||
|
||||
@ -523,17 +520,6 @@ static void InitAttrLine(const std::string& attribute, rtc::StringBuilder* os) {
|
||||
InitLine(kLineTypeAttributes, attribute, os);
|
||||
}
|
||||
|
||||
// Adds an x-otp SDP attribute line based on opaque transport parameters.
|
||||
static void AddOpaqueTransportLine(
|
||||
const cricket::OpaqueTransportParameters params,
|
||||
std::string* message) {
|
||||
rtc::StringBuilder os;
|
||||
InitAttrLine(kOpaqueTransportParametersLine, &os);
|
||||
os << kSdpDelimiterColon << params.protocol << kSdpDelimiterColon
|
||||
<< rtc::Base64::Encode(params.parameters);
|
||||
AddLine(os.str(), message);
|
||||
}
|
||||
|
||||
static void AddAltProtocolLine(const std::string& protocol,
|
||||
std::string* message) {
|
||||
rtc::StringBuilder os;
|
||||
@ -1532,11 +1518,6 @@ void BuildMediaDescription(const ContentInfo* content_info,
|
||||
AddLine(os.str(), message);
|
||||
}
|
||||
}
|
||||
|
||||
if (transport_info->description.opaque_parameters) {
|
||||
AddOpaqueTransportLine(*transport_info->description.opaque_parameters,
|
||||
message);
|
||||
}
|
||||
}
|
||||
|
||||
if (media_desc->alt_protocol()) {
|
||||
@ -2105,26 +2086,6 @@ bool ParseConnectionData(const std::string& line,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParseOpaqueTransportLine(const std::string& line,
|
||||
std::string* protocol,
|
||||
std::string* transport_parameters,
|
||||
SdpParseError* error) {
|
||||
std::string value;
|
||||
if (!GetValue(line, kOpaqueTransportParametersLine, &value, error)) {
|
||||
return false;
|
||||
}
|
||||
std::string tmp_parameters;
|
||||
if (!rtc::tokenize_first(value, kSdpDelimiterColonChar, protocol,
|
||||
&tmp_parameters)) {
|
||||
return ParseFailedGetValue(line, kOpaqueTransportParametersLine, error);
|
||||
}
|
||||
if (!rtc::Base64::Decode(tmp_parameters, rtc::Base64::DO_STRICT,
|
||||
transport_parameters, nullptr)) {
|
||||
return ParseFailedGetValue(line, kOpaqueTransportParametersLine, error);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParseAltProtocolLine(const std::string& line,
|
||||
std::string* protocol,
|
||||
SdpParseError* error) {
|
||||
@ -3137,13 +3098,6 @@ bool ParseContent(const std::string& message,
|
||||
if (!ParseIceOptions(line, &transport->transport_options, error)) {
|
||||
return false;
|
||||
}
|
||||
} else if (HasAttribute(line, kOpaqueTransportParametersLine)) {
|
||||
transport->opaque_parameters = cricket::OpaqueTransportParameters();
|
||||
if (!ParseOpaqueTransportLine(
|
||||
line, &transport->opaque_parameters->protocol,
|
||||
&transport->opaque_parameters->parameters, error)) {
|
||||
return false;
|
||||
}
|
||||
} else if (HasAttribute(line, kAltProtocolLine)) {
|
||||
std::string alt_protocol;
|
||||
if (!ParseAltProtocolLine(line, &alt_protocol, error)) {
|
||||
|
||||
@ -1584,8 +1584,6 @@ 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
|
||||
@ -1679,15 +1677,6 @@ 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 AddAltProtocol(const std::string& content_name,
|
||||
const std::string& alt_protocol) {
|
||||
ASSERT_TRUE(desc_.GetTransportInfoByName(content_name) != NULL);
|
||||
@ -2236,25 +2225,6 @@ 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, SerializeSessionDescriptionWithAltProtocol) {
|
||||
AddAltProtocol(kAudioContentName, "foo");
|
||||
AddAltProtocol(kVideoContentName, "bar");
|
||||
@ -2683,30 +2653,6 @@ 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, DeserializeSessionDescriptionWithAltProtocol) {
|
||||
std::string sdp_with_alt_protocol = kSdpFullString;
|
||||
InjectAfter(kAttributeIcePwdVoice, "a=x-alt-protocol:foo\r\n",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user