video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-08-07 4eab3ca9bf020df2bb53fa2a36aa4f57d684225c
add rec notify, try catch
2个文件已修改
34 ■■■■ 已修改文件
csrc/buz/recorder.cpp 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/wrapper.cpp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/buz/recorder.cpp
@@ -37,29 +37,22 @@
        }
        Recorder::~Recorder(){
            // if (out_){
            //     stop_recorder_.store(true);
            //     cv_.notify_one();
            //     int try_cnt = 0;
            //     while(stop_recorder_.load()){
            //         logIt("REC WAIT TO QUIT ID %s", id_.c_str());
            //         if (try_cnt > 100){
            //             logIt("REC TRY %d TIMES TO QUIT..., BREAK!!!", try_cnt);
            //             break;
            //         }
            //         try_cnt++;
            //         sleep(1);
            //     }
            // }else if (stop_recorder_.load()){
            //     logIt("REC NORMAL QUIT");
            // }
            
            try
            {
            if (thrd_){
                stop_recorder_.store(true);
                    cv_.notify_one();
                thrd_->join();
                logIt("REC THREAD JOINED, QUIT!!!");
            }
        }
            catch(const std::exception& e)
            {
                logIt("RECODER DESTRUCTOR EXCEPTION: ", e.what());
            }
        }
        int Recorder::init_writer(){
            if (out_) {
csrc/wrapper.cpp
@@ -48,6 +48,8 @@
    Wrapper::~Wrapper()
    {
        try
        {
        if(thread_){
            stop_stream_.store(true);
            thread_->join();
@@ -63,6 +65,13 @@
            free(i.data);
        }
    }
        catch(const std::exception& e)
        {
            logIt("WRAPPER EXCEPTION: ", e.what());
        }
    }
    void Wrapper::ScalePicture(const int w, const int h, const int flags){
        scale_w_ = w;