video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-10-19 eb354f009a3678930b95bd3f160f2de3c0804e5d
update rec offset
1个文件已修改
14 ■■■■ 已修改文件
csrc/worker/rec.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/worker/rec.cpp
@@ -21,7 +21,7 @@
    rec::rec()
    :recRef_(NULL)
    ,min_cache_len_(125)
    ,time_offset_(4)
    ,time_offset_(5)
    {}
    rec::~rec()
@@ -195,7 +195,7 @@
    }
    void rec::SetRecMinCacheTime(const int min){
        // 由于整个流程耗时,补偿time_offset_,因为是最小的一半,只有time_offset_/2
        // 由于整个流程耗时,补偿time_offset_
        int fps = 25;
        if (recRef_){
            fps = recRef_->getFPS();
@@ -206,8 +206,14 @@
    int rec::shrinkCache(){
        //超过最大缓存,丢弃gop
        //缓存最小长度的,用于记录
        int md = min_cache_len_ < 200 ? 200 : min_cache_len_;
        while (list_pkt_.size() > md/2) {
        int fps = 25;
        if (recRef_){
            fps = recRef_->getFPS();
        }
        // 最小5秒长度
        int mincache = fps * 5;
        int md = min_cache_len_ < mincache ? mincache : min_cache_len_;
        while (list_pkt_.size() > md) {
            list_pkt_.pop_front();
            while(!list_pkt_.empty()){
                auto &i = list_pkt_.front();