• 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   for (const AckedPacket& packet : acked_packets) {
27     result.emplace_back(new RtcEventGenericAckReceived(
28         time_us, packet_number, packet.packet_number,
29         packet.receive_acked_packet_time_ms));
30   }
31   return result;
32 }
33 
RtcEventGenericAckReceived(int64_t timestamp_us,int64_t packet_number,int64_t acked_packet_number,absl::optional<int64_t> receive_acked_packet_time_ms)34 RtcEventGenericAckReceived::RtcEventGenericAckReceived(
35     int64_t timestamp_us,
36     int64_t packet_number,
37     int64_t acked_packet_number,
38     absl::optional<int64_t> receive_acked_packet_time_ms)
39     : RtcEvent(timestamp_us),
40       packet_number_(packet_number),
41       acked_packet_number_(acked_packet_number),
42       receive_acked_packet_time_ms_(receive_acked_packet_time_ms) {}
43 
Copy() const44 std::unique_ptr<RtcEventGenericAckReceived> RtcEventGenericAckReceived::Copy()
45     const {
46   return absl::WrapUnique(new RtcEventGenericAckReceived(*this));
47 }
48 
49 RtcEventGenericAckReceived::RtcEventGenericAckReceived(
50     const RtcEventGenericAckReceived& packet) = default;
51 
52 RtcEventGenericAckReceived::~RtcEventGenericAckReceived() = default;
53 
GetType() const54 RtcEvent::Type RtcEventGenericAckReceived::GetType() const {
55   return RtcEvent::Type::GenericAckReceived;
56 }
57 
IsConfigEvent() const58 bool RtcEventGenericAckReceived::IsConfigEvent() const {
59   return false;
60 }
61 
62 }  // namespace webrtc
63