blob: 5b90cd02682e636ce0de0d3f6bd1fcb95c15f225 [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 */
10#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
11#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
12
13#include "webrtc/common_types.h"
14#include "webrtc/modules/rtp_rtcp/source/rtp_packet.h"
15#include "webrtc/system_wrappers/include/ntp_time.h"
16
17namespace webrtc {
18// Class to hold rtp packet with metadata for receiver side.
Danil Chapovalov8769e172017-09-14 14:08:22 +020019class RtpPacketReceived : public RtpPacket {
danilchap1edb7ab2016-04-20 05:25:10 -070020 public:
danilchap70f39a32016-12-16 05:48:18 -080021 RtpPacketReceived() = default;
danilchap1edb7ab2016-04-20 05:25:10 -070022 explicit RtpPacketReceived(const ExtensionManager* extensions)
Danil Chapovalov8769e172017-09-14 14:08:22 +020023 : RtpPacket(extensions) {}
danilchap1edb7ab2016-04-20 05:25:10 -070024
danilchapce251812017-09-11 12:24:41 -070025 // TODO(danilchap): Remove this function when all code update to use RtpPacket
26 // directly. Function is there just for easier backward compatibilty.
27 void GetHeader(RTPHeader* header) const;
danilchap1edb7ab2016-04-20 05:25:10 -070028
29 // Time in local time base as close as it can to packet arrived on the
30 // network.
31 int64_t arrival_time_ms() const { return arrival_time_ms_; }
32 void set_arrival_time_ms(int64_t time) { arrival_time_ms_ = time; }
33
34 // Estimated from Timestamp() using rtcp Sender Reports.
35 NtpTime capture_ntp_time() const { return capture_time_; }
36 void set_capture_ntp_time(NtpTime time) { capture_time_ = time; }
37
nissed2ef3142017-05-11 08:00:58 -070038 // Flag if packet was recovered via RTX or FEC.
39 bool recovered() const { return recovered_; }
40 void set_recovered(bool value) { recovered_ = value; }
danilchap1edb7ab2016-04-20 05:25:10 -070041
42 int payload_type_frequency() const { return payload_type_frequency_; }
43 void set_payload_type_frequency(int value) {
44 payload_type_frequency_ = value;
45 }
46
47 private:
48 NtpTime capture_time_;
49 int64_t arrival_time_ms_ = 0;
50 int payload_type_frequency_ = 0;
nissed2ef3142017-05-11 08:00:58 -070051 bool recovered_ = false;
danilchap1edb7ab2016-04-20 05:25:10 -070052};
53
54} // namespace webrtc
55#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_