stefan@webrtc.org | 64d9dec | 2012-09-26 16:47:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 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 | |
wu@webrtc.org | 66773a0 | 2014-05-07 17:09:44 +0000 | [diff] [blame^] | 11 | #ifndef SYSTEM_WRAPPERS_INTERFACE_RTP_TO_NTP_H_ |
| 12 | #define SYSTEM_WRAPPERS_INTERFACE_RTP_TO_NTP_H_ |
stefan@webrtc.org | 64d9dec | 2012-09-26 16:47:40 +0000 | [diff] [blame] | 13 | |
| 14 | #include <list> |
| 15 | |
pbos@webrtc.org | 47ce120 | 2013-05-27 12:41:33 +0000 | [diff] [blame] | 16 | #include "webrtc/typedefs.h" |
stefan@webrtc.org | 64d9dec | 2012-09-26 16:47:40 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
stefan@webrtc.org | 64d9dec | 2012-09-26 16:47:40 +0000 | [diff] [blame] | 20 | struct RtcpMeasurement { |
| 21 | RtcpMeasurement(); |
| 22 | RtcpMeasurement(uint32_t ntp_secs, uint32_t ntp_frac, uint32_t timestamp); |
| 23 | uint32_t ntp_secs; |
| 24 | uint32_t ntp_frac; |
| 25 | uint32_t rtp_timestamp; |
| 26 | }; |
| 27 | |
| 28 | typedef std::list<RtcpMeasurement> RtcpList; |
| 29 | |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 30 | // Updates |rtcp_list| with timestamps from the latest RTCP SR. |
| 31 | // |new_rtcp_sr| will be set to true if these are the timestamps which have |
| 32 | // never be added to |rtcp_list|. |
| 33 | bool UpdateRtcpList(uint32_t ntp_secs, |
| 34 | uint32_t ntp_frac, |
| 35 | uint32_t rtp_timestamp, |
| 36 | RtcpList* rtcp_list, |
| 37 | bool* new_rtcp_sr); |
| 38 | |
stefan@webrtc.org | 64d9dec | 2012-09-26 16:47:40 +0000 | [diff] [blame] | 39 | // Converts an RTP timestamp to the NTP domain in milliseconds using two |
| 40 | // (RTP timestamp, NTP timestamp) pairs. |
| 41 | bool RtpToNtpMs(int64_t rtp_timestamp, const RtcpList& rtcp, |
| 42 | int64_t* timestamp_in_ms); |
| 43 | |
| 44 | // Returns 1 there has been a forward wrap around, 0 if there has been no wrap |
| 45 | // around and -1 if there has been a backwards wrap around (i.e. reordering). |
| 46 | int CheckForWrapArounds(uint32_t rtp_timestamp, uint32_t rtcp_rtp_timestamp); |
wu@webrtc.org | 66773a0 | 2014-05-07 17:09:44 +0000 | [diff] [blame^] | 47 | |
stefan@webrtc.org | 64d9dec | 2012-09-26 16:47:40 +0000 | [diff] [blame] | 48 | } // namespace webrtc |
| 49 | |
wu@webrtc.org | 66773a0 | 2014-05-07 17:09:44 +0000 | [diff] [blame^] | 50 | #endif // SYSTEM_WRAPPERS_INTERFACE_RTP_TO_NTP_H_ |