Line data Source code
1 : /*
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 :
17 : namespace webrtc {
18 : // Class to hold rtp packet with metadata for receiver side.
19 0 : class RtpPacketReceived : public rtp::Packet {
20 : public:
21 0 : RtpPacketReceived() = default;
22 : explicit RtpPacketReceived(const ExtensionManager* extensions)
23 : : Packet(extensions) {}
24 :
25 0 : void GetHeader(RTPHeader* header) const {
26 0 : Packet::GetHeader(header);
27 0 : header->payload_type_frequency = payload_type_frequency();
28 0 : }
29 :
30 : // Time in local time base as close as it can to packet arrived on the
31 : // network.
32 0 : int64_t arrival_time_ms() const { return arrival_time_ms_; }
33 0 : void set_arrival_time_ms(int64_t time) { arrival_time_ms_ = time; }
34 :
35 : // Estimated from Timestamp() using rtcp Sender Reports.
36 : NtpTime capture_ntp_time() const { return capture_time_; }
37 : void set_capture_ntp_time(NtpTime time) { capture_time_ = time; }
38 :
39 : // Flag if packet arrived via rtx.
40 : bool retransmit() const { return retransmit_; }
41 : void set_retransmit(bool value) { retransmit_ = value; }
42 :
43 0 : int payload_type_frequency() const { return payload_type_frequency_; }
44 : void set_payload_type_frequency(int value) {
45 : payload_type_frequency_ = value;
46 : }
47 :
48 : private:
49 : NtpTime capture_time_;
50 : int64_t arrival_time_ms_ = 0;
51 : int payload_type_frequency_ = 0;
52 : bool retransmit_ = false;
53 : };
54 :
55 : } // namespace webrtc
56 : #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_
|