leon 1 місяць тому
батько
коміт
6464e4c17b
2 змінених файлів з 4 додано та 2 видалено
  1. 2 0
      src/nodes/stream/streamNode.cpp
  2. 2 2
      src/nodes/stream/streamNode.hpp

+ 2 - 0
src/nodes/stream/streamNode.cpp

@@ -66,6 +66,8 @@ void StreamNode::work_gpu()
     unsigned int frame_index = 0;
 
     if (target_fps_ > 0.0) {
+        target_duration_ = std::chrono::duration_cast<std::chrono::microseconds>(
+            std::chrono::duration<double>(1.0 / fps_));
         last_push_time_ = std::chrono::high_resolution_clock::now();
     }
 

+ 2 - 2
src/nodes/stream/streamNode.hpp

@@ -100,10 +100,10 @@ private:
     StreamStatus status_ = StreamStatus::CLOSED;
 
 
-    double target_fps_; // Desired output FPS (0 or negative means no control)
+    double target_fps_ = 25; // Desired output FPS (0 or negative means no control)
     std::chrono::microseconds target_duration_{0}; // Duration per frame
     std::chrono::time_point<std::chrono::high_resolution_clock> last_push_time_; // Time when the last frame was pushed
-    
+
 };
 
 }