style: add clang-format config and reformat scaffolding files
This commit is contained in:
@@ -6,14 +6,14 @@ namespace sc {
|
||||
|
||||
// RTP clock rate for video is 90 kHz. Convert a monotonic nanosecond timestamp
|
||||
// into a 32-bit RTP timestamp. Overflows wrap around intentionally.
|
||||
constexpr uint32_t rtp_timestamp_from_ns ( uint64_t nanoseconds ) noexcept {
|
||||
constexpr uint32_t rtp_timestamp_from_ns(uint64_t nanoseconds) noexcept {
|
||||
// (nanoseconds * 90_000) / 1_000_000_000
|
||||
// Simplify: 90_000 / 1_000_000_000 = 9 / 100_000
|
||||
return static_cast<uint32_t> ( ( nanoseconds * 9ULL ) / 100'000ULL );
|
||||
return static_cast<uint32_t>((nanoseconds * 9ULL) / 100'000ULL);
|
||||
}
|
||||
|
||||
static_assert ( rtp_timestamp_from_ns ( 0 ) == 0 );
|
||||
static_assert ( rtp_timestamp_from_ns ( 1'000'000'000ULL ) == 90'000 );
|
||||
static_assert ( rtp_timestamp_from_ns ( 500'000'000ULL ) == 45'000 );
|
||||
static_assert(rtp_timestamp_from_ns(0) == 0);
|
||||
static_assert(rtp_timestamp_from_ns(1'000'000'000ULL) == 90'000);
|
||||
static_assert(rtp_timestamp_from_ns(500'000'000ULL) == 45'000);
|
||||
|
||||
} // namespace sc
|
||||
} // namespace sc
|
||||
|
||||
Reference in New Issue
Block a user