From c28e96c3afeff711606eb80d7bd7cd6082169ab5 Mon Sep 17 00:00:00 2001 From: renlu Date: Thu, 8 Dec 2022 09:47:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E7=9B=B4=E6=92=AD=E5=88=B0=E5=BD=95?= =?UTF-8?q?=E5=83=8F=EF=BC=8C=E4=B8=8D=E5=88=A0=E9=99=A4=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E7=9A=848=E4=B8=AA=E5=88=87=E7=89=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Record/HlsMakerSub.cpp | 36 ++++++++++++++++++------------------ src/Record/HlsMakerSub.h | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Record/HlsMakerSub.cpp b/src/Record/HlsMakerSub.cpp index 361aeb33..84a033ae 100644 --- a/src/Record/HlsMakerSub.cpp +++ b/src/Record/HlsMakerSub.cpp @@ -43,24 +43,24 @@ void HlsMakerSub::startRecord(bool isRecord) { if (isRecord == _is_record) { return; } - //如果是录像,则删除之前直播的8个ts文件 - if (isRecord) { - std::map delete_file_paths = _segment_file_paths; - _segment_file_paths.clear(); - int count = 0; - //删除_segment_file_paths路径对应的直播文件,过30s再删除,免得hls直播突然断掉 - for (auto it : delete_file_paths) { - count ++; - if (count < delete_file_paths.size()) { - auto ts_path = it.second; - File::delete_file(ts_path.data()); - //_poller->doDelayTask(30 * 1000, [ts_path]() { - // File::delete_file(ts_path.data()); - // return 0; - //}); - } - } - } + ////如果是录像,则删除之前直播的8个ts文件 + //if (isRecord) { + // std::map delete_file_paths = _segment_file_paths; + // _segment_file_paths.clear(); + // int count = 0; + // //删除_segment_file_paths路径对应的直播文件,过10s再删除,免得hls直播突然断掉 + // for (auto it : delete_file_paths) { + // count ++; + // if (count < delete_file_paths.size()) { + // auto ts_path = it.second; + // File::delete_file(ts_path.data()); + // _poller->doDelayTask(10 * 1000, [ts_path]() { + // File::delete_file(ts_path.data()); + // return 0; + // }); + // } + // } + //} if(isRecord) { _seg_keep = true; diff --git a/src/Record/HlsMakerSub.h b/src/Record/HlsMakerSub.h index 622f1b5b..330447c4 100644 --- a/src/Record/HlsMakerSub.h +++ b/src/Record/HlsMakerSub.h @@ -18,7 +18,7 @@ #include "Util/File.h" #include "Util/util.h" #include "Util/logger.h" -#include "ZLToolKit/src/Poller/EventPoller.h" +//#include "ZLToolKit/src/Poller/EventPoller.h" namespace mediakit { class HlsMakerSub {