使用emplace_back优化代码 (#1542)

少了一次构造调用,为什么不用呢?
This commit is contained in:
alexliyu7352 2022-04-05 19:32:02 +08:00 committed by GitHub
parent 2818e371b8
commit efc3e78ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,7 +137,7 @@ void HlsMaker::flushLastSegment(bool eof){
if (seg_dur <= 0) { if (seg_dur <= 0) {
seg_dur = 100; seg_dur = 100;
} }
_seg_dur_list.push_back(std::make_tuple(seg_dur, std::move(_last_file_name))); _seg_dur_list.emplace_back(seg_dur, std::move(_last_file_name));
delOldSegment(); delOldSegment();
//先flush ts切片否则可能存在ts文件未写入完毕就被访问的情况 //先flush ts切片否则可能存在ts文件未写入完毕就被访问的情况
onFlushLastSegment(seg_dur); onFlushLastSegment(seg_dur);