OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ | 10 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ |
11 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ | 11 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ |
12 | 12 |
13 #include "webrtc/common_types.h" | 13 #include "webrtc/common_types.h" |
14 #include "webrtc/modules/rtp_rtcp/source/rtp_packet.h" | 14 #include "webrtc/modules/rtp_rtcp/source/rtp_packet.h" |
15 #include "webrtc/system_wrappers/include/ntp_time.h" | 15 #include "webrtc/system_wrappers/include/ntp_time.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 // Class to hold rtp packet with metadata for receiver side. | 18 // Class to hold rtp packet with metadata for receiver side. |
19 class RtpPacketReceived : public rtp::Packet { | 19 class RtpPacketReceived : public rtp::Packet { |
20 public: | 20 public: |
21 RtpPacketReceived() = default; | 21 RtpPacketReceived() = default; |
22 explicit RtpPacketReceived(const ExtensionManager* extensions) | 22 explicit RtpPacketReceived(const ExtensionManager* extensions) |
23 : Packet(extensions) {} | 23 : Packet(extensions) {} |
24 | 24 |
25 void GetHeader(RTPHeader* header) const { | 25 // TODO(danilchap): Remove this function when all code update to use RtpPacket |
26 Packet::GetHeader(header); | 26 // directly. Function is there just for easier backward compatibilty. |
27 header->payload_type_frequency = payload_type_frequency(); | 27 void GetHeader(RTPHeader* header) const; |
28 } | |
29 | 28 |
30 // Time in local time base as close as it can to packet arrived on the | 29 // Time in local time base as close as it can to packet arrived on the |
31 // network. | 30 // network. |
32 int64_t arrival_time_ms() const { return arrival_time_ms_; } | 31 int64_t arrival_time_ms() const { return arrival_time_ms_; } |
33 void set_arrival_time_ms(int64_t time) { arrival_time_ms_ = time; } | 32 void set_arrival_time_ms(int64_t time) { arrival_time_ms_ = time; } |
34 | 33 |
35 // Estimated from Timestamp() using rtcp Sender Reports. | 34 // Estimated from Timestamp() using rtcp Sender Reports. |
36 NtpTime capture_ntp_time() const { return capture_time_; } | 35 NtpTime capture_ntp_time() const { return capture_time_; } |
37 void set_capture_ntp_time(NtpTime time) { capture_time_ = time; } | 36 void set_capture_ntp_time(NtpTime time) { capture_time_ = time; } |
38 | 37 |
39 // Flag if packet was recovered via RTX or FEC. | 38 // Flag if packet was recovered via RTX or FEC. |
40 bool recovered() const { return recovered_; } | 39 bool recovered() const { return recovered_; } |
41 void set_recovered(bool value) { recovered_ = value; } | 40 void set_recovered(bool value) { recovered_ = value; } |
42 | 41 |
43 int payload_type_frequency() const { return payload_type_frequency_; } | 42 int payload_type_frequency() const { return payload_type_frequency_; } |
44 void set_payload_type_frequency(int value) { | 43 void set_payload_type_frequency(int value) { |
45 payload_type_frequency_ = value; | 44 payload_type_frequency_ = value; |
46 } | 45 } |
47 | 46 |
48 private: | 47 private: |
49 NtpTime capture_time_; | 48 NtpTime capture_time_; |
50 int64_t arrival_time_ms_ = 0; | 49 int64_t arrival_time_ms_ = 0; |
51 int payload_type_frequency_ = 0; | 50 int payload_type_frequency_ = 0; |
52 bool recovered_ = false; | 51 bool recovered_ = false; |
53 }; | 52 }; |
54 | 53 |
55 } // namespace webrtc | 54 } // namespace webrtc |
56 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ | 55 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ |
OLD | NEW |