| | |
| | | ,file_frame_index_(-1) |
| | | ,file_path_("") |
| | | ,func_rec_info_(nullptr) |
| | | ,thrd_(nullptr) |
| | | { |
| | | // logIt("RECODER ID: %s", id_.c_str()); |
| | | } |
| | | |
| | | Recorder::~Recorder(){ |
| | | if (out_ && !stop_recorder_.load()){ |
| | | stop_recorder_.store(true); |
| | | cv_.notify_one(); |
| | | while(stop_recorder_.load()){ |
| | | logIt("REC WAIT TO QUIT ID %s", id_.c_str()); |
| | | sleep(1); |
| | | } |
| | | }else if (stop_recorder_.load()){ |
| | | logIt("REC NORMAL QUIT"); |
| | | } |
| | | // 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"); |
| | | // } |
| | | |
| | | stop_recorder_.store(true); |
| | | thrd_->join(); |
| | | logIt("REC THREAD JOINED, QUIT!!!"); |
| | | } |
| | | |
| | | int Recorder::init_writer(){ |
| | |
| | | |
| | | logIt("minduration %d maxduration %d curduration %d", minduration, maxduration, end_frame); |
| | | |
| | | std::thread([&]{ |
| | | thrd_.reset(new std::thread([&]{ |
| | | run_thread(); |
| | | }).detach(); |
| | | })); |
| | | //.detach(); |
| | | |
| | | return 0; |
| | | } |