diff --git a/src/single_window/render.cpp b/src/single_window/render.cpp index 4b810da..ab74e45 100644 --- a/src/single_window/render.cpp +++ b/src/single_window/render.cpp @@ -159,16 +159,18 @@ int Render::StartScreenCapture() { rect.top = 0; rect.right = screen_width_; rect.bottom = screen_height_; - last_frame_time_ = std::chrono::steady_clock::now(); + last_frame_time_ = std::chrono::duration_cast( + std::chrono::steady_clock::now().time_since_epoch()) + .count(); int screen_capturer_init_ret = screen_capturer_->Init( rect, 60, [this](unsigned char *data, int size, int width, int height) -> void { - auto now_time = std::chrono::steady_clock::now(); - std::chrono::duration duration = now_time - last_frame_time_; - auto tc = duration.count() * 1000; - - if (tc >= 0 && connection_established_) { + auto now_time = std::chrono::duration_cast( + std::chrono::steady_clock::now().time_since_epoch()) + .count(); + auto duration = now_time - last_frame_time_; + if (duration >= 0 && connection_established_) { SendData(peer_, DATA_TYPE::VIDEO, (const char *)data, NV12_BUFFER_SIZE); last_frame_time_ = now_time; diff --git a/src/single_window/render.h b/src/single_window/render.h index b2a45a8..33a92c8 100644 --- a/src/single_window/render.h +++ b/src/single_window/render.h @@ -249,12 +249,7 @@ class Render { SpeakerCapturer *speaker_capturer_ = nullptr; DeviceControllerFactory *device_controller_factory_ = nullptr; MouseController *mouse_controller_ = nullptr; - -#ifdef __linux__ - std::chrono::_V2::system_clock::time_point last_frame_time_; -#else - std::chrono::steady_clock::time_point last_frame_time_; -#endif + uint32_t last_frame_time_; private: char client_id_[10] = ""; diff --git a/thirdparty/projectx b/thirdparty/projectx index e9be021..6ae1277 160000 --- a/thirdparty/projectx +++ b/thirdparty/projectx @@ -1 +1 @@ -Subproject commit e9be021c0fe3c29ca3f6c6d40d2139569d354475 +Subproject commit 6ae12771c2153665a2af86058ecca550e7523d7e