From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- third_party/libwebrtc/rtc_base/socket.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'third_party/libwebrtc/rtc_base/socket.h') diff --git a/third_party/libwebrtc/rtc_base/socket.h b/third_party/libwebrtc/rtc_base/socket.h index 0ed3a7fa6a..fac75aca94 100644 --- a/third_party/libwebrtc/rtc_base/socket.h +++ b/third_party/libwebrtc/rtc_base/socket.h @@ -13,6 +13,8 @@ #include +#include "absl/types/optional.h" + #if defined(WEBRTC_POSIX) #include #include @@ -25,7 +27,10 @@ #include "rtc_base/win32.h" #endif +#include "api/units/timestamp.h" +#include "rtc_base/buffer.h" #include "rtc_base/socket_address.h" +#include "rtc_base/system/rtc_export.h" #include "rtc_base/third_party/sigslot/sigslot.h" // Rather than converting errors into a private namespace, @@ -78,8 +83,15 @@ inline bool IsBlockingError(int e) { // General interface for the socket implementations of various networks. The // methods match those of normal UNIX sockets very closely. -class Socket { +class RTC_EXPORT Socket { public: + struct ReceiveBuffer { + ReceiveBuffer(rtc::Buffer& payload) : payload(payload) {} + + absl::optional arrival_time; + SocketAddress source_address; + rtc::Buffer& payload; + }; virtual ~Socket() {} Socket(const Socket&) = delete; @@ -103,6 +115,10 @@ class Socket { size_t cb, SocketAddress* paddr, int64_t* timestamp) = 0; + // Intended to replace RecvFrom(void* ...). + // Default implementation calls RecvFrom(void* ...) with 64Kbyte buffer. + // Returns number of bytes received or a negative value on error. + virtual int RecvFrom(ReceiveBuffer& buffer); virtual int Listen(int backlog) = 0; virtual Socket* Accept(SocketAddress* paddr) = 0; virtual int Close() = 0; -- cgit v1.2.3