胡斌

add "#EXT-X-ENDLIST\n" at the end of total.m3u8 when unpublish

... ... @@ -323,14 +323,17 @@ SrsHlsMuxer::~SrsHlsMuxer()
void SrsHlsMuxer::dispose()
{
if (should_write_file) {
if (hls_cleanup) {
std::vector<SrsHlsSegment*>::iterator it;
for (it = segments.begin(); it != segments.end(); ++it) {
SrsHlsSegment* segment = *it;
if (unlink(segment->full_path.c_str()) < 0) {
srs_warn("dispose unlink path failed, file=%s.", segment->full_path.c_str());
srs_warn("dispose unlink path failed, file=%s.",
segment->full_path.c_str());
}
srs_freep(segment);
}
}
segments.clear();
if (current) {
... ... @@ -816,6 +819,10 @@ int SrsHlsMuxer::segment_close(string log_desc)
ss << currentSeg->uri << SRS_CONSTS_LF;
srs_verbose("write m3u8 segment uri success.");
if(log_desc == "unpublish"){
ss << "#EXT-X-ENDLIST" << SRS_CONSTS_LF;
}
// write m3u8 to writer.
std::string m3u8 = ss.str();
if ((ret = total_m3u8_writer.write((char*) m3u8.c_str(),
... ...