• 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 #ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_GENERIC_PACKET_SENT_H_
12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_GENERIC_PACKET_SENT_H_
13 
14 #include <memory>
15 
16 #include "api/rtc_event_log/rtc_event.h"
17 
18 namespace webrtc {
19 
20 class RtcEventGenericPacketSent final : public RtcEvent {
21  public:
22   RtcEventGenericPacketSent(int64_t packet_number,
23                             size_t overhead_length,
24                             size_t payload_length,
25                             size_t padding_length);
26   ~RtcEventGenericPacketSent() override;
27 
28   std::unique_ptr<RtcEventGenericPacketSent> Copy() const;
29 
30   Type GetType() const override;
31 
32   bool IsConfigEvent() const override;
33 
34   // An identifier of the packet.
packet_number()35   int64_t packet_number() const { return packet_number_; }
36 
37   // Total packet length, including all packetization overheads, but not
38   // including ICE/TURN/IP overheads.
packet_length()39   size_t packet_length() const {
40     return overhead_length_ + payload_length_ + padding_length_;
41   }
42 
43   // The number of bytes in overhead, including framing overheads, acks if
44   // present, etc.
overhead_length()45   size_t overhead_length() const { return overhead_length_; }
46 
47   // Length of payload sent (size of raw audio/video/data), without
48   // packetization overheads. This may still include serialization overheads.
payload_length()49   size_t payload_length() const { return payload_length_; }
50 
padding_length()51   size_t padding_length() const { return padding_length_; }
52 
53  private:
54   RtcEventGenericPacketSent(const RtcEventGenericPacketSent& packet);
55 
56   const int64_t packet_number_;
57   const size_t overhead_length_;
58   const size_t payload_length_;
59   const size_t padding_length_;
60 };
61 
62 }  // namespace webrtc
63 
64 #endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_GENERIC_PACKET_SENT_H_
65