summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/rtc_base/network/received_packet.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/rtc_base/network/received_packet.cc
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/rtc_base/network/received_packet.cc')
-rw-r--r--third_party/libwebrtc/rtc_base/network/received_packet.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/third_party/libwebrtc/rtc_base/network/received_packet.cc b/third_party/libwebrtc/rtc_base/network/received_packet.cc
index 9612c3dab4..40d6e1142c 100644
--- a/third_party/libwebrtc/rtc_base/network/received_packet.cc
+++ b/third_party/libwebrtc/rtc_base/network/received_packet.cc
@@ -17,7 +17,26 @@
namespace rtc {
ReceivedPacket::ReceivedPacket(rtc::ArrayView<const uint8_t> payload,
+ const SocketAddress& source_address,
absl::optional<webrtc::Timestamp> arrival_time)
- : payload_(payload), arrival_time_(std::move(arrival_time)) {}
+ : payload_(payload),
+ arrival_time_(std::move(arrival_time)),
+ source_address_(source_address) {}
+
+// static
+ReceivedPacket ReceivedPacket::CreateFromLegacy(
+ const char* data,
+ size_t size,
+ int64_t packet_time_us,
+ const rtc::SocketAddress& source_address) {
+ RTC_DCHECK(packet_time_us == -1 || packet_time_us >= 0);
+ return ReceivedPacket(rtc::reinterpret_array_view<const uint8_t>(
+ rtc::MakeArrayView(data, size)),
+ source_address,
+ (packet_time_us >= 0)
+ ? absl::optional<webrtc::Timestamp>(
+ webrtc::Timestamp::Micros(packet_time_us))
+ : absl::nullopt);
+}
} // namespace rtc