Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ntp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Roc Streaming authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_rtcp/ntp.h
10//! @brief RTCP-specific NTP helpers.
11
12#ifndef ROC_RTCP_NTP_H_
13#define ROC_RTCP_NTP_H_
14
15#include "roc_packet/ntp.h"
16
17namespace roc {
18namespace rtcp {
19
20//! Clamp 64-bit NTP timestamp so that it does not exceed maximum.
22 packet::ntp_timestamp_t max_value);
23
24//! Clamp 64-bit NTP timestamp so that it fits into middle 32-bits.
25//! Value is rounded to the new resolution and capped with given maximum.
26//! Returned value has zeros in high and low 16 bits.
28 packet::ntp_timestamp_t max_value);
29
30//! Restore full 64-bit NTP timestamp from middle 32 bits.
31//! @param value is middle 32 bits of timestamp to be restored.
32//! @param base is full 64 bit timestamp that was recently obtained from same source.
33//! The function will combine high 16 bits of base with value.
34//! It will also detect possible wrap and apply correction if needed.
37
38} // namespace rtcp
39} // namespace roc
40
41#endif // ROC_RTCP_NTP_H_
uint64_t ntp_timestamp_t
NTP timestamp.
Definition ntp.h:35
packet::ntp_timestamp_t ntp_clamp_32(packet::ntp_timestamp_t value, packet::ntp_timestamp_t max_value)
Clamp 64-bit NTP timestamp so that it fits into middle 32-bits. Value is rounded to the new resolutio...
packet::ntp_timestamp_t ntp_clamp_64(packet::ntp_timestamp_t value, packet::ntp_timestamp_t max_value)
Clamp 64-bit NTP timestamp so that it does not exceed maximum.
packet::ntp_timestamp_t ntp_extend(packet::ntp_timestamp_t base, packet::ntp_timestamp_t value)
Restore full 64-bit NTP timestamp from middle 32 bits.
Root namespace.
Utitilies for NTP timestamp.