Diff
Modified: branches/safari-604-branch/Source/WebKit/ChangeLog (223228 => 223229)
--- branches/safari-604-branch/Source/WebKit/ChangeLog 2017-10-12 03:01:19 UTC (rev 223228)
+++ branches/safari-604-branch/Source/WebKit/ChangeLog 2017-10-12 04:24:54 UTC (rev 223229)
@@ -1,3 +1,39 @@
+2017-10-11 Jason Marcell <[email protected]>
+
+ Apply patch. rdar://problem/34920294
+
+ Apply patch. rdar://problem/34920294
+
+ 2017-10-11 Youenn Fablet <[email protected]>
+
+ rtc::PacketOptions should have its own IPC encoding/decoding routines
+ https://bugs.webkit.org/show_bug.cgi?id=177812
+
+ Reviewed by Alex Christensen.
+
+ Replacing rtc::PacketOptions IPC encoding/decoding from passing the structure as individual parameters to the structure as a parameter.
+ Introducing WebKit::RTCPacketOptions as a wrapper around it for which encode/decode routines are added.
+ Updating code using rtc::PacketOptions accordingly.
+
+ * NetworkProcess/webrtc/NetworkRTCSocket.cpp:
+ (WebKit::NetworkRTCSocket::sendTo):
+ * NetworkProcess/webrtc/NetworkRTCSocket.h:
+ * NetworkProcess/webrtc/NetworkRTCSocket.messages.in:
+ * Platform/IPC/Decoder.cpp:
+ (IPC::Decoder::operator>>):
+ (IPC::Decoder::decode):
+ * Platform/IPC/Decoder.h:
+ * Platform/IPC/Encoder.cpp:
+ (IPC::Encoder::encode):
+ * Platform/IPC/Encoder.h:
+ * Shared/RTCPacketOptions.cpp: Added.
+ (WebKit::RTCPacketOptions::encode const):
+ (WebKit::RTCPacketOptions::decode):
+ * Shared/RTCPacketOptions.h: Added.
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
+ (WebKit::LibWebRTCSocket::SendTo):
+
2017-10-10 Jason Marcell <[email protected]>
Cherry-pick r222826. rdar://problem/34792131
Modified: branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.cpp (223228 => 223229)
--- branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.cpp 2017-10-12 03:01:19 UTC (rev 223228)
+++ branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.cpp 2017-10-12 04:24:54 UTC (rev 223229)
@@ -31,6 +31,7 @@
#include "DataReference.h"
#include "LibWebRTCSocketClient.h"
#include "NetworkRTCProvider.h"
+#include "RTCPacketOptions.h"
#include <WebCore/SharedBuffer.h>
#include <wtf/Function.h>
@@ -42,22 +43,10 @@
{
}
-void NetworkRTCSocket::sendTo(const IPC::DataReference& data, const RTCNetwork::SocketAddress& socketAddress, int packetID, int rtpSendtimeExtensionID, String srtpAuth, int64_t srtpPacketIndex, int dscp)
+void NetworkRTCSocket::sendTo(const IPC::DataReference& data, RTCNetwork::SocketAddress&& socketAddress, RTCPacketOptions&& options)
{
auto buffer = WebCore::SharedBuffer::create(data.data(), data.size());
-
- rtc::PacketOptions options;
- options.packet_id = packetID;
- options.packet_time_params.rtp_sendtime_extension_id = rtpSendtimeExtensionID;
- options.packet_time_params.srtp_packet_index = srtpPacketIndex;
- options.dscp = static_cast<rtc::DiffServCodePoint>(dscp);
- if (srtpAuth.utf8().length()) {
- options.packet_time_params.srtp_auth_key = std::vector<char>(srtpAuth.utf8().data(), srtpAuth.utf8().data() + srtpAuth.utf8().length());
- options.packet_time_params.srtp_auth_tag_len = srtpAuth.utf8().length();
- } else
- options.packet_time_params.srtp_auth_tag_len = -1;
-
- m_rtcProvider.callSocket(m_identifier, [buffer = WTFMove(buffer), socketAddress, options](LibWebRTCSocketClient& client) {
+ m_rtcProvider.callSocket(m_identifier, [buffer = WTFMove(buffer), socketAddress = WTFMove(socketAddress), options = WTFMove(options.options)](LibWebRTCSocketClient& client) {
client.sendTo(buffer.get(), socketAddress.value, options);
});
}
Modified: branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.h (223228 => 223229)
--- branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.h 2017-10-12 03:01:19 UTC (rev 223228)
+++ branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.h 2017-10-12 04:24:54 UTC (rev 223229)
@@ -54,6 +54,7 @@
class NetworkConnectionToWebProcess;
class NetworkRTCProvider;
+struct RTCPacketOptions;
class NetworkRTCSocket {
public:
@@ -60,7 +61,7 @@
NetworkRTCSocket(uint64_t, NetworkRTCProvider&);
void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
private:
- void sendTo(const IPC::DataReference&, const RTCNetwork::SocketAddress&, int packetID, int rtpSendtimeExtensionID, String srtpAuth, int64_t srtpPacketIndex, int dscp);
+ void sendTo(const IPC::DataReference&, RTCNetwork::SocketAddress&&, RTCPacketOptions&&);
void close();
void setOption(int option, int value);
Modified: branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.messages.in (223228 => 223229)
--- branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.messages.in 2017-10-12 03:01:19 UTC (rev 223228)
+++ branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.messages.in 2017-10-12 04:24:54 UTC (rev 223229)
@@ -23,7 +23,7 @@
#if USE(LIBWEBRTC)
messages -> NetworkRTCSocket {
- void SendTo(IPC::DataReference data, WebKit::RTCNetwork::SocketAddress address, int packetID, int rtpSendtimeExtensionID, String srtpAuth, int64_t srtpPacketIndex, int dscp)
+ void SendTo(IPC::DataReference data, WebKit::RTCNetwork::SocketAddress address, struct WebKit::RTCPacketOptions options)
void Close()
void SetOption(int option, int value)
}
Added: branches/safari-604-branch/Source/WebKit/Shared/RTCPacketOptions.cpp (0 => 223229)
--- branches/safari-604-branch/Source/WebKit/Shared/RTCPacketOptions.cpp (rev 0)
+++ branches/safari-604-branch/Source/WebKit/Shared/RTCPacketOptions.cpp 2017-10-12 04:24:54 UTC (rev 223229)
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RTCPacketOptions.h"
+
+#if USE(LIBWEBRTC)
+
+#include "DataReference.h"
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+void RTCPacketOptions::encode(IPC::Encoder& encoder) const
+{
+ encoder.encodeEnum(options.dscp);
+ encoder << safeCast<int32_t>(options.packet_id);
+ encoder << options.packet_time_params.rtp_sendtime_extension_id;
+
+ encoder << static_cast<int64_t>(options.packet_time_params.srtp_auth_tag_len);
+ if (options.packet_time_params.srtp_auth_tag_len > 0)
+ encoder << IPC::DataReference(reinterpret_cast<const uint8_t*>(options.packet_time_params.srtp_auth_key.data()), options.packet_time_params.srtp_auth_key.size());
+
+ encoder << options.packet_time_params.srtp_packet_index;
+}
+
+bool RTCPacketOptions::decode(IPC::Decoder& decoder, RTCPacketOptions& options)
+{
+ rtc::PacketTimeUpdateParams params;
+
+ if (!decoder.decodeEnum(options.options.dscp))
+ return false;
+
+ int32_t packetId;
+ if (!decoder.decode(packetId))
+ return false;
+ options.options.packet_id = packetId;
+
+ if (!decoder.decode(params.rtp_sendtime_extension_id))
+ return false;
+
+ int64_t srtpAuthTagLength;
+ if (!decoder.decode(srtpAuthTagLength))
+ return false;
+ params.srtp_auth_tag_len = srtpAuthTagLength;
+
+ if (params.srtp_auth_tag_len > 0) {
+ IPC::DataReference srtpAuthKey;
+ if (!decoder.decode(srtpAuthKey))
+ return false;
+
+ params.srtp_auth_key = std::vector<char>(static_cast<size_t>(srtpAuthKey.size()));
+ memcpy(params.srtp_auth_key.data(), reinterpret_cast<const char*>(srtpAuthKey.data()), srtpAuthKey.size() * sizeof(char));
+ }
+
+ if (!decoder.decode(params.srtp_packet_index))
+ return false;
+
+ options.options.packet_time_params = WTFMove(params);
+ return true;
+}
+
+}
+
+#endif // USE(LIBWEBRTC)
Copied: branches/safari-604-branch/Source/WebKit/Shared/RTCPacketOptions.h (from rev 223223, branches/safari-604-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCSocket.h) (0 => 223229)
--- branches/safari-604-branch/Source/WebKit/Shared/RTCPacketOptions.h (rev 0)
+++ branches/safari-604-branch/Source/WebKit/Shared/RTCPacketOptions.h 2017-10-12 04:24:54 UTC (rev 223229)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(LIBWEBRTC)
+
+#include <WebCore/LibWebRTCMacros.h>
+#include <webrtc/base/asyncpacketsocket.h>
+#include <wtf/Optional.h>
+
+namespace IPC {
+class Decoder;
+class Encoder;
+}
+
+namespace WebKit {
+
+struct RTCPacketOptions {
+ void encode(IPC::Encoder&) const;
+ static bool decode(IPC::Decoder&, RTCPacketOptions&);
+
+ rtc::PacketOptions options;
+};
+
+}
+
+#endif // USE(LIBWEBRTC)
Modified: branches/safari-604-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (223228 => 223229)
--- branches/safari-604-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-10-12 03:01:19 UTC (rev 223228)
+++ branches/safari-604-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-10-12 04:24:54 UTC (rev 223229)
@@ -891,6 +891,8 @@
413075B21DE85F580039EC69 /* LibWebRTCSocketFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A61DE85EE70039EC69 /* LibWebRTCSocketFactory.h */; };
413075B31DE85F580039EC69 /* LibWebRTCProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */; };
413075B41DE85F580039EC69 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */; };
+ 413FE8F91F8E8E4900F6D7D7 /* RTCPacketOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413FE8F71F8E8E4400F6D7D7 /* RTCPacketOptions.cpp */; };
+ 413FE8FA1F8E8E4E00F6D7D7 /* RTCPacketOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 413FE8F81F8E8E4600F6D7D7 /* RTCPacketOptions.h */; };
41DC45961E3D6E2200B11F51 /* NetworkRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DC45941E3D6E1E00B11F51 /* NetworkRTCProvider.h */; };
41DC45971E3D6E2200B11F51 /* NetworkRTCProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC45951E3D6E1E00B11F51 /* NetworkRTCProvider.cpp */; };
41DC459B1E3DBB2800B11F51 /* LibWebRTCSocketClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC45991E3DBB2400B11F51 /* LibWebRTCSocketClient.cpp */; };
@@ -3125,6 +3127,8 @@
413075A61DE85EE70039EC69 /* LibWebRTCSocketFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCSocketFactory.h; path = Network/webrtc/LibWebRTCSocketFactory.h; sourceTree = "<group>"; };
413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = LibWebRTCProvider.cpp; path = Network/webrtc/LibWebRTCProvider.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = LibWebRTCProvider.h; path = Network/webrtc/LibWebRTCProvider.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 413FE8F71F8E8E4400F6D7D7 /* RTCPacketOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCPacketOptions.cpp; sourceTree = "<group>"; };
+ 413FE8F81F8E8E4600F6D7D7 /* RTCPacketOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCPacketOptions.h; sourceTree = "<group>"; };
41AC86811E042E5300303074 /* WebRTCResolver.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; name = WebRTCResolver.messages.in; path = Network/webrtc/WebRTCResolver.messages.in; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; };
41DC45941E3D6E1E00B11F51 /* NetworkRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkRTCProvider.h; path = NetworkProcess/webrtc/NetworkRTCProvider.h; sourceTree = "<group>"; };
41DC45951E3D6E1E00B11F51 /* NetworkRTCProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkRTCProvider.cpp; path = NetworkProcess/webrtc/NetworkRTCProvider.cpp; sourceTree = "<group>"; };
@@ -4972,6 +4976,8 @@
F6A0C13F13281E6E0070430F /* ResourceCachesToClear.h */,
410482CB1DDD2FB500F006D0 /* RTCNetwork.cpp */,
410482CC1DDD2FB500F006D0 /* RTCNetwork.h */,
+ 413FE8F71F8E8E4400F6D7D7 /* RTCPacketOptions.cpp */,
+ 413FE8F81F8E8E4600F6D7D7 /* RTCPacketOptions.h */,
BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */,
1AAB4A8C1296F0A20023952F /* SandboxExtension.h */,
E1E552C316AE065E004ED653 /* SandboxInitializationParameters.h */,
@@ -8262,6 +8268,7 @@
7CD3A4831A5D02FA009623B8 /* APINavigation.h in Headers */,
2DF9EEEC1A7836EE00B6CFBE /* APINavigationAction.h in Headers */,
2DD9EB2D1A6F012500BB1267 /* APINavigationClient.h in Headers */,
+ 413FE8FA1F8E8E4E00F6D7D7 /* RTCPacketOptions.h in Headers */,
BCF69FA21176D01400471A52 /* APINavigationData.h in Headers */,
2DF9EEEE1A786EAD00B6CFBE /* APINavigationResponse.h in Headers */,
7A1E2A851EEFE8920037A0E0 /* APINotificationProvider.h in Headers */,
@@ -9386,7 +9393,7 @@
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
};
- buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */;
+ buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
@@ -10623,6 +10630,7 @@
1A9E329E1822FEDD00F5D04C /* WKRemoteObjectCoder.mm in Sources */,
37948408150C4B9700E52CE9 /* WKRenderLayer.cpp in Sources */,
37608822150414F700FC82C7 /* WKRenderObject.cpp in Sources */,
+ 413FE8F91F8E8E4900F6D7D7 /* RTCPacketOptions.cpp in Sources */,
3336763A130C99DC006C9DE2 /* WKResourceCacheManager.cpp in Sources */,
1A7E377818E4A4FE003D0FFF /* WKScriptMessage.mm in Sources */,
0FCB4E5518BBE044000FCFC9 /* WKScrollView.mm in Sources */,
@@ -11165,7 +11173,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Production;
};
- 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit2" */ = {
+ 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "WebKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91B208733DA50010E9CD /* Debug */,
Modified: branches/safari-604-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp (223228 => 223229)
--- branches/safari-604-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2017-10-12 03:01:19 UTC (rev 223228)
+++ branches/safari-604-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2017-10-12 04:24:54 UTC (rev 223229)
@@ -32,6 +32,7 @@
#include "LibWebRTCSocketFactory.h"
#include "NetworkProcessConnection.h"
#include "NetworkRTCSocketMessages.h"
+#include "RTCPacketOptions.h"
#include "WebProcess.h"
#include <WebCore/SharedBuffer.h>
#include <wtf/Function.h>
@@ -113,13 +114,6 @@
SignalNewConnection(this, newConnectionSocket);
}
-static inline String authKey(const rtc::PacketOptions& options)
-{
- if (options.packet_time_params.srtp_auth_key.size() <= 0)
- return { };
- return String(options.packet_time_params.srtp_auth_key.data(), options.packet_time_params.srtp_auth_key.size());
-}
-
bool LibWebRTCSocket::willSend(size_t size)
{
if (size > m_availableSendingBytes) {
@@ -142,10 +136,7 @@
sendOnMainThread([identifier, buffer = WTFMove(buffer), address, options](IPC::Connection& connection) {
IPC::DataReference data(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size());
- String srtpAuthKey = authKey(options);
- RTCNetwork::SocketAddress socketAddress(address);
- Messages::NetworkRTCSocket::SendTo message(data, socketAddress, options.packet_id, options.packet_time_params.rtp_sendtime_extension_id, srtpAuthKey, options.packet_time_params.srtp_packet_index, options.dscp);
- connection.send(WTFMove(message), identifier);
+ connection.send(Messages::NetworkRTCSocket::SendTo { data, RTCNetwork::SocketAddress { address }, RTCPacketOptions { options } }, identifier);
});
return size;
}