video analysis2.0拆分,ffmpeg封装go接口库
554325746@qq.com
2020-03-10 0a889a53b5b5cf09b7358727524d8a1985d41d41
bug fixed file frmaes statistic
1个文件已修改
13 ■■■■ 已修改文件
csrc/wrapper.cpp 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
            }