- minor improvements for pvqa_pcap project

This commit is contained in:
Dmytro Bogovych 2025-01-30 17:44:12 +03:00
parent 34e43bf301
commit 5ce85e3a09
4 changed files with 8 additions and 2 deletions

View File

@ -120,6 +120,11 @@ timespec chronox::toTimespec(uint64_t milliseconds)
return r; return r;
} }
uint64_t chronox::toTimestamp(const timeval& ts)
{
return ts.tv_sec * 1000 + ts.tv_usec / 1000;
}
int64_t chronox::getDelta(const timespec& a, const timespec& b) int64_t chronox::getDelta(const timespec& a, const timespec& b)
{ {
uint64_t ms_a = a.tv_sec * 1000 + a.tv_nsec / 10000000; uint64_t ms_a = a.tv_sec * 1000 + a.tv_nsec / 10000000;

View File

@ -61,6 +61,7 @@ public:
// Converts number of milliseconds starting from Epoch begin to timespec. // Converts number of milliseconds starting from Epoch begin to timespec.
static timespec toTimespec(uint64_t milliseconds); static timespec toTimespec(uint64_t milliseconds);
static uint64_t toTimestamp(const timeval& ts);
// Returns difference between timestamps in milliseconds // Returns difference between timestamps in milliseconds
static int64_t getDelta(const timespec& a, const timespec& b); static int64_t getDelta(const timespec& a, const timespec& b);

View File

@ -795,7 +795,7 @@ bool Session::isDataIndication(ByteBuffer& source, ByteBuffer* plain)
return false; return false;
} }
bool Session::isStun(ByteBuffer& source) bool Session::isStun(const ByteBuffer& source)
{ {
if (source.size() < 8) if (source.size() < 8)
return false; return false;

View File

@ -140,7 +140,7 @@ namespace ice
bool hasAllocations(); bool hasAllocations();
static bool isDataIndication(ByteBuffer& source, ByteBuffer* plain); static bool isDataIndication(ByteBuffer& source, ByteBuffer* plain);
static bool isStun(ByteBuffer& source); static bool isStun(const ByteBuffer& source);
static bool isRtp(ByteBuffer& source); static bool isRtp(ByteBuffer& source);
static bool isChannelData(ByteBuffer& source, TurnPrefix prefix); static bool isChannelData(ByteBuffer& source, TurnPrefix prefix);