1 /*
2  *  Copyright (c) 2017 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_RTP_PACKET_OUTGOING_H_
12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_OUTGOING_H_
13 
14 #include <memory>
15 
16 #include "api/rtc_event_log/rtc_event.h"
17 #include "modules/rtp_rtcp/source/rtp_packet.h"
18 
19 namespace webrtc {
20 
21 class RtpPacketToSend;
22 
23 class RtcEventRtpPacketOutgoing final : public RtcEvent {
24  public:
25   static constexpr Type kType = Type::RtpPacketOutgoing;
26 
27   RtcEventRtpPacketOutgoing(const RtpPacketToSend& packet,
28                             int probe_cluster_id);
29   ~RtcEventRtpPacketOutgoing() override;
30 
GetType()31   Type GetType() const override { return kType; }
IsConfigEvent()32   bool IsConfigEvent() const override { return false; }
33 
34   std::unique_ptr<RtcEventRtpPacketOutgoing> Copy() const;
35 
packet_length()36   size_t packet_length() const {
37     return payload_length_ + header_length_ + padding_length_;
38   }
39 
header()40   const RtpPacket& header() const { return header_; }
payload_length()41   size_t payload_length() const { return payload_length_; }
header_length()42   size_t header_length() const { return header_length_; }
padding_length()43   size_t padding_length() const { return padding_length_; }
probe_cluster_id()44   int probe_cluster_id() const { return probe_cluster_id_; }
45 
46  private:
47   RtcEventRtpPacketOutgoing(const RtcEventRtpPacketOutgoing& other);
48 
49   RtpPacket header_;  // Only the packet's header will be stored here.
50   const size_t payload_length_;  // Media payload, excluding header and padding.
51   const size_t header_length_;   // RTP header.
52   const size_t padding_length_;  // RTP padding.
53   // TODO(eladalon): Delete |probe_cluster_id_| along with legacy encoding.
54   const int probe_cluster_id_;
55 };
56 
57 }  // namespace webrtc
58 
59 #endif  // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_OUTGOING_H_
60