胡斌

save hls header of total.m3u8 when total.m3u8 no content,last version save header when seq no is 0.

... ... @@ -844,17 +844,17 @@ int SrsHlsMuxer::segment_close(string log_desc)
//add segment to total.m3u8
std::stringstream ss;
if (currentSeg->sequence_no == 0) {
ret = total_m3u8_writer.open(total_m3u8);
if (ret != ERROR_SUCCESS) {
srs_error(
"open total file %s error:%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64,
total_m3u8.c_str(), log_desc.c_str(),
currentSeg->sequence_no, currentSeg->uri.c_str(),
currentSeg->duration,
currentSeg->segment_start_dts);
return ret;
}
ret = total_m3u8_writer.open_write(total_m3u8);
if (ret != ERROR_SUCCESS) {
srs_error(
"open total file %s error:%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64,
total_m3u8.c_str(), log_desc.c_str(),
currentSeg->sequence_no, currentSeg->uri.c_str(),
currentSeg->duration, currentSeg->segment_start_dts);
return ret;
}
if (!total_m3u8_writer.tellg()) {
//write total m3u8 header
ss << "#EXTM3U" << SRS_CONSTS_LF << "#EXT-X-VERSION:3"
... ... @@ -866,20 +866,10 @@ int SrsHlsMuxer::segment_close(string log_desc)
ss << "#EXT-X-TARGETDURATION:" << "6000" << SRS_CONSTS_LF;
srs_verbose("write m3u8 header success.");
} else {
ret = total_m3u8_writer.open_write(total_m3u8);
if (ret != ERROR_SUCCESS) {
srs_error(
"open total file %s error:%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64,
total_m3u8.c_str(), log_desc.c_str(),
currentSeg->sequence_no, currentSeg->uri.c_str(),
currentSeg->duration,
currentSeg->segment_start_dts);
return ret;
}
m3u8_total_endlist_saved = false;
}
bool erase_last_endlist = false;
if (currentSeg->is_sequence_header) {
... ...