Replace hostCandidate with address and port in RTCPeerConnectionIceErrorEvent
Bug: chromium:1013564 Change-Id: Ie1bb86ed6a2a7d73fe6ee666f973d809ed05a7ed Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161084 Reviewed-by: Steve Anton <steveanton@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Eldar Rello <elrello@microsoft.com> Cr-Commit-Position: refs/heads/master@{#30004}
This commit is contained in:
parent
9c27ed23d2
commit
0095d37137
@ -1203,6 +1203,14 @@ class PeerConnectionObserver {
|
||||
int error_code,
|
||||
const std::string& error_text) {}
|
||||
|
||||
// Gathering of an ICE candidate failed.
|
||||
// See https://w3c.github.io/webrtc-pc/#event-icecandidateerror
|
||||
virtual void OnIceCandidateError(const std::string& address,
|
||||
int port,
|
||||
const std::string& url,
|
||||
int error_code,
|
||||
const std::string& error_text) {}
|
||||
|
||||
// Ice candidates have been removed.
|
||||
// TODO(honghaiz): Make this a pure virtual method when all its subclasses
|
||||
// implement it.
|
||||
|
||||
@ -128,16 +128,19 @@ struct ProtocolAddress {
|
||||
|
||||
struct IceCandidateErrorEvent {
|
||||
IceCandidateErrorEvent() = default;
|
||||
IceCandidateErrorEvent(std::string host_candidate,
|
||||
IceCandidateErrorEvent(std::string address,
|
||||
int port,
|
||||
std::string url,
|
||||
int error_code,
|
||||
std::string error_text)
|
||||
: host_candidate(std::move(host_candidate)),
|
||||
: address(std::move(address)),
|
||||
port(port),
|
||||
url(std::move(url)),
|
||||
error_code(error_code),
|
||||
error_text(std::move(error_text)) {}
|
||||
|
||||
std::string host_candidate;
|
||||
std::string address;
|
||||
int port = 0;
|
||||
std::string url;
|
||||
int error_code = 0;
|
||||
std::string error_text;
|
||||
|
||||
@ -544,8 +544,9 @@ void UDPPort::OnStunBindingOrResolveRequestFailed(
|
||||
rtc::StringBuilder url;
|
||||
url << "stun:" << stun_server_addr.ToString();
|
||||
SignalCandidateError(
|
||||
this, IceCandidateErrorEvent(GetLocalAddress().ToSensitiveString(),
|
||||
url.str(), error_code, reason));
|
||||
this, IceCandidateErrorEvent(GetLocalAddress().HostAsSensitiveURIString(),
|
||||
GetLocalAddress().port(), url.str(),
|
||||
error_code, reason));
|
||||
if (bind_request_failed_servers_.find(stun_server_addr) !=
|
||||
bind_request_failed_servers_.end()) {
|
||||
return;
|
||||
|
||||
@ -226,9 +226,8 @@ TEST_F(StunPortTest, TestPrepareAddressFail) {
|
||||
cricket::SERVER_NOT_REACHABLE_ERROR, kTimeoutMs,
|
||||
fake_clock);
|
||||
ASSERT_NE(error_event_.error_text.find("."), std::string::npos);
|
||||
ASSERT_NE(
|
||||
error_event_.host_candidate.find(kLocalAddr.HostAsSensitiveURIString()),
|
||||
std::string::npos);
|
||||
ASSERT_NE(error_event_.address.find(kLocalAddr.HostAsSensitiveURIString()),
|
||||
std::string::npos);
|
||||
std::string server_url = "stun:" + kBadAddr.ToString();
|
||||
ASSERT_EQ(error_event_.url, server_url);
|
||||
}
|
||||
|
||||
@ -885,7 +885,8 @@ void TurnPort::OnAllocateError(int error_code, const std::string& reason) {
|
||||
thread()->Post(RTC_FROM_HERE, this, MSG_ALLOCATE_ERROR);
|
||||
SignalCandidateError(
|
||||
this,
|
||||
IceCandidateErrorEvent(GetLocalAddress().ToSensitiveString(),
|
||||
IceCandidateErrorEvent(GetLocalAddress().HostAsSensitiveURIString(),
|
||||
GetLocalAddress().port(),
|
||||
ReconstructedServerUrl(true /* use_hostname */),
|
||||
error_code, reason));
|
||||
}
|
||||
|
||||
@ -931,9 +931,9 @@ TEST_F(TurnPortTest,
|
||||
EXPECT_EQ_SIMULATED_WAIT(error_event_.error_code, STUN_ERROR_GLOBAL_FAILURE,
|
||||
kSimulatedRtt, fake_clock_);
|
||||
ASSERT_NE(error_event_.error_text.find("."), std::string::npos);
|
||||
ASSERT_NE(
|
||||
error_event_.host_candidate.find(kLocalAddr2.HostAsSensitiveURIString()),
|
||||
std::string::npos);
|
||||
ASSERT_NE(error_event_.address.find(kLocalAddr2.HostAsSensitiveURIString()),
|
||||
std::string::npos);
|
||||
ASSERT_NE(error_event_.port, 0);
|
||||
std::string server_url =
|
||||
"turn:" + kTurnTcpIntAddr.ToString() + "?transport=tcp";
|
||||
ASSERT_EQ(error_event_.url, server_url);
|
||||
|
||||
@ -4736,14 +4736,17 @@ void PeerConnection::OnIceCandidate(
|
||||
Observer()->OnIceCandidate(candidate.get());
|
||||
}
|
||||
|
||||
void PeerConnection::OnIceCandidateError(const std::string& host_candidate,
|
||||
void PeerConnection::OnIceCandidateError(const std::string& address,
|
||||
int port,
|
||||
const std::string& url,
|
||||
int error_code,
|
||||
const std::string& error_text) {
|
||||
if (IsClosed()) {
|
||||
return;
|
||||
}
|
||||
Observer()->OnIceCandidateError(host_candidate, url, error_code, error_text);
|
||||
Observer()->OnIceCandidateError(address, port, url, error_code, error_text);
|
||||
// Leftover not to break wpt test during migration to the new API.
|
||||
Observer()->OnIceCandidateError(address + ":", url, error_code, error_text);
|
||||
}
|
||||
|
||||
void PeerConnection::OnIceCandidatesRemoved(
|
||||
@ -6348,7 +6351,7 @@ void PeerConnection::OnTransportControllerCandidatesGathered(
|
||||
|
||||
void PeerConnection::OnTransportControllerCandidateError(
|
||||
const cricket::IceCandidateErrorEvent& event) {
|
||||
OnIceCandidateError(event.host_candidate, event.url, event.error_code,
|
||||
OnIceCandidateError(event.address, event.port, event.url, event.error_code,
|
||||
event.error_text);
|
||||
}
|
||||
|
||||
|
||||
@ -569,7 +569,8 @@ class PeerConnection : public PeerConnectionInternal,
|
||||
void OnIceCandidate(std::unique_ptr<IceCandidateInterface> candidate)
|
||||
RTC_RUN_ON(signaling_thread());
|
||||
// Gathering of an ICE candidate failed.
|
||||
void OnIceCandidateError(const std::string& host_candidate,
|
||||
void OnIceCandidateError(const std::string& address,
|
||||
int port,
|
||||
const std::string& url,
|
||||
int error_code,
|
||||
const std::string& error_text)
|
||||
|
||||
@ -977,11 +977,12 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
|
||||
SendIceMessage(candidate->sdp_mid(), candidate->sdp_mline_index(), ice_sdp);
|
||||
last_candidate_gathered_ = candidate->candidate();
|
||||
}
|
||||
void OnIceCandidateError(const std::string& host_candidate,
|
||||
void OnIceCandidateError(const std::string& address,
|
||||
int port,
|
||||
const std::string& url,
|
||||
int error_code,
|
||||
const std::string& error_text) override {
|
||||
error_event_ = cricket::IceCandidateErrorEvent(host_candidate, url,
|
||||
error_event_ = cricket::IceCandidateErrorEvent(address, port, url,
|
||||
error_code, error_text);
|
||||
}
|
||||
void OnDataChannel(
|
||||
@ -5708,8 +5709,7 @@ TEST_P(PeerConnectionIntegrationTest, OnIceCandidateError) {
|
||||
EXPECT_EQ_WAIT(401, caller()->error_event().error_code, kDefaultTimeout);
|
||||
EXPECT_EQ("Unauthorized", caller()->error_event().error_text);
|
||||
EXPECT_EQ("turn:88.88.88.0:3478?transport=udp", caller()->error_event().url);
|
||||
EXPECT_NE(std::string::npos,
|
||||
caller()->error_event().host_candidate.find(":"));
|
||||
EXPECT_NE(caller()->error_event().address, "");
|
||||
}
|
||||
|
||||
TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
|
||||
|
||||
@ -79,12 +79,13 @@ class LambdaPeerConnectionObserver final : public PeerConnectionObserver {
|
||||
for (const auto& handler : handlers_->on_ice_candidate)
|
||||
handler(candidate);
|
||||
}
|
||||
void OnIceCandidateError(const std::string& host_candidate,
|
||||
void OnIceCandidateError(const std::string& address,
|
||||
int port,
|
||||
const std::string& url,
|
||||
int error_code,
|
||||
const std::string& error_text) override {
|
||||
for (const auto& handler : handlers_->on_ice_candidate_error)
|
||||
handler(host_candidate, url, error_code, error_text);
|
||||
handler(address, port, url, error_code, error_text);
|
||||
}
|
||||
void OnIceCandidatesRemoved(
|
||||
const std::vector<cricket::Candidate>& candidates) override {
|
||||
|
||||
@ -48,8 +48,11 @@ class PeerScenarioClient {
|
||||
on_ice_gathering_change;
|
||||
std::vector<std::function<void(const IceCandidateInterface*)>>
|
||||
on_ice_candidate;
|
||||
std::vector<std::function<
|
||||
void(const std::string&, const std::string&, int, const std::string&)>>
|
||||
std::vector<std::function<void(const std::string&,
|
||||
int,
|
||||
const std::string&,
|
||||
int,
|
||||
const std::string&)>>
|
||||
on_ice_candidate_error;
|
||||
std::vector<std::function<void(const std::vector<cricket::Candidate>&)>>
|
||||
on_ice_candidates_removed;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user