From d0b8204e3939e1e2d841a90ea254bc4b91309ab5 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期日, 19 一月 2020 13:32:13 +0800 Subject: [PATCH] update ffmepg gpu balance --- csrc/worker/rec.cpp | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/csrc/worker/rec.cpp b/csrc/worker/rec.cpp index 9c5ae1e..b5bbd5a 100644 --- a/csrc/worker/rec.cpp +++ b/csrc/worker/rec.cpp @@ -16,13 +16,13 @@ using namespace ffwrapper; using namespace cffmpeg_wrap::buz; -static const int cache_time = 6 * 60; +static const int cache_time = 3 * 60 + 30; namespace cffmpeg_wrap { rec::rec() :recRef_(NULL) - ,min_cache_len_(cache_time * 25) // 鏈�灏忕紦瀛�?鍒嗛挓鐨勮棰�,鍥犱负鏁翠釜娴佺▼浼氭湁寤惰繜,鏆傚畾?鍒嗛挓 + ,min_cache_len_(cache_time * 25) {} rec::~rec() @@ -75,7 +75,7 @@ start_id = i.v_id; } } - }else if (recRef_->isVideoPkt(&i.data->getAVPacket())){ + }else { // 瑙嗛甯�,鐪嬫槸鍚︾紦瀛樹腑鏈夋墍鏈夌殑duration鏁版嵁 if (i.v_id - start_id == duration){ end = index; @@ -255,16 +255,18 @@ void rec::SetRecMinCacheTime(const int min){ // 鐢变簬鏁翠釜娴佺▼鑰楁椂,琛ュ伩time_offset_ - int fps = 25; - if (recRef_){ - fps = recRef_->getFPS(); - } - min_cache_len_ += min * fps; + // int fps = 25; + // if (recRef_){ + // fps = recRef_->getFPS(); + // } + // if (min_cache_len_ > (cache_time+min) * fps){ + // return; + // } + // min_cache_len_ += min * fps; } int rec::shrinkCache(){ //瓒呰繃鏈�澶х紦瀛�,涓㈠純gop - while (list_pkt_.size() > min_cache_len_) { list_pkt_.pop_front(); while(!list_pkt_.empty()){ -- Gitblit v1.8.0