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.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'third_party/libwebrtc/rtc_base/socket.cc') diff --git a/third_party/libwebrtc/rtc_base/socket.cc b/third_party/libwebrtc/rtc_base/socket.cc index bcd62ad2a4..0908c2991f 100644 --- a/third_party/libwebrtc/rtc_base/socket.cc +++ b/third_party/libwebrtc/rtc_base/socket.cc @@ -10,4 +10,24 @@ #include "rtc_base/socket.h" -namespace rtc {} // namespace rtc +#include + +#include "rtc_base/buffer.h" + +namespace rtc { + +int Socket::RecvFrom(ReceiveBuffer& buffer) { + static constexpr int BUF_SIZE = 64 * 1024; + int64_t timestamp = -1; + buffer.payload.EnsureCapacity(BUF_SIZE); + int len = RecvFrom(buffer.payload.data(), buffer.payload.capacity(), + &buffer.source_address, ×tamp); + buffer.payload.SetSize(len > 0 ? len : 0); + if (len > 0 && timestamp != -1) { + buffer.arrival_time = webrtc::Timestamp::Micros(timestamp); + } + + return len; +} + +} // namespace rtc -- cgit v1.2.3