From 461c08142aa92e8ee121c451fd93d04490caff75 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 26 七月 2019 15:45:24 +0800 Subject: [PATCH] remove redundant code --- csrc/buz/recorder.cpp | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-) diff --git a/csrc/buz/recorder.cpp b/csrc/buz/recorder.cpp index 2267bf3..f83a596 100644 --- a/csrc/buz/recorder.cpp +++ b/csrc/buz/recorder.cpp @@ -24,7 +24,6 @@ ,minduration(10 * 25) ,end_frame(minduration) ,cur_frame(-1) - ,thread_(nullptr) ,stop_recorder_(false) ,id_(id) ,id_frame_(0) @@ -34,13 +33,8 @@ {} Recorder::~Recorder(){ - if(thread_){ - stop_recorder_.store(true); - cv_.notify_one(); - thread_->join(); - } - if(out_) - delete out_; + stop_recorder_.store(true); + cv_.notify_one(); } int Recorder::init_writer(){ @@ -149,13 +143,13 @@ } } } + if (out_){ + delete out_; + out_ = NULL; + } } int Recorder::Run(const char* output, const int mind, const int maxd){ - if(thread_){ - logIt("recorder already run"); - return 0; - } dir_ = output; int ret = init_writer(); @@ -173,9 +167,9 @@ logIt("min %d max %d endcount %d", minduration, maxduration, end_frame); - thread_.reset(new std::thread([&]{ + std::thread([&]{ run_thread(); - })); + }).detach(); return 0; } -- Gitblit v1.8.0