Skip to content

Commit 372d589

Browse files
horo-tCommit bot
authored and
Commit bot
committed
Revert of Use standard ICE in Chromoting. (patchset Pissandshittium#7 id:160001 of https://codereview.chromium.org/1085703003/)
Reason for revert: jingle_unittests failure on Mac ASan 64 Tests (1) https://build.chromium.org/p/chromium.memory/builders/Mac%20ASan%2064%20Tests%20%281%29/builds/805 BUG=480107 Original issue's description: > Use standard ICE in Chromoting. > > Previously we were using legacy, non-standard version of ICE. This > change adds ICE version negotiation and enabled standard ICE by default, > when both peers support it. > > BUG=473758 > > Committed: https://crrev.com/4b35571a3085aa960dcf5533fb2277d5dcaaf11f > Cr-Commit-Position: refs/heads/master@{#326435} TBR=rmsousa@chromium.org,wez@chromium.org,dcaiafa@chromium.org,sergeyu@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=473758 Review URL: https://codereview.chromium.org/1099203005 Cr-Commit-Position: refs/heads/master@{#326458}
1 parent 6a5a658 commit 372d589

27 files changed

+327
-743
lines changed

remoting/client/jni/chromoting_jni_instance.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,7 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
434434

435435
scoped_ptr<protocol::TransportFactory> transport_factory(
436436
new protocol::LibjingleTransportFactory(
437-
signaling_.get(), port_allocator.Pass(), network_settings,
438-
protocol::TransportRole::CLIENT));
437+
signaling_.get(), port_allocator.Pass(), network_settings));
439438

440439
client_->Start(signaling_.get(), authenticator_.Pass(),
441440
transport_factory.Pass(), host_jid_, capabilities_);

remoting/client/plugin/chromoting_instance.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -712,10 +712,10 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) {
712712
// Create TransportFactory.
713713
scoped_ptr<protocol::TransportFactory> transport_factory(
714714
new protocol::LibjingleTransportFactory(
715-
signal_strategy_.get(), PepperPortAllocator::Create(this).Pass(),
715+
signal_strategy_.get(),
716+
PepperPortAllocator::Create(this).Pass(),
716717
protocol::NetworkSettings(
717-
protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
718-
protocol::TransportRole::CLIENT));
718+
protocol::NetworkSettings::NAT_TRAVERSAL_FULL)));
719719

720720
// Create Authenticator.
721721
scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>

remoting/host/chromoting_host.cc

+3-5
Original file line numberDiff line numberDiff line change
@@ -285,17 +285,15 @@ void ChromotingHost::OnIncomingSession(
285285
return;
286286
}
287287

