From 0a889a53b5b5cf09b7358727524d8a1985d41d41 Mon Sep 17 00:00:00 2001
From: 554325746@qq.com <554325746@qq.com>
Date: 星期二, 10 三月 2020 10:45:23 +0800
Subject: [PATCH] bug fixed file frmaes statistic

---
 csrc/wrapper.cpp |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp
index 7ad32f1..813ddb7 100644
--- a/csrc/wrapper.cpp
+++ b/csrc/wrapper.cpp
@@ -193,7 +193,8 @@
 
     void Wrapper::run_stream_thread(){
         
-        int64_t rebootime = -1;
+        int64_t file_rebootime = 0;
+        int64_t file_frame = 0;
 
         while(!stop_stream_.load()){
             auto in = init_reader(input_url_.c_str());
@@ -203,8 +204,6 @@
                 sleep(2);
                 continue;
             }
-
-            rebootime++;
 
             fps_ = in->getFPS();
             
@@ -224,8 +223,8 @@
             bool exist = access(input_url_.c_str(), 0) == 0;
             if (exist){
                 wTime <<= 1;
+                file_rebootime++;
             }
-            int64_t file_frame = 0;
 
             logIt("WAIT TIME PER FRAME: %d", wTime);
 
@@ -270,14 +269,16 @@
 
             deinit_worker();
             if (exist) {
-                if (file_frame == 0 && rebootime > 3){
+                // 涓夋涓�甯ч兘娌¤В鍑烘潵锛岄��鍑�
+                if (file_frame == 0 && file_rebootime > 3){
                     file_finished_ = true;
                     break;
                 }
+                // 鏈�灏忛渶瑕佽В鍑哄灏戝抚
                 if (file_frame < min_duration_ * fps_){
                     continue;
                 }
-                logIt("libcffmpeg.so-> local file %s run %lld time, all frames %lld", input_url_.c_str(), rebootime, file_frame);
+                logIt("libcffmpeg.so-> local file %s run %lld time, all frames %lld", input_url_.c_str(), file_rebootime, file_frame);
                 file_finished_ = true;
                 break;
             }

--
Gitblit v1.8.0