• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "logging/rtc_event_log/events/rtc_event_generic_ack_received.h"
12 
13 #include <vector>
14 
15 #include "absl/memory/memory.h"
16 #include "rtc_base/time_utils.h"
17 
18 namespace webrtc {
19 
20 std::vector<std::unique_ptr<RtcEventGenericAckReceived>>
CreateLogs(int64_t packet_number,const std::vector<AckedPacket> & acked_packets)21 RtcEventGenericAckReceived::CreateLogs(
22     int64_t packet_number,
23     const std::vector<AckedPacket>& acked_packets) {
24   std::vector<std::unique_ptr<RtcEventGenericAckReceived>> result;
25   int64_t time_us = rtc::TimeMicros();
26   result.reserve(acked_packets.size());
27   for (const AckedPacket& packet : acked_packets) {
28     result.emplace_back(new RtcEventGenericAckReceived(
29         time_us, packet_number, packet.packet_number,
30         packet.receive_acked_packet_time_ms));
31   }
32   return result;
33 }
34 
RtcEventGenericAckReceived(int64_t timestamp_us,int64_t packet_number,int64_t acked_packet_number,absl::optional<int64_t> receive_acked_packet_time_ms)35 RtcEventGenericAckReceived::RtcEventGenericAckReceived(
36     int64_t timestamp_us,
37     int64_t packet_number,
38     int64_t acked_packet_number,
39     absl::optional<int64_t> receive_acked_packet_time_ms)
40     : RtcEvent(timestamp_us),
41       packet_number_(packet_number),
42       acked_packet_number_(acked_packet_number),
43       receive_acked_packet_time_ms_(receive_acked_packet_time_ms) {}
44 
Copy() const45 std::unique_ptr<RtcEventGenericAckReceived> RtcEventGenericAckReceived::Copy()
46     const {
47   return absl::WrapUnique(new RtcEventGenericAckReceived(*this));
48 }
49 
50 RtcEventGenericAckReceived::RtcEventGenericAckReceived(
51     const RtcEventGenericAckReceived& packet) = default;
52 
53 RtcEventGenericAckReceived::~RtcEventGenericAckReceived() = default;
54 
55 }  // namespace webrtc
56