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_INCOMING_H_ 12 #define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_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 RtpPacketReceived; 22 23 class RtcEventRtpPacketIncoming final : public RtcEvent { 24 public: 25 explicit RtcEventRtpPacketIncoming(const RtpPacketReceived& packet); 26 ~RtcEventRtpPacketIncoming() override; 27 28 Type GetType() const override; 29 30 bool IsConfigEvent() const override; 31 32 std::unique_ptr<RtcEventRtpPacketIncoming> Copy() const; 33 packet_length()34 size_t packet_length() const { 35 return payload_length_ + header_length_ + padding_length_; 36 } 37 header()38 const RtpPacket& header() const { return header_; } payload_length()39 size_t payload_length() const { return payload_length_; } header_length()40 size_t header_length() const { return header_length_; } padding_length()41 size_t padding_length() const { return padding_length_; } 42 43 private: 44 RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming& other); 45 46 RtpPacket header_; // Only the packet's header will be stored here. 47 const size_t payload_length_; // Media payload, excluding header and padding. 48 const size_t header_length_; // RTP header. 49 const size_t padding_length_; // RTP padding. 50 }; 51 52 } // namespace webrtc 53 54 #endif // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_H_ 55