|
@@ -64,6 +64,11 @@ void StreamNode::work_gpu()
|
|
|
printf("packet_size = %d\n", packet_size);
|
|
|
|
|
|
unsigned int frame_index = 0;
|
|
|
+
|
|
|
+ if (target_fps_ > 0.0) {
|
|
|
+ last_push_time_ = std::chrono::high_resolution_clock::now();
|
|
|
+ }
|
|
|
+
|
|
|
while(running_)
|
|
|
{
|
|
|
demuxer_->demux(&packet_data, &packet_size, &pts);
|
|
@@ -90,7 +95,7 @@ void StreamNode::work_gpu()
|
|
|
auto wait_duration = target_duration_ - elapsed;
|
|
|
|
|
|
if (wait_duration.count() > 0) {
|
|
|
- // printf("Waiting for %lld us\n", (long long)wait_duration.count());
|
|
|
+ printf("Waiting for %lld us\n", (long long)wait_duration.count());
|
|
|
std::this_thread::sleep_for(wait_duration);
|
|
|
} else {
|
|
|
// 如果 elapsed 已经超过 target_duration,说明处理落后了,不需要等待
|