mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
SinkClient: use steady_clock for FPS calculation
Change-Id: Ic14fe56d0223433782d06a97904024b56c9ab732
This commit is contained in:
@ -330,7 +330,7 @@ SinkClient::SinkClient(const std::string& id, bool mixer)
|
|||||||
, scaler_(new VideoScaler())
|
, scaler_(new VideoScaler())
|
||||||
#ifdef DEBUG_FPS
|
#ifdef DEBUG_FPS
|
||||||
, frameCount_(0u)
|
, frameCount_(0u)
|
||||||
, lastFrameDebug_(std::chrono::system_clock::now())
|
, lastFrameDebug_(std::chrono::steady_clock::now())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
JAMI_DBG("[Sink:%p] Sink [%s] created", this, getId().c_str());
|
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)
|
const std::shared_ptr<MediaFrame>& frame_p)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_FPS
|
#ifdef DEBUG_FPS
|
||||||
auto currentTime = std::chrono::system_clock::now();
|
auto currentTime = std::chrono::steady_clock::now();
|
||||||
std::chrono::duration<double> seconds = currentTime - lastFrameDebug_;
|
auto seconds = currentTime - lastFrameDebug_;
|
||||||
++frameCount_;
|
++frameCount_;
|
||||||
if (seconds.count() > 1) {
|
if (seconds > std::chrono::seconds(1)) {
|
||||||
auto fps = frameCount_ / seconds.count();
|
auto fps = frameCount_ / std::chrono::duration<double>(seconds).count();
|
||||||
// Send the framerate in smartInfo
|
// Send the framerate in smartInfo
|
||||||
Smartools::getInstance().setFrameRate(id_, std::to_string(fps));
|
Smartools::getInstance().setFrameRate(id_, std::to_string(fps));
|
||||||
frameCount_ = 0;
|
frameCount_ = 0;
|
||||||
|
@ -119,7 +119,7 @@ private:
|
|||||||
|
|
||||||
#ifdef DEBUG_FPS
|
#ifdef DEBUG_FPS
|
||||||
unsigned frameCount_;
|
unsigned frameCount_;
|
||||||
std::chrono::time_point<std::chrono::system_clock> lastFrameDebug_;
|
std::chrono::steady_clock::time_point lastFrameDebug_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_SHM
|
#if HAVE_SHM
|
||||||
|
Reference in New Issue
Block a user