• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
12 
13 #include "absl/memory/memory.h"
14 #include "modules/rtp_rtcp/source/rtp_packet_received.h"
15 #include "rtc_base/checks.h"
16 
17 namespace webrtc {
18 
RtcEventRtpPacketIncoming(const RtpPacketReceived & packet)19 RtcEventRtpPacketIncoming::RtcEventRtpPacketIncoming(
20     const RtpPacketReceived& packet)
21     : payload_length_(packet.payload_size()),
22       header_length_(packet.headers_size()),
23       padding_length_(packet.padding_size()) {
24   header_.CopyHeaderFrom(packet);
25   RTC_DCHECK_EQ(packet.size(),
26                 payload_length_ + header_length_ + padding_length_);
27 }
28 
RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming & other)29 RtcEventRtpPacketIncoming::RtcEventRtpPacketIncoming(
30     const RtcEventRtpPacketIncoming& other)
31     : RtcEvent(other.timestamp_us_),
32       payload_length_(other.payload_length_),
33       header_length_(other.header_length_),
34       padding_length_(other.padding_length_) {
35   header_.CopyHeaderFrom(other.header_);
36 }
37 
38 RtcEventRtpPacketIncoming::~RtcEventRtpPacketIncoming() = default;
39 
GetType() const40 RtcEvent::Type RtcEventRtpPacketIncoming::GetType() const {
41   return RtcEvent::Type::RtpPacketIncoming;
42 }
43 
IsConfigEvent() const44 bool RtcEventRtpPacketIncoming::IsConfigEvent() const {
45   return false;
46 }
47 
Copy() const48 std::unique_ptr<RtcEventRtpPacketIncoming> RtcEventRtpPacketIncoming::Copy()
49     const {
50   return absl::WrapUnique<RtcEventRtpPacketIncoming>(
51       new RtcEventRtpPacketIncoming(*this));
52 }
53 
54 }  // namespace webrtc
55