正在显示
1 个修改的文件
包含
11 行增加
和
2 行删除
| @@ -53,6 +53,8 @@ using namespace std; | @@ -53,6 +53,8 @@ using namespace std; | ||
| 53 | 53 | ||
| 54 | // drop the segment when duration of ts too small. | 54 | // drop the segment when duration of ts too small. |
| 55 | #define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 | 55 | #define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 |
| 56 | +// when hls timestamp jump, reset it. | ||
| 57 | +#define SRS_AUTO_HLS_SEGMENT_TIMESTAMP_JUMP_MS 300 | ||
| 56 | 58 | ||
| 57 | // fragment plus the deviation percent. | 59 | // fragment plus the deviation percent. |
| 58 | #define SRS_HLS_FLOOR_REAP_PERCENT 0.3 | 60 | #define SRS_HLS_FLOOR_REAP_PERCENT 0.3 |
| @@ -161,6 +163,11 @@ void SrsHlsSegment::update_duration(int64_t current_frame_dts) | @@ -161,6 +163,11 @@ void SrsHlsSegment::update_duration(int64_t current_frame_dts) | ||
| 161 | // update the segment duration, which is nagetive, | 163 | // update the segment duration, which is nagetive, |
| 162 | // just ignore it. | 164 | // just ignore it. |
| 163 | if (current_frame_dts < segment_start_dts) { | 165 | if (current_frame_dts < segment_start_dts) { |
| 166 | + // for atc and timestamp jump, reset the start dts. | ||
| 167 | + if (current_frame_dts < segment_start_dts - SRS_AUTO_HLS_SEGMENT_TIMESTAMP_JUMP_MS * 90) { | ||
| 168 | + srs_warn("hls timestamp jump %"PRId64"=>%"PRId64, segment_start_dts, current_frame_dts); | ||
| 169 | + segment_start_dts = current_frame_dts; | ||
| 170 | + } | ||
| 164 | return; | 171 | return; |
| 165 | } | 172 | } |
| 166 | 173 | ||
| @@ -830,8 +837,10 @@ int SrsHlsMuxer::refresh_m3u8() | @@ -830,8 +837,10 @@ int SrsHlsMuxer::refresh_m3u8() | ||
| 830 | } | 837 | } |
| 831 | 838 | ||
| 832 | // remove the temp file. | 839 | // remove the temp file. |
| 833 | - if (unlink(temp_m3u8.c_str()) < 0) { | ||
| 834 | - srs_warn("ignore remove m3u8 failed, %s", temp_m3u8.c_str()); | 840 | + if (srs_path_exists(temp_m3u8)) { |
| 841 | + if (unlink(temp_m3u8.c_str()) < 0) { | ||
| 842 | + srs_warn("ignore remove m3u8 failed, %s", temp_m3u8.c_str()); | ||
| 843 | + } | ||
| 835 | } | 844 | } |
| 836 | 845 | ||
| 837 | return ret; | 846 | return ret; |
-
请 注册 或 登录 后发表评论