From e88c1e32eec6875ccda1a32460f9c5c81640add4 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 14 Feb 2015 16:30:04 +0800 Subject: [PATCH] always increasing target duration, for #304 --- trunk/src/app/srs_app_hls.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index 07ffb9b32..44195ba2f 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -204,7 +204,11 @@ int SrsHlsMuxer::update_config(SrsRequest* r, string path, int fragment, int win hls_path = path; hls_fragment = fragment; hls_window = window; - target_duration = (int)(fragment * _srs_config->get_hls_td_ratio(r->vhost)); + + // we always keep the target duration increasing. + int max_td = srs_max(target_duration, (int)(fragment * _srs_config->get_hls_td_ratio(r->vhost))); + srs_info("hls update target duration %d=>%d", target_duration, max_td); + target_duration = max_td; std::string storage = _srs_config->get_hls_storage(r->vhost); if (storage == "ram") {