1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/* 2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * 4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * Use of this source code is governed by a BSD-style license 5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * that can be found in the LICENSE file in the root of the source 6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * tree. An additional intellectual property rights grant can be found 7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * in the file PATENTS. All contributing project authors may 8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */ 10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 11d2fb259b3bc61c68f368929510215a7ee7d00fdawu@webrtc.org#ifndef SYSTEM_WRAPPERS_INTERFACE_RTP_TO_NTP_H_ 12d2fb259b3bc61c68f368929510215a7ee7d00fdawu@webrtc.org#define SYSTEM_WRAPPERS_INTERFACE_RTP_TO_NTP_H_ 13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 14b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#include <list> 15b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 16d5d709e492b5592114ecc197516a453acfee46dfpbos@webrtc.org#include "webrtc/typedefs.h" 17b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 18b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgnamespace webrtc { 19b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgstruct RtcpMeasurement { 21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org RtcpMeasurement(); 22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org RtcpMeasurement(uint32_t ntp_secs, uint32_t ntp_frac, uint32_t timestamp); 23b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org uint32_t ntp_secs; 24b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org uint32_t ntp_frac; 25b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org uint32_t rtp_timestamp; 26b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org}; 27b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 28b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgtypedef std::list<RtcpMeasurement> RtcpList; 29b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 30093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org// Updates |rtcp_list| with timestamps from the latest RTCP SR. 31093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org// |new_rtcp_sr| will be set to true if these are the timestamps which have 32093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org// never be added to |rtcp_list|. 33093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.orgbool UpdateRtcpList(uint32_t ntp_secs, 34093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org uint32_t ntp_frac, 35093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org uint32_t rtp_timestamp, 36093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org RtcpList* rtcp_list, 37093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org bool* new_rtcp_sr); 38093fc0b0b0b9ca4fe56a32e17c9c418382e802f0wu@webrtc.org 39b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// Converts an RTP timestamp to the NTP domain in milliseconds using two 40b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// (RTP timestamp, NTP timestamp) pairs. 41b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgbool RtpToNtpMs(int64_t rtp_timestamp, const RtcpList& rtcp, 42b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org int64_t* timestamp_in_ms); 43b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 44b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// Returns 1 there has been a forward wrap around, 0 if there has been no wrap 45b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// around and -1 if there has been a backwards wrap around (i.e. reordering). 46b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgint CheckForWrapArounds(uint32_t rtp_timestamp, uint32_t rtcp_rtp_timestamp); 47d2fb259b3bc61c68f368929510215a7ee7d00fdawu@webrtc.org 48b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org} // namespace webrtc 49b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org 50d2fb259b3bc61c68f368929510215a7ee7d00fdawu@webrtc.org#endif // SYSTEM_WRAPPERS_INTERFACE_RTP_TO_NTP_H_ 51