288-
scoped_ptr<protocol::SessionConfig> config =
289-
protocol::SessionConfig::SelectCommon(session->candidate_config(),
290-
protocol_config_.get());
291-
if (!config) {
288+
protocol::SessionConfig config;
289+
if (!protocol_config_->Select(session->candidate_config(), &config)) {
292290
LOG(WARNING) << "Rejecting connection from " << session->jid()
293291
<< " because no compatible configuration has been found.";
294292
*response = protocol::SessionManager::INCOMPATIBLE;
295293
return;
296294
}
297295

298-
session->set_config(config.Pass());
296+
session->set_config(config);
299297

300298
*response = protocol::SessionManager::ACCEPT;
301299

remoting/host/chromoting_host_unittest.cc

+12-8
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ class ChromotingHostTest : public testing::Test {
108108
session_jid1_ = "user@domain/rest-of-jid";
109109
session_config2_ = SessionConfig::ForTest();
110110
session_jid2_ = "user2@domain/rest-of-jid";
111+
session_unowned_config1_ = SessionConfig::ForTest();
111112
session_unowned_jid1_ = "user3@doman/rest-of-jid";
113+
session_unowned_config2_ = SessionConfig::ForTest();
112114
session_unowned_jid2_ = "user4@doman/rest-of-jid";
113115

114116
EXPECT_CALL(*session1_, jid())
@@ -130,9 +132,9 @@ class ChromotingHostTest : public testing::Test {
130132
.Times(AnyNumber())
131133
.WillRepeatedly(SaveArg<0>(&session_unowned2_event_handler_));
132134
EXPECT_CALL(*session1_, config())
133-
.WillRepeatedly(ReturnRef(*session_config1_));
135+
.WillRepeatedly(ReturnRef(session_config1_));
134136
EXPECT_CALL(*session2_, config())
135-
.WillRepeatedly(ReturnRef(*session_config2_));
137+
.WillRepeatedly(ReturnRef(session_config2_));
136138

137139
owned_connection1_.reset(new MockConnectionToClient(session1_,
138140
&host_stub1_));
@@ -419,7 +421,7 @@ class ChromotingHostTest : public testing::Test {
419421
ClientSession* client1_;
420422
std::string session_jid1_;
421423
MockSession* session1_; // Owned by |connection_|.
422-
scoped_ptr<SessionConfig> session_config1_;
424+
SessionConfig session_config1_;
423425
MockVideoStub video_stub1_;
424426
MockClientStub client_stub1_;
425427
MockHostStub host_stub1_;
@@ -428,13 +430,15 @@ class ChromotingHostTest : public testing::Test {
428430
ClientSession* client2_;
429431
std::string session_jid2_;
430432
MockSession* session2_; // Owned by |connection2_|.
431-
scoped_ptr<SessionConfig> session_config2_;
433+
SessionConfig session_config2_;
432434
MockVideoStub video_stub2_;
433435
MockClientStub client_stub2_;
434436
MockHostStub host_stub2_;
435437
scoped_ptr<MockSession> session_unowned1_; // Not owned by a connection.
438+
SessionConfig session_unowned_config1_;
436439
std::string session_unowned_jid1_;
437440
scoped_ptr<MockSession> session_unowned2_; // Not owned by a connection.
441+
SessionConfig session_unowned_config2_;
438442
std::string session_unowned_jid2_;
439443
protocol::Session::EventHandler* session_unowned1_event_handler_;
440444
protocol::Session::EventHandler* session_unowned2_event_handler_;
@@ -595,7 +599,7 @@ TEST_F(ChromotingHostTest, IncomingSessionAccepted) {
595599
ExpectHostAndSessionManagerStart();
596600
EXPECT_CALL(*session_unowned1_, candidate_config()).WillOnce(Return(
597601
default_candidate_config_.get()));
598-
EXPECT_CALL(*session_unowned1_, set_config_ptr(_));
602+
EXPECT_CALL(*session_unowned1_, set_config(_));
599603
EXPECT_CALL(*session_unowned1_, Close()).WillOnce(InvokeWithoutArgs(
600604
this, &ChromotingHostTest::NotifyConnectionClosed1));
601605
EXPECT_CALL(host_status_observer_, OnAccessDenied(_));
@@ -616,7 +620,7 @@ TEST_F(ChromotingHostTest, LoginBackOffUponConnection) {
616620
ExpectHostAndSessionManagerStart();
617621
EXPECT_CALL(*session_unowned1_, candidate_config()).WillOnce(
618622
Return(default_candidate_config_.get()));
619-
EXPECT_CALL(*session_unowned1_, set_config_ptr(_));
623+
EXPECT_CALL(*session_unowned1_, set_config(_));
620624
EXPECT_CALL(*session_unowned1_, Close()).WillOnce(
621625
InvokeWithoutArgs(this, &ChromotingHostTest::NotifyConnectionClosed1));
622626
EXPECT_CALL(host_status_observer_, OnAccessDenied(_));
@@ -642,13 +646,13 @@ TEST_F(ChromotingHostTest, LoginBackOffUponAuthenticating) {
642646
Expectation start = ExpectHostAndSessionManagerStart();
643647
EXPECT_CALL(*session_unowned1_, candidate_config()).WillOnce(
644648
Return(default_candidate_config_.get()));
645-
EXPECT_CALL(*session_unowned1_, set_config_ptr(_));
649+
EXPECT_CALL(*session_unowned1_, set_config(_));
646650
EXPECT_CALL(*session_unowned1_, Close()).WillOnce(
647651
InvokeWithoutArgs(this, &ChromotingHostTest::NotifyConnectionClosed1));
648652

649653
EXPECT_CALL(*session_unowned2_, candidate_config()).WillOnce(
650654
Return(default_candidate_config_.get()));
651-
EXPECT_CALL(*session_unowned2_, set_config_ptr(_));
655+
EXPECT_CALL(*session_unowned2_, set_config(_));
652656
EXPECT_CALL(*session_unowned2_, Close()).WillOnce(
653657
InvokeWithoutArgs(this, &ChromotingHostTest::NotifyConnectionClosed2));
654658

remoting/host/client_session_unittest.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class ClientSessionTest : public testing::Test {
178178
MockClientSessionEventHandler session_event_handler_;
179179

180180
// Storage for values to be returned by the protocol::Session mock.
181-
scoped_ptr<SessionConfig> session_config_;
181+
SessionConfig session_config_;
182182
const std::string client_jid_;
183183

184184
// Stubs returned to |client_session_| components by |connection_|.
@@ -224,7 +224,7 @@ void ClientSessionTest::TearDown() {
224224
void ClientSessionTest::CreateClientSession() {
225225
// Mock protocol::Session APIs called directly by ClientSession.
226226
protocol::MockSession* session = new MockSession();
227-
EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_));
227+
EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_));
228228
EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_));
229229
EXPECT_CALL(*session, SetEventHandler(_));
230230

remoting/host/session_manager_factory.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ scoped_ptr<protocol::SessionManager> CreateHostSessionManager(
2525

2626
scoped_ptr<protocol::TransportFactory> transport_factory(
2727
new protocol::LibjingleTransportFactory(
28-
signal_strategy, port_allocator.Pass(), network_settings,
29-
protocol::TransportRole::SERVER));
28+
signal_strategy, port_allocator.Pass(), network_settings));
3029

3130
scoped_ptr<protocol::JingleSessionManager> session_manager(
3231
new protocol::JingleSessionManager(transport_factory.Pass()));

remoting/protocol/content_description.cc

+23-19
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const char kDefaultNs[] = "";
2525

2626
// Following constants are used to format session description in XML.
2727
const char kDescriptionTag[] = "description";
28-
const char kStandardIceTag[] = "standard-ice";
2928
const char kControlTag[] = "control";
3029
const char kEventTag[] = "event";
3130
const char kVideoTag[] = "video";
@@ -122,10 +121,17 @@ ContentDescription::ContentDescription(
122121

123122
ContentDescription::~ContentDescription() { }
124123

124+
ContentDescription* ContentDescription::Copy() const {
125+
if (!candidate_config_.get() || !authenticator_message_.get()) {
126+
return nullptr;
127+
}
128+
scoped_ptr<XmlElement> message(new XmlElement(*authenticator_message_));
129+
return new ContentDescription(candidate_config_->Clone(), message.Pass());
130+
}
131+
125132
// ToXml() creates content description for chromoting session. The
126133
// description looks as follows:
127134
// <description xmlns="google:remoting">
128-
// <standard-ice/>
129135
// <control transport="stream" version="1" />
130136
// <event transport="datagram" version="1" />
131137
// <video transport="stream" codec="vp8" version="1" />
@@ -139,25 +145,27 @@ XmlElement* ContentDescription::ToXml() const {
139145
XmlElement* root = new XmlElement(
140146
QName(kChromotingXmlNamespace, kDescriptionTag), true);
141147

142-
if (config()->standard_ice()) {
143-
root->AddElement(
144-
new buzz::XmlElement(QName(kChromotingXmlNamespace, kStandardIceTag)));
145-
}
148+
std::list<ChannelConfig>::const_iterator it;
146149

147-
for (const ChannelConfig& channel_config : config()->control_configs()) {
148-
root->AddElement(FormatChannelConfig(channel_config, kControlTag));
150+
for (it = config()->control_configs().begin();
151+
it != config()->control_configs().end(); ++it) {
152+
root->AddElement(FormatChannelConfig(*it, kControlTag));
149153
}
150154

151-
for (const ChannelConfig& channel_config : config()->event_configs()) {
152-
root->AddElement(FormatChannelConfig(channel_config, kEventTag));
155+
for (it = config()->event_configs().begin();
156+
it != config()->event_configs().end(); ++it) {
157+
root->AddElement(FormatChannelConfig(*it, kEventTag));
153158
}
154159

155-
for (const ChannelConfig& channel_config : config()->video_configs()) {
156-
root->AddElement(FormatChannelConfig(channel_config, kVideoTag));
160+
for (it = config()->video_configs().begin();
161+
it != config()->video_configs().end(); ++it) {
162+
root->AddElement(FormatChannelConfig(*it, kVideoTag));
157163
}
158164

159-
for (const ChannelConfig& channel_config : config()->audio_configs()) {
160-
root->AddElement(FormatChannelConfig(channel_config, kAudioTag));
165+
for (it = config()->audio_configs().begin();
166+
it != config()->audio_configs().end(); ++it) {
167+
ChannelConfig config = *it;
168+
root->AddElement(FormatChannelConfig(config, kAudioTag));
161169
}
162170

163171
// Older endpoints require an initial-resolution tag, but otherwise ignore it.
@@ -184,6 +192,7 @@ bool ContentDescription::ParseChannelConfigs(
184192
bool codec_required,
185193
bool optional,
186194
std::list<ChannelConfig>* const configs) {
195+
187196
QName tag(kChromotingXmlNamespace, tag_name);
188197
const XmlElement* child = element->FirstNamed(tag);
189198
while (child) {
@@ -209,11 +218,6 @@ scoped_ptr<ContentDescription> ContentDescription::ParseXml(
209218
}
210219
scoped_ptr<CandidateSessionConfig> config(
211220
CandidateSessionConfig::CreateEmpty());
212-
213-
config->set_standard_ice(
214-
element->FirstNamed(QName(kChromotingXmlNamespace, kStandardIceTag)) !=
215-
nullptr);
216-
217221
if (!ParseChannelConfigs(element, kControlTag, false, false,
218222
config->mutable_control_configs()) ||
219223
!ParseChannelConfigs(element, kEventTag, false, false,

remoting/protocol/content_description.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "base/memory/ref_counted.h"
1111
#include "base/memory/scoped_ptr.h"
1212
#include "remoting/protocol/session_config.h"
13+
#include "third_party/webrtc/p2p/base/sessiondescription.h"
1314

1415
namespace buzz {
1516
class XmlElement;
@@ -23,13 +24,15 @@ namespace protocol {
2324
//
2425
// This class also provides a type abstraction so that the Chromotocol Session
2526
// interface does not need to depend on libjingle.
26-
class ContentDescription {
27+
class ContentDescription : public cricket::ContentDescription {
2728
public:
2829
static const char kChromotingContentName[];
2930

3031
ContentDescription(scoped_ptr<CandidateSessionConfig> config,
3132
scoped_ptr<buzz::XmlElement> authenticator_message);
32-
~ContentDescription();
33+
~ContentDescription() override;
34+
35+
ContentDescription* Copy() const override;
3336

3437
const CandidateSessionConfig* config() const {
3538
return candidate_config_.get();

remoting/protocol/fake_connection_to_host.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void FakeConnectionToHost::SignalConnectionReady(bool ready) {
8585
}
8686

8787
const protocol::SessionConfig& FakeConnectionToHost::config() {
88-
return *session_config_;
88+
return session_config_;
8989
}
9090

9191
protocol::ClipboardStub* FakeConnectionToHost::clipboard_forwarder() {

remoting/protocol/fake_connection_to_host.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FakeConnectionToHost : public protocol::ConnectionToHost {
5454
testing::NiceMock<protocol::MockClipboardStub> mock_clipboard_stub_;
5555
testing::NiceMock<protocol::MockHostStub> mock_host_stub_;
5656
testing::NiceMock<protocol::MockInputStub> mock_input_stub_;
57-
scoped_ptr<protocol::SessionConfig> session_config_;
57+
protocol::SessionConfig session_config_;
5858

5959
DISALLOW_COPY_AND_ASSIGN(FakeConnectionToHost);
6060
};

remoting/protocol/fake_session.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const CandidateSessionConfig* FakeSession::candidate_config() {
3636
}
3737

3838
const SessionConfig& FakeSession::config() {
39-
return *config_;
39+
return config_;
4040
}
4141

42-
void FakeSession::set_config(scoped_ptr<SessionConfig> config) {
43-
config_ = config.Pass();
42+
void FakeSession::set_config(const SessionConfig& config) {
43+
config_ = config;
4444
}
4545

4646
StreamChannelFactory* FakeSession::GetTransportChannelFactory() {

remoting/protocol/fake_session.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ class FakeSession : public Session {
3939
const std::string& jid() override;
4040
const CandidateSessionConfig* candidate_config() override;
4141
const SessionConfig& config() override;
42-
void set_config(scoped_ptr<SessionConfig> config) override;
42+
void set_config(const SessionConfig& config) override;
4343
StreamChannelFactory* GetTransportChannelFactory() override;
4444
StreamChannelFactory* GetMultiplexedChannelFactory() override;
4545
void Close() override;
4646

4747
public:
4848
EventHandler* event_handler_;
4949
scoped_ptr<const CandidateSessionConfig> candidate_config_;
50-
scoped_ptr<SessionConfig> config_;
50+
SessionConfig config_;
5151

5252
FakeStreamChannelFactory channel_factory_;
5353

0 commit comments

Comments
 (0)