blob: ee48fa360bad54c70604698b6f219a8a859287bf [file] [log] [blame]
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_H_
#define LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_H_
#include <cstddef>
#include <cstdint>
#include <memory>
#include <utility>
#include "api/array_view.h"
#include "api/rtc_event_log/rtc_event.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
namespace webrtc {
class RtpPacketReceived;
class RtcEventRtpPacketIncoming final : public RtcEvent {
public:
static constexpr Type kType = Type::RtpPacketIncoming;
explicit RtcEventRtpPacketIncoming(const RtpPacketReceived& packet);
~RtcEventRtpPacketIncoming() override;
Type GetType() const override { return kType; }
bool IsConfigEvent() const override { return false; }
std::unique_ptr<RtcEventRtpPacketIncoming> Copy() const;
size_t packet_length() const { return packet_.size(); }
rtc::ArrayView<const uint8_t> RawHeader() const {
return rtc::MakeArrayView(packet_.data(), header_length());
}
uint32_t Ssrc() const { return packet_.Ssrc(); }
uint32_t Timestamp() const { return packet_.Timestamp(); }
uint16_t SequenceNumber() const { return packet_.SequenceNumber(); }
uint8_t PayloadType() const { return packet_.PayloadType(); }
bool Marker() const { return packet_.Marker(); }
template <typename ExtensionTrait, typename... Args>
bool GetExtension(Args&&... args) const {
return packet_.GetExtension<ExtensionTrait>(std::forward<Args>(args)...);
}
template <typename ExtensionTrait>
bool HasExtension() const {
return packet_.HasExtension<ExtensionTrait>();
}
size_t payload_length() const { return packet_.payload_size(); }
size_t header_length() const { return packet_.headers_size(); }
size_t padding_length() const { return packet_.padding_size(); }
private:
RtcEventRtpPacketIncoming(const RtcEventRtpPacketIncoming& other);
const RtpPacket packet_;
};
} // namespace webrtc
#endif // LOGGING_RTC_EVENT_LOG_EVENTS_RTC_EVENT_RTP_PACKET_INCOMING_H_