video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-10-11 eeb89c114214678a2968c151b91440374ff50572
fix rec no such file
1个文件已修改
27 ■■■■ 已修改文件
csrc/buz/recorder.cpp 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/buz/recorder.cpp
@@ -78,7 +78,8 @@
            out_ = new FormatOut(in_->getFPS(), "mp4");
            
            int pid = getpid();
            file_path_ = dir_ + "/" + sole::uuid4().base62() + "-" + std::to_string(pid) + ".mp4";
            std::string filename(sole::uuid4().base62() + "-" + std::to_string(pid) + ".mp4");
            file_path_ = dir_ + "/" + filename;
            auto v = in_->getStream(AVMEDIA_TYPE_VIDEO);
            if (!v){
@@ -88,10 +89,18 @@
            if (!audio){
                a = NULL;
            }
            auto ret = out_->JustWriter(v, a, file_path_.c_str());
            bool ret = out_->JustWriter(v, a, file_path_.c_str());
            if (ret){
                logIt("start record file: %s", file_path_.c_str());
                logIt("start record file: %s", file_path_.c_str());
                return 0;
            }else{
                file_path_ = "./" + filename;
                ret = out_->JustWriter(v, a, file_path_.c_str());
                logIt("failed in dir %s, try file %s to start record file", dir_.c_str(), file_path_.c_str());
                if (ret){
                    logIt("start record file: %s", file_path_.c_str());
                    return 0;
                }
            }
            logIt("failed to start record: %s", file_path_.c_str());
@@ -105,12 +114,18 @@
            }
            int pid = getpid();
            file_path_ = dir_ + "/" + sole::uuid4().base62() + "-" + std::to_string(pid) + ".hevc";
            std::string filename(sole::uuid4().base62() + "-" + std::to_string(pid) + ".mp4");
            file_path_ = dir_ + "/" + filename;
            fp_ = fopen(file_path_.c_str(), "wb");
            if (!fp_){
                logIt("write hevc open file error: %s", file_path_.c_str());
                return -1;
                file_path_ = "./" + filename;
                logIt("failed in dir %s, try file %s to start record hevc file", dir_.c_str(), file_path_.c_str());
                fp_ = fopen(file_path_.c_str(), "wb");
                if (!fp_){
                    logIt("failed start record hevc file: %s", file_path_.c_str());
                    return -1;
                }
            }
            logIt("start record file: %s", file_path_.c_str());