From aa4b2967c7d28dd935b88ed73f4ac439618d0181 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 21 Nov 2021 16:51:19 +0100 Subject: [PATCH] Adding a timestamp to Session instanciation Used to compute runtime of a session --- Session.cpp | 6 ++++++ Session.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Session.cpp b/Session.cpp index f2c97f9..58ad33e 100644 --- a/Session.cpp +++ b/Session.cpp @@ -59,6 +59,7 @@ Session::Session() : active_(true), filename_(""), failedSource_(nullptr), fadin config_[View::TEXTURE]->translation_ = Settings::application.views[View::TEXTURE].default_translation; snapshots_.xmlDoc_ = new tinyxml2::XMLDocument; + start_time_ = gst_util_get_timestamp (); } @@ -87,6 +88,11 @@ Session::~Session() delete snapshots_.xmlDoc_; } +uint64_t Session::runtime() const +{ + return gst_util_get_timestamp () - start_time_; +} + void Session::setActive (bool on) { if (active_ != on) { diff --git a/Session.h b/Session.h index 547007c..4c2ca47 100644 --- a/Session.h +++ b/Session.h @@ -74,6 +74,7 @@ public: // update all sources and mark sources which failed void update (float dt); + uint64_t runtime() const; // update mode (active or not) void setActive (bool on); @@ -159,6 +160,7 @@ protected: float fading_target_; std::mutex access_; FrameBufferImage *thumbnail_; + uint64_t start_time_; };