diff --git a/src/media/video/sinkclient.cpp b/src/media/video/sinkclient.cpp index 6d8ba4b65b80f1d4396724d741c5a8f6249bb078..4e9f15bd48ccadd9c8df14e24f6f8a69d6917e3d 100644 --- a/src/media/video/sinkclient.cpp +++ b/src/media/video/sinkclient.cpp @@ -330,7 +330,7 @@ SinkClient::SinkClient(const std::string& id, bool mixer) , scaler_(new VideoScaler()) #ifdef DEBUG_FPS , frameCount_(0u) - , lastFrameDebug_(std::chrono::system_clock::now()) + , lastFrameDebug_(std::chrono::steady_clock::now()) #endif { JAMI_DBG("[Sink:%p] Sink [%s] created", this, getId().c_str()); @@ -416,11 +416,11 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/, const std::shared_ptr<MediaFrame>& frame_p) { #ifdef DEBUG_FPS - auto currentTime = std::chrono::system_clock::now(); - std::chrono::duration<double> seconds = currentTime - lastFrameDebug_; + auto currentTime = std::chrono::steady_clock::now(); + auto seconds = currentTime - lastFrameDebug_; ++frameCount_; - if (seconds.count() > 1) { - auto fps = frameCount_ / seconds.count(); + if (seconds > std::chrono::seconds(1)) { + auto fps = frameCount_ / std::chrono::duration<double>(seconds).count(); // Send the framerate in smartInfo Smartools::getInstance().setFrameRate(id_, std::to_string(fps)); frameCount_ = 0; diff --git a/src/media/video/sinkclient.h b/src/media/video/sinkclient.h index 90313f487844e65034105ea309f62d406c2ef0f0..ed3d9fdfe562d6d49beb047da06a3603a5732060 100644 --- a/src/media/video/sinkclient.h +++ b/src/media/video/sinkclient.h @@ -119,7 +119,7 @@ private: #ifdef DEBUG_FPS unsigned frameCount_; - std::chrono::time_point<std::chrono::system_clock> lastFrameDebug_; + std::chrono::steady_clock::time_point lastFrameDebug_; #endif #if HAVE_SHM