don't save total duration if hls_total_file is not configured
正在显示
2 个修改的文件
包含
8 行增加
和
4 行删除
@@ -73,7 +73,7 @@ const char* _srs_version = "XCORE-"RTMP_SIG_SRS_SERVER; | @@ -73,7 +73,7 @@ const char* _srs_version = "XCORE-"RTMP_SIG_SRS_SERVER; | ||
73 | #define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html" | 73 | #define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html" |
74 | #define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8" | 74 | #define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8" |
75 | #define SRS_CONF_DEFAULT_HLS_TOTAL_M3U8_FILE "" | 75 | #define SRS_CONF_DEFAULT_HLS_TOTAL_M3U8_FILE "" |
76 | -#define SRS_CONF_DEFAULT_HLS_TOTAL_FILE "[app]/[stream]_total" | 76 | +#define SRS_CONF_DEFAULT_HLS_TOTAL_FILE "" |
77 | #define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts" | 77 | #define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts" |
78 | #define SRS_CONF_DEFAULT_HLS_TS_FLOOR false | 78 | #define SRS_CONF_DEFAULT_HLS_TS_FLOOR false |
79 | #define SRS_CONF_DEFAULT_HLS_FRAGMENT 10 | 79 | #define SRS_CONF_DEFAULT_HLS_FRAGMENT 10 |
@@ -833,6 +833,7 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -833,6 +833,7 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
833 | } | 833 | } |
834 | srs_info("write total m3u8 %s success.", m3u8_total_file.c_str()); | 834 | srs_info("write total m3u8 %s success.", m3u8_total_file.c_str()); |
835 | 835 | ||
836 | + if (!total_url.empty()) { | ||
836 | this->total_duraion += currentSeg->duration; | 837 | this->total_duraion += currentSeg->duration; |
837 | SrsFileWriter total_writer; | 838 | SrsFileWriter total_writer; |
838 | //write total duration to total | 839 | //write total duration to total |
@@ -846,13 +847,16 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -846,13 +847,16 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
846 | 847 | ||
847 | if ((ret = total_writer.write((char*) ss_total.str().c_str(), | 848 | if ((ret = total_writer.write((char*) ss_total.str().c_str(), |
848 | (int) ss_total.str().length(), NULL)) != ERROR_SUCCESS) { | 849 | (int) ss_total.str().length(), NULL)) != ERROR_SUCCESS) { |
849 | - srs_error("write total temp:%s failed. ret=%d",(char*) total_tmp.c_str(), ret); | 850 | + srs_error("write total temp:%s failed. ret=%d", |
851 | + (char* ) total_tmp.c_str(), ret); | ||
850 | return ret; | 852 | return ret; |
851 | } | 853 | } |
852 | 854 | ||
853 | - if(rename(total_tmp.c_str(), total.c_str()) < 0) { | 855 | + if (rename(total_tmp.c_str(), total.c_str()) < 0) { |
854 | ret = ERROR_HLS_WRITE_FAILED; | 856 | ret = ERROR_HLS_WRITE_FAILED; |
855 | - srs_error("rename total file failed. %s => %s, ret=%d", total_tmp.c_str(), total.c_str(), ret); | 857 | + srs_error("rename total file failed. %s => %s, ret=%d", |
858 | + total_tmp.c_str(), total.c_str(), ret); | ||
859 | + } | ||
856 | } | 860 | } |
857 | } | 861 | } |
858 | 862 |
-
请 注册 或 登录 后发表评论