From bfded635a544a1ab5d252739f4be4f7f30b39b7f Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 26 七月 2019 14:46:48 +0800 Subject: [PATCH] update ffmpeg --- csrc/wrapper.cpp | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/csrc/wrapper.cpp b/csrc/wrapper.cpp index 47ddc82..d67cb8d 100644 --- a/csrc/wrapper.cpp +++ b/csrc/wrapper.cpp @@ -246,37 +246,42 @@ func_rec_(path, index); }else{ // passive api std::lock_guard<std::mutex> l(mutex_rec_); - while(list_rec_.size() > 10){ - for(int i = 0; i < 5; i++){ + while(list_rec_.size() > 100){ + for(int i = 0; i < 25; i++){ list_rec_.pop_front(); } } struct record_file_info info; - info.id = id; info.file_frame_index = index; info.file_path = path; list_rec_.emplace_back(info); + list_rec_map_[path] = id; logIt("list rec files count : %d", list_rec_.size()); map_rec_.erase(id); } } - void Wrapper::GetInfoRecorder(std::string &sid, int &index, std::string &path){ + void Wrapper::GetInfoRecorder(int &index, std::string &path){ std::lock_guard<std::mutex> l(mutex_rec_); if(list_rec_.empty()){ index = -1; path = ""; - sid = ""; return; } auto info = list_rec_.front(); index = info.file_frame_index; path = info.file_path; - sid = info.id; list_rec_.pop_front(); // logIt("go get info index: %d, file: %s\n", index, path.c_str()); } + std::string Wrapper::GetRecorderID(const std::string &path){ + auto iter = list_rec_map_.find(path); + if (iter != list_rec_map_.end()){ + return iter->second; + } + return ""; + } ////////decoder void Wrapper::BuildDecoder(){ use_decoder_ = true; -- Gitblit v1.8.0