save hls header of total.m3u8 when total.m3u8 no content,last version save header when seq no is 0.
正在显示
1 个修改的文件
包含
13 行增加
和
23 行删除
@@ -844,17 +844,17 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -844,17 +844,17 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
844 | //add segment to total.m3u8 | 844 | //add segment to total.m3u8 |
845 | std::stringstream ss; | 845 | std::stringstream ss; |
846 | 846 | ||
847 | - if (currentSeg->sequence_no == 0) { | ||
848 | - ret = total_m3u8_writer.open(total_m3u8); | ||
849 | - if (ret != ERROR_SUCCESS) { | ||
850 | - srs_error( | ||
851 | - "open total file %s error:%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64, | ||
852 | - total_m3u8.c_str(), log_desc.c_str(), | ||
853 | - currentSeg->sequence_no, currentSeg->uri.c_str(), | ||
854 | - currentSeg->duration, | ||
855 | - currentSeg->segment_start_dts); | ||
856 | - return ret; | ||
857 | - } | 847 | + ret = total_m3u8_writer.open_write(total_m3u8); |
848 | + if (ret != ERROR_SUCCESS) { | ||
849 | + srs_error( | ||
850 | + "open total file %s error:%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64, | ||
851 | + total_m3u8.c_str(), log_desc.c_str(), | ||
852 | + currentSeg->sequence_no, currentSeg->uri.c_str(), | ||
853 | + currentSeg->duration, currentSeg->segment_start_dts); | ||
854 | + return ret; | ||
855 | + } | ||
856 | + | ||
857 | + if (!total_m3u8_writer.tellg()) { | ||
858 | //write total m3u8 header | 858 | //write total m3u8 header |
859 | 859 | ||
860 | ss << "#EXTM3U" << SRS_CONSTS_LF << "#EXT-X-VERSION:3" | 860 | ss << "#EXTM3U" << SRS_CONSTS_LF << "#EXT-X-VERSION:3" |
@@ -866,20 +866,10 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -866,20 +866,10 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
866 | ss << "#EXT-X-TARGETDURATION:" << "6000" << SRS_CONSTS_LF; | 866 | ss << "#EXT-X-TARGETDURATION:" << "6000" << SRS_CONSTS_LF; |
867 | 867 | ||
868 | srs_verbose("write m3u8 header success."); | 868 | srs_verbose("write m3u8 header success."); |
869 | - | ||
870 | - } else { | ||
871 | - ret = total_m3u8_writer.open_write(total_m3u8); | ||
872 | - if (ret != ERROR_SUCCESS) { | ||
873 | - srs_error( | ||
874 | - "open total file %s error:%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64, | ||
875 | - total_m3u8.c_str(), log_desc.c_str(), | ||
876 | - currentSeg->sequence_no, currentSeg->uri.c_str(), | ||
877 | - currentSeg->duration, | ||
878 | - currentSeg->segment_start_dts); | ||
879 | - return ret; | ||
880 | - } | 869 | + m3u8_total_endlist_saved = false; |
881 | } | 870 | } |
882 | 871 | ||
872 | + | ||
883 | bool erase_last_endlist = false; | 873 | bool erase_last_endlist = false; |
884 | 874 | ||
885 | if (currentSeg->is_sequence_header) { | 875 | if (currentSeg->is_sequence_header) { |
-
请 注册 或 登录 后发表评论