blob: 4cf6b23bd7bb815b0968a379ebd13fb27bff6c3e [file] [log] [blame]
danilchap1edb7ab2016-04-20 05:25:10 -07001/*
2 * Copyright (c) 2016 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 */
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020010#ifndef MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
11#define MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
danilchap1edb7ab2016-04-20 05:25:10 -070012
Dino Radaković21360eb2017-10-24 15:40:40 +020013#include <vector>
14
Mirko Bonadei71207422017-09-15 13:58:09 +020015#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "modules/rtp_rtcp/source/rtp_packet.h"
17#include "system_wrappers/include/ntp_time.h"
danilchap1edb7ab2016-04-20 05:25:10 -070018
19namespace webrtc {
20// Class to hold rtp packet with metadata for receiver side.
Danil Chapovalov8769e172017-09-14 14:08:22 +020021class RtpPacketReceived : public RtpPacket {
danilchap1edb7ab2016-04-20 05:25:10 -070022 public:
Dino Radaković21360eb2017-10-24 15:40:40 +020023 RtpPacketReceived();
24 explicit RtpPacketReceived(const ExtensionManager* extensions);
25
26 ~RtpPacketReceived();
danilchap1edb7ab2016-04-20 05:25:10 -070027
danilchapce251812017-09-11 12:24:41 -070028 // TODO(danilchap): Remove this function when all code update to use RtpPacket
29 // directly. Function is there just for easier backward compatibilty.
30 void GetHeader(RTPHeader* header) const;
danilchap1edb7ab2016-04-20 05:25:10 -070031
32 // Time in local time base as close as it can to packet arrived on the
33 // network.
34 int64_t arrival_time_ms() const { return arrival_time_ms_; }
35 void set_arrival_time_ms(int64_t time) { arrival_time_ms_ = time; }
36
37 // Estimated from Timestamp() using rtcp Sender Reports.
38 NtpTime capture_ntp_time() const { return capture_time_; }
39 void set_capture_ntp_time(NtpTime time) { capture_time_ = time; }
40
nissed2ef3142017-05-11 08:00:58 -070041 // Flag if packet was recovered via RTX or FEC.
42 bool recovered() const { return recovered_; }
43 void set_recovered(bool value) { recovered_ = value; }
danilchap1edb7ab2016-04-20 05:25:10 -070044
45 int payload_type_frequency() const { return payload_type_frequency_; }
46 void set_payload_type_frequency(int value) {
47 payload_type_frequency_ = value;
48 }
49
Dino Radaković21360eb2017-10-24 15:40:40 +020050 // Additional data bound to the RTP packet for use in application code,
51 // outside of WebRTC.
52 rtc::ArrayView<const uint8_t> application_data() const {
53 return application_data_;
54 }
55 void set_application_data(rtc::ArrayView<const uint8_t> data) {
56 application_data_.assign(data.begin(), data.end());
57 }
58
danilchap1edb7ab2016-04-20 05:25:10 -070059 private:
60 NtpTime capture_time_;
61 int64_t arrival_time_ms_ = 0;
62 int payload_type_frequency_ = 0;
nissed2ef3142017-05-11 08:00:58 -070063 bool recovered_ = false;
Dino Radaković21360eb2017-10-24 15:40:40 +020064 std::vector<uint8_t> application_data_;
danilchap1edb7ab2016-04-20 05:25:10 -070065};
66
67} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020068#endif // MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_