正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
@@ -60,9 +60,9 @@ using namespace std; | @@ -60,9 +60,9 @@ using namespace std; | ||
60 | #define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 | 60 | #define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100 |
61 | 61 | ||
62 | // fragment plus the deviation percent. | 62 | // fragment plus the deviation percent. |
63 | -#define SRS_HLS_FLOOR_REAP_PERCENT 0.2 | 63 | +#define SRS_HLS_FLOOR_REAP_PERCENT 0.3 |
64 | // reset the piece id when deviation overflow this. | 64 | // reset the piece id when deviation overflow this. |
65 | -#define SRS_JUMP_WHEN_PIECE_DEVIATION 10 | 65 | +#define SRS_JUMP_WHEN_PIECE_DEVIATION 20 |
66 | 66 | ||
67 | ISrsHlsHandler::ISrsHlsHandler() | 67 | ISrsHlsHandler::ISrsHlsHandler() |
68 | { | 68 | { |
@@ -441,7 +441,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts) | @@ -441,7 +441,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts) | ||
441 | ts_file = srs_path_build_stream(ts_file, req->vhost, req->app, req->stream); | 441 | ts_file = srs_path_build_stream(ts_file, req->vhost, req->app, req->stream); |
442 | if (hls_ts_floor) { | 442 | if (hls_ts_floor) { |
443 | // accept the floor ts for the first piece. | 443 | // accept the floor ts for the first piece. |
444 | - int64_t current_floor_ts = (int64_t)(srs_get_system_time_ms() / (1000 * hls_fragment)); | 444 | + int64_t current_floor_ts = (int64_t)(srs_update_system_time_ms() / (1000 * hls_fragment)); |
445 | if (!accept_floor_ts) { | 445 | if (!accept_floor_ts) { |
446 | accept_floor_ts = current_floor_ts - 1; | 446 | accept_floor_ts = current_floor_ts - 1; |
447 | } else { | 447 | } else { |
@@ -459,7 +459,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts) | @@ -459,7 +459,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts) | ||
459 | 459 | ||
460 | // dup/jmp detect for ts in floor mode. | 460 | // dup/jmp detect for ts in floor mode. |
461 | if (previous_floor_ts && previous_floor_ts != current_floor_ts - 1) { | 461 | if (previous_floor_ts && previous_floor_ts != current_floor_ts - 1) { |
462 | - srs_warn("hls: dup or jmp for floor ts, previous=%"PRId64", current=%"PRId64", accept=%"PRId64", deviation=%d", | 462 | + srs_warn("hls: dup/jmp ts, previous=%"PRId64", current=%"PRId64", accept=%"PRId64", deviation=%d", |
463 | previous_floor_ts, current_floor_ts, accept_floor_ts, deviation_ts); | 463 | previous_floor_ts, current_floor_ts, accept_floor_ts, deviation_ts); |
464 | } | 464 | } |
465 | previous_floor_ts = current_floor_ts; | 465 | previous_floor_ts = current_floor_ts; |
@@ -540,6 +540,8 @@ bool SrsHlsMuxer::is_segment_overflow() | @@ -540,6 +540,8 @@ bool SrsHlsMuxer::is_segment_overflow() | ||
540 | 540 | ||
541 | // use N% deviation, to smoother. | 541 | // use N% deviation, to smoother. |
542 | double deviation = hls_ts_floor? SRS_HLS_FLOOR_REAP_PERCENT * deviation_ts * hls_fragment : 0.0; | 542 | double deviation = hls_ts_floor? SRS_HLS_FLOOR_REAP_PERCENT * deviation_ts * hls_fragment : 0.0; |
543 | + srs_info("hls: dur=%.2f, tar=%.2f, dev=%.2fms/%dp, frag=%.2f", | ||
544 | + current->duration, hls_fragment + deviation, deviation, deviation_ts, hls_fragment); | ||
543 | 545 | ||
544 | return current->duration >= hls_fragment + deviation; | 546 | return current->duration >= hls_fragment + deviation; |
545 | } | 547 | } |
-
请 注册 或 登录 后发表评论