Diff
Modified: trunk/LayoutTests/ChangeLog (211829 => 211830)
--- trunk/LayoutTests/ChangeLog 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/LayoutTests/ChangeLog 2017-02-07 20:19:09 UTC (rev 211830)
@@ -1,3 +1,15 @@
+2017-02-07 Youenn Fablet <youe...@gmail.com>
+
+ [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
+ https://bugs.webkit.org/show_bug.cgi?id=167939
+
+ Reviewed by Sam Weinig.
+
+ * webrtc/no-port-zero-in-upd-candidates.html: Added.
+ * webrtc/no-port-zero-in-upd-candidates-expected.txt: Added.
+ * webrtc/video.html:
+ * webrtc/video-expected.txt: Added.
+
2017-02-07 Yusuke Suzuki <utatane....@gmail.com>
Unreviewed, manual roll out of r211777
Added: trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt (0 => 211830)
--- trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates-expected.txt 2017-02-07 20:19:09 UTC (rev 211830)
@@ -0,0 +1,3 @@
+
+PASS Checking UDP ICE candidate ports
+
Added: trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html (0 => 211830)
--- trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html (rev 0)
+++ trunk/LayoutTests/webrtc/no-port-zero-in-upd-candidates.html 2017-02-07 20:19:09 UTC (rev 211830)
@@ -0,0 +1,51 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Ensuring ICE UDP candidates have a valid port</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+
+if (window.internals)
+ internals.useMockRTCPeerConnectionFactory("OneRealPeerConnection");
+
+function gatherCandidates(pc)
+{
+ var candidates = [];
+ return new Promise((resolve, reject) => {
+ pc._onicecandidate_ = (event) => {
+ if (event.candidate === null) {
+ resolve(candidates);
+ return;
+ }
+ candidates.push(event.candidate.candidate);
+ };
+ pc.createOffer().then((offer) => {
+ pc.setLocalDescription(offer);
+ });
+ });
+}
+
+promise_test((test) => {
+ var pc = new RTCPeerConnection();
+ pc.createDataChannel("");
+
+ var hasCandidate = false;
+ return gatherCandidates(pc).then((candidates) => {
+ for(candidate of candidates) {
+ if (candidate.toLowerCase().indexOf(" udp ") === -1)
+ continue;
+ items = candidate.split(" ");
+ var port = parseInt(items[5]);
+ assert_true(port > 1024, "port is expected to be above 1024 but was " + port);
+ hasCandidate = true;
+ }
+ assert_true(hasCandidate, "Candidates should be gathered");
+ });
+}, "Checking UDP ICE candidate ports");
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/webrtc/video-expected.txt (0 => 211830)
--- trunk/LayoutTests/webrtc/video-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/video-expected.txt 2017-02-07 20:19:09 UTC (rev 211830)
@@ -0,0 +1,4 @@
+
+
+PASS Basic video exchange
+
Modified: trunk/LayoutTests/webrtc/video.html (211829 => 211830)
--- trunk/LayoutTests/webrtc/video.html 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/LayoutTests/webrtc/video.html 2017-02-07 20:19:09 UTC (rev 211830)
@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
- <title>Testing basic data channel from offerer to receiver</title>
+ <title>Testing basic video exchange from offerer to receiver</title>
<script src=""
<script src=""
</head>
Modified: trunk/Source/WebCore/ChangeLog (211829 => 211830)
--- trunk/Source/WebCore/ChangeLog 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebCore/ChangeLog 2017-02-07 20:19:09 UTC (rev 211830)
@@ -1,3 +1,15 @@
+2017-02-07 Youenn Fablet <youe...@gmail.com>
+
+ [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
+ https://bugs.webkit.org/show_bug.cgi?id=167939
+
+ Reviewed by Sam Weinig.
+
+ Test: webrtc/no-port-zero-in-upd-candidates.html
+
+ * testing/MockLibWebRTCPeerConnection.cpp:
+ (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): Adding a way to create one real PC in WTR environment.
+
2017-02-07 Sam Weinig <s...@webkit.org>
Update bindings tests results for additional include.
Modified: trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp (211829 => 211830)
--- trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp 2017-02-07 20:19:09 UTC (rev 211830)
@@ -92,8 +92,12 @@
: m_provider(provider)
, m_testCase(WTFMove(testCase))
{
- if (m_testCase == "TwoRealPeerConnections" && m_provider)
+ if (m_testCase == "TwoRealPeerConnections" && m_provider) {
m_numberOfRealPeerConnections = 2;
+ return;
+ }
+ if (m_testCase == "OneRealPeerConnection" && m_provider)
+ m_numberOfRealPeerConnections = 1;
}
rtc::scoped_refptr<webrtc::PeerConnectionInterface> MockLibWebRTCPeerConnectionFactory::CreatePeerConnection(const webrtc::PeerConnectionInterface::RTCConfiguration&, std::unique_ptr<cricket::PortAllocator>, std::unique_ptr<rtc::RTCCertificateGeneratorInterface>, webrtc::PeerConnectionObserver* observer)
Modified: trunk/Source/WebKit2/ChangeLog (211829 => 211830)
--- trunk/Source/WebKit2/ChangeLog 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/ChangeLog 2017-02-07 20:19:09 UTC (rev 211830)
@@ -1,3 +1,28 @@
+2017-02-07 Youenn Fablet <youe...@gmail.com>
+
+ [WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates
+ https://bugs.webkit.org/show_bug.cgi?id=167939
+
+ Reviewed by Sam Weinig.
+
+ AddressReady signalling was done by the WebProcess for UDP and ServerTCP as real async sockets in those case do
+ not send it. But the WebProcess does not have information on the port, as it is assigned by the socket factory
+ which is in the network process.
+
+ Fixed that bug by signalling AddressReady in the network process for UDP, ServerTCP and ClientTCP.
+
+ * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:
+ (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient):
+ (WebKit::LibWebRTCSocketClient::signalAddressReady):
+ * NetworkProcess/webrtc/LibWebRTCSocketClient.h:
+ * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+ (WebKit::NetworkRTCProvider::createUDPSocket):
+ (WebKit::NetworkRTCProvider::createServerTCPSocket):
+ (WebKit::NetworkRTCProvider::createClientTCPSocket):
+ * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
+ (WebKit::LibWebRTCSocket::LibWebRTCSocket):
+ (WebKit::LibWebRTCSocket::signalAddressReady):
+
2017-02-07 Sam Weinig <s...@webkit.org>
Try to fix the EFL build.
Modified: trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp (211829 => 211830)
--- trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp 2017-02-07 20:19:09 UTC (rev 211830)
@@ -37,7 +37,7 @@
namespace WebKit {
-LibWebRTCSocketClient::LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider& rtcProvider, std::unique_ptr<rtc::AsyncPacketSocket>&& socket)
+LibWebRTCSocketClient::LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider& rtcProvider, std::unique_ptr<rtc::AsyncPacketSocket>&& socket, Type type)
: m_identifier(identifier)
, m_rtcProvider(rtcProvider)
, m_socket(WTFMove(socket))
@@ -51,9 +51,14 @@
m_socket->SignalReadPacket.connect(this, &LibWebRTCSocketClient::signalReadPacket);
m_socket->SignalSentPacket.connect(this, &LibWebRTCSocketClient::signalSentPacket);
- m_socket->SignalAddressReady.connect(this, &LibWebRTCSocketClient::signalAddressReady);
m_socket->SignalConnect.connect(this, &LibWebRTCSocketClient::signalConnect);
m_socket->SignalClose.connect(this, &LibWebRTCSocketClient::signalClose);
+
+ if (type == Type::ClientTCP) {
+ m_socket->SignalAddressReady.connect(this, &LibWebRTCSocketClient::signalAddressReady);
+ return;
+ }
+ signalAddressReady();
}
void LibWebRTCSocketClient::sendTo(const WebCore::SharedBuffer& buffer, const rtc::SocketAddress& socketAddress, const rtc::PacketOptions& options)
@@ -98,6 +103,11 @@
});
}
+void LibWebRTCSocketClient::signalAddressReady()
+{
+ signalAddressReady(m_socket.get(), m_socket->GetLocalAddress());
+}
+
void LibWebRTCSocketClient::signalConnect(rtc::AsyncPacketSocket*)
{
m_rtcProvider.sendFromMainThread([identifier = m_identifier](IPC::Connection& connection) {
Modified: trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h (211829 => 211830)
--- trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.h 2017-02-07 20:19:09 UTC (rev 211830)
@@ -49,8 +49,10 @@
class LibWebRTCSocketClient final : public sigslot::has_slots<> {
public:
- LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider&, std::unique_ptr<rtc::AsyncPacketSocket>&&);
+ enum class Type { UDP, ServerTCP, ClientTCP };
+ LibWebRTCSocketClient(uint64_t identifier, NetworkRTCProvider&, std::unique_ptr<rtc::AsyncPacketSocket>&&, Type);
+
private:
friend class NetworkRTCSocket;
@@ -64,6 +66,8 @@
void signalConnect(rtc::AsyncPacketSocket*);
void signalClose(rtc::AsyncPacketSocket*, int);
+ void signalAddressReady();
+
uint64_t m_identifier;
NetworkRTCProvider& m_rtcProvider;
std::unique_ptr<rtc::AsyncPacketSocket> m_socket;
Modified: trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp (211829 => 211830)
--- trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp 2017-02-07 20:19:09 UTC (rev 211830)
@@ -74,7 +74,7 @@
callOnRTCNetworkThread([this, identifier, socketAddress, minPort, maxPort]() {
std::unique_ptr<rtc::AsyncPacketSocket> socket(m_packetSocketFactory->CreateUdpSocket(socketAddress, minPort, maxPort));
- addSocket(identifier, std::make_unique<LibWebRTCSocketClient>(identifier, *this, WTFMove(socket)));
+ addSocket(identifier, std::make_unique<LibWebRTCSocketClient>(identifier, *this, WTFMove(socket), LibWebRTCSocketClient::Type::UDP));
});
}
@@ -85,7 +85,7 @@
callOnRTCNetworkThread([this, identifier, socketAddress, minPort, maxPort, options]() {
std::unique_ptr<rtc::AsyncPacketSocket> socket(m_packetSocketFactory->CreateServerTcpSocket(socketAddress, minPort, maxPort, options));
- addSocket(identifier, std::make_unique<LibWebRTCSocketClient>(identifier, *this, WTFMove(socket)));
+ addSocket(identifier, std::make_unique<LibWebRTCSocketClient>(identifier, *this, WTFMove(socket), LibWebRTCSocketClient::Type::ServerTCP));
});
}
@@ -99,7 +99,7 @@
callOnRTCNetworkThread([this, identifier, socketLocalAddress, socketRemoteAddress, options]() {
std::unique_ptr<rtc::AsyncPacketSocket> socket(m_packetSocketFactory->CreateClientTcpSocket(socketLocalAddress, socketRemoteAddress, { }, { }, options));
- addSocket(identifier, std::make_unique<LibWebRTCSocketClient>(identifier, *this, WTFMove(socket)));
+ addSocket(identifier, std::make_unique<LibWebRTCSocketClient>(identifier, *this, WTFMove(socket), LibWebRTCSocketClient::Type::ClientTCP));
});
}
Modified: trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp (211829 => 211830)
--- trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2017-02-07 20:19:09 UTC (rev 211830)
@@ -54,13 +54,6 @@
, m_remoteAddress(remoteAddress)
{
memset(&m_options, 1, MAX_SOCKET_OPTION);
-
- if (type == Type::ClientTCP)
- return;
-
- WebRTCSocket::signalOnNetworkThread(m_factory, m_identifier, [](LibWebRTCSocket& socket) {
- socket.signalAddressReady();
- });
}
LibWebRTCSocket::~LibWebRTCSocket()
@@ -78,18 +71,10 @@
return m_remoteAddress;
}
-void LibWebRTCSocket::signalAddressReady()
-{
- ASSERT(m_type != Type::ClientTCP);
- m_state = STATE_BOUND;
- SignalAddressReady(this, m_localAddress);
-}
-
void LibWebRTCSocket::signalAddressReady(const String& address)
{
- ASSERT(m_type == Type::ClientTCP);
m_localAddress.FromString(address.utf8().data());
- m_state = STATE_CONNECTED;
+ m_state = (m_type == Type::ClientTCP) ? STATE_CONNECTED : STATE_BOUND;
SignalAddressReady(this, m_localAddress);
}
Modified: trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h (211829 => 211830)
--- trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h 2017-02-07 20:09:28 UTC (rev 211829)
+++ trunk/Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h 2017-02-07 20:19:09 UTC (rev 211830)
@@ -68,7 +68,6 @@
void signalReadPacket(const WebCore::SharedBuffer&, rtc::SocketAddress&&, int64_t);
void signalSentPacket(int, int64_t);
void signalAddressReady(const String&);
- void signalAddressReady();
void signalConnect();
void signalClose(int);