2016-04-20 05:25:10 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 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.
|
|
|
|
|
*/
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
|
|
|
|
|
#define MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
|
2016-04-20 05:25:10 -07:00
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include <stdint.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2021-01-25 17:02:57 +01:00
|
|
|
#include <utility>
|
2017-10-24 15:40:40 +02:00
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include "api/array_view.h"
|
2021-01-25 17:02:57 +01:00
|
|
|
#include "api/ref_counted_base.h"
|
2018-10-23 12:03:01 +02:00
|
|
|
#include "api/rtp_headers.h"
|
2021-01-25 17:02:57 +01:00
|
|
|
#include "api/scoped_refptr.h"
|
2021-05-05 12:33:00 +02:00
|
|
|
#include "api/units/timestamp.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/source/rtp_packet.h"
|
2016-04-20 05:25:10 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
// Class to hold rtp packet with metadata for receiver side.
|
2021-01-25 17:02:57 +01:00
|
|
|
// The metadata is not parsed from the rtp packet, but may be derived from the
|
|
|
|
|
// data that is parsed from the rtp packet.
|
2017-09-14 14:08:22 +02:00
|
|
|
class RtpPacketReceived : public RtpPacket {
|
2016-04-20 05:25:10 -07:00
|
|
|
public:
|
2017-10-24 15:40:40 +02:00
|
|
|
RtpPacketReceived();
|
2021-05-05 12:33:00 +02:00
|
|
|
explicit RtpPacketReceived(
|
|
|
|
|
const ExtensionManager* extensions,
|
|
|
|
|
webrtc::Timestamp arrival_time = webrtc::Timestamp::MinusInfinity());
|
2018-02-26 13:22:48 +01:00
|
|
|
RtpPacketReceived(const RtpPacketReceived& packet);
|
|
|
|
|
RtpPacketReceived(RtpPacketReceived&& packet);
|
|
|
|
|
|
|
|
|
|
RtpPacketReceived& operator=(const RtpPacketReceived& packet);
|
|
|
|
|
RtpPacketReceived& operator=(RtpPacketReceived&& packet);
|
2017-10-24 15:40:40 +02:00
|
|
|
|
|
|
|
|
~RtpPacketReceived();
|
2016-04-20 05:25:10 -07:00
|
|
|
|
2017-09-11 12:24:41 -07:00
|
|
|
// TODO(danilchap): Remove this function when all code update to use RtpPacket
|
|
|
|
|
// directly. Function is there just for easier backward compatibilty.
|
|
|
|
|
void GetHeader(RTPHeader* header) const;
|
2016-04-20 05:25:10 -07:00
|
|
|
|
|
|
|
|
// Time in local time base as close as it can to packet arrived on the
|
|
|
|
|
// network.
|
2021-05-05 12:33:00 +02:00
|
|
|
webrtc::Timestamp arrival_time() const { return arrival_time_; }
|
|
|
|
|
void set_arrival_time(webrtc::Timestamp time) { arrival_time_ = time; }
|
|
|
|
|
|
2017-05-11 08:00:58 -07:00
|
|
|
// Flag if packet was recovered via RTX or FEC.
|
|
|
|
|
bool recovered() const { return recovered_; }
|
|
|
|
|
void set_recovered(bool value) { recovered_ = value; }
|
2016-04-20 05:25:10 -07:00
|
|
|
|
|
|
|
|
int payload_type_frequency() const { return payload_type_frequency_; }
|
|
|
|
|
void set_payload_type_frequency(int value) {
|
|
|
|
|
payload_type_frequency_ = value;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-25 17:02:57 +01:00
|
|
|
// An application can attach arbitrary data to an RTP packet using
|
2021-01-27 18:05:04 +01:00
|
|
|
// `additional_data`. The additional data does not affect WebRTC processing.
|
2021-01-25 17:02:57 +01:00
|
|
|
rtc::scoped_refptr<rtc::RefCountedBase> additional_data() const {
|
|
|
|
|
return additional_data_;
|
|
|
|
|
}
|
|
|
|
|
void set_additional_data(rtc::scoped_refptr<rtc::RefCountedBase> data) {
|
|
|
|
|
additional_data_ = std::move(data);
|
|
|
|
|
}
|
2017-10-24 15:40:40 +02:00
|
|
|
|
2016-04-20 05:25:10 -07:00
|
|
|
private:
|
2021-05-05 12:33:00 +02:00
|
|
|
webrtc::Timestamp arrival_time_ = Timestamp::MinusInfinity();
|
2016-04-20 05:25:10 -07:00
|
|
|
int payload_type_frequency_ = 0;
|
2017-05-11 08:00:58 -07:00
|
|
|
bool recovered_ = false;
|
2021-01-25 17:02:57 +01:00
|
|
|
rtc::scoped_refptr<rtc::RefCountedBase> additional_data_;
|
2016-04-20 05:25:10 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
|