danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 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 | */ |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 10 | #ifndef MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ |
| 11 | #define MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 12 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 13 | #include "common_types.h" // NOLINT(build/include) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "modules/rtp_rtcp/source/rtp_packet.h" |
| 15 | #include "system_wrappers/include/ntp_time.h" |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | // Class to hold rtp packet with metadata for receiver side. |
Danil Chapovalov | 8769e17 | 2017-09-14 14:08:22 +0200 | [diff] [blame] | 19 | class RtpPacketReceived : public RtpPacket { |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 20 | public: |
danilchap | 70f39a3 | 2016-12-16 05:48:18 -0800 | [diff] [blame] | 21 | RtpPacketReceived() = default; |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 22 | explicit RtpPacketReceived(const ExtensionManager* extensions) |
Danil Chapovalov | 8769e17 | 2017-09-14 14:08:22 +0200 | [diff] [blame] | 23 | : RtpPacket(extensions) {} |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 24 | |
danilchap | ce25181 | 2017-09-11 12:24:41 -0700 | [diff] [blame] | 25 | // 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; |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 28 | |
| 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 | |
nisse | d2ef314 | 2017-05-11 08:00:58 -0700 | [diff] [blame] | 38 | // Flag if packet was recovered via RTX or FEC. |
| 39 | bool recovered() const { return recovered_; } |
| 40 | void set_recovered(bool value) { recovered_ = value; } |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 41 | |
| 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; |
nisse | d2ef314 | 2017-05-11 08:00:58 -0700 | [diff] [blame] | 51 | bool recovered_ = false; |
danilchap | 1edb7ab | 2016-04-20 05:25:10 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 55 | #endif // MODULES_RTP_RTCP_SOURCE_RTP_PACKET_RECEIVED_H_ |