winlin

fix the hls_dispose bug, ignore for 0.

@@ -950,6 +950,8 @@ int SrsHlsCache::on_publish(SrsHlsMuxer* muxer, SrsRequest* req, int64_t segment @@ -950,6 +950,8 @@ int SrsHlsCache::on_publish(SrsHlsMuxer* muxer, SrsRequest* req, int64_t segment
950 double hls_aof_ratio = _srs_config->get_hls_aof_ratio(vhost); 950 double hls_aof_ratio = _srs_config->get_hls_aof_ratio(vhost);
951 // whether use floor(timestamp/hls_fragment) for variable timestamp 951 // whether use floor(timestamp/hls_fragment) for variable timestamp
952 bool ts_floor = _srs_config->get_hls_ts_floor(vhost); 952 bool ts_floor = _srs_config->get_hls_ts_floor(vhost);
  953 + // the seconds to dispose the hls.
  954 + int hls_dispose = _srs_config->get_hls_dispose(vhost);
953 955
954 // TODO: FIXME: support load exists m3u8, to continue publish stream. 956 // TODO: FIXME: support load exists m3u8, to continue publish stream.
955 // for the HLS donot requires the EXT-X-MEDIA-SEQUENCE be monotonically increase. 957 // for the HLS donot requires the EXT-X-MEDIA-SEQUENCE be monotonically increase.
@@ -967,9 +969,9 @@ int SrsHlsCache::on_publish(SrsHlsMuxer* muxer, SrsRequest* req, int64_t segment @@ -967,9 +969,9 @@ int SrsHlsCache::on_publish(SrsHlsMuxer* muxer, SrsRequest* req, int64_t segment
967 srs_error("m3u8 muxer open segment failed. ret=%d", ret); 969 srs_error("m3u8 muxer open segment failed. ret=%d", ret);
968 return ret; 970 return ret;
969 } 971 }
970 - srs_trace("hls: win=%.2f, frag=%.2f, prefix=%s, path=%s, m3u8=%s, ts=%s, aof=%.2f, floor=%d, clean=%d, waitk=%d", 972 + srs_trace("hls: win=%.2f, frag=%.2f, prefix=%s, path=%s, m3u8=%s, ts=%s, aof=%.2f, floor=%d, clean=%d, waitk=%d, dispose=%d",
971 hls_window, hls_fragment, entry_prefix.c_str(), path.c_str(), m3u8_file.c_str(), 973 hls_window, hls_fragment, entry_prefix.c_str(), path.c_str(), m3u8_file.c_str(),
972 - ts_file.c_str(), hls_aof_ratio, ts_floor, cleanup, wait_keyframe); 974 + ts_file.c_str(), hls_aof_ratio, ts_floor, cleanup, wait_keyframe, hls_dispose);
973 975
974 return ret; 976 return ret;
975 } 977 }
@@ -1188,6 +1190,9 @@ int SrsHls::cycle() @@ -1188,6 +1190,9 @@ int SrsHls::cycle()
1188 } 1190 }
1189 1191
1190 int hls_dispose = _srs_config->get_hls_dispose(_req->vhost) * 1000; 1192 int hls_dispose = _srs_config->get_hls_dispose(_req->vhost) * 1000;
  1193 + if (hls_dispose <= 0) {
  1194 + return ret;
  1195 + }
1191 if (srs_get_system_time_ms() - last_update_time <= hls_dispose) { 1196 if (srs_get_system_time_ms() - last_update_time <= hls_dispose) {
1192 return ret; 1197 return ret;
1193 } 1198 }