HLS: 修复hls直播ts/m3u8文件更新导致mmap失效,触发bus error的bug

This commit is contained in:
ziyue
2021-12-22 15:42:03 +08:00
parent fe575af0d8
commit 2e9ff3ed3c
6 changed files with 44 additions and 38 deletions

View File

@@ -132,8 +132,10 @@ void HlsMaker::flushLastSegment(bool eof){
_seg_dur_list.push_back(std::make_tuple(seg_dur, std::move(_last_file_name)));
_last_file_name.clear();
delOldSegment();
makeIndexFile(eof);
//先flush ts切片否则可能存在ts文件未写入完毕就被访问的情况
onFlushLastSegment(seg_dur);
//然后写m3u8文件
makeIndexFile(eof);
}
bool HlsMaker::isLive() {