diff --git a/src/engine/helper/HL_Sync.cpp b/src/engine/helper/HL_Sync.cpp index 9e4671c5..a7ade995 100644 --- a/src/engine/helper/HL_Sync.cpp +++ b/src/engine/helper/HL_Sync.cpp @@ -120,6 +120,11 @@ timespec chronox::toTimespec(uint64_t milliseconds) 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) { uint64_t ms_a = a.tv_sec * 1000 + a.tv_nsec / 10000000; diff --git a/src/engine/helper/HL_Sync.h b/src/engine/helper/HL_Sync.h index b30fc1ca..3fb85b71 100644 --- a/src/engine/helper/HL_Sync.h +++ b/src/engine/helper/HL_Sync.h @@ -61,6 +61,7 @@ public: // Converts number of milliseconds starting from Epoch begin to timespec. static timespec toTimespec(uint64_t milliseconds); + static uint64_t toTimestamp(const timeval& ts); // Returns difference between timestamps in milliseconds static int64_t getDelta(const timespec& a, const timespec& b); diff --git a/src/libs/ice/ICESession.cpp b/src/libs/ice/ICESession.cpp index c6be056a..7b6ca3d4 100644 --- a/src/libs/ice/ICESession.cpp +++ b/src/libs/ice/ICESession.cpp @@ -795,7 +795,7 @@ bool Session::isDataIndication(ByteBuffer& source, ByteBuffer* plain) return false; } -bool Session::isStun(ByteBuffer& source) +bool Session::isStun(const ByteBuffer& source) { if (source.size() < 8) return false; diff --git a/src/libs/ice/ICESession.h b/src/libs/ice/ICESession.h index c7cdebfa..cccaf5b8 100644 --- a/src/libs/ice/ICESession.h +++ b/src/libs/ice/ICESession.h @@ -140,7 +140,7 @@ namespace ice bool hasAllocations(); 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 isChannelData(ByteBuffer& source, TurnPrefix prefix);