winlin

disable the hls_dispose by default to 0, for p2p system should never cleanup for timeshift hls.

@@ -624,8 +624,9 @@ vhost with-hls.srs.com { @@ -624,8 +624,9 @@ vhost with-hls.srs.com {
624 # the timeout in seconds to dispose the hls, 624 # the timeout in seconds to dispose the hls,
625 # dispose is to remove all hls files, m3u8 and ts files. 625 # dispose is to remove all hls files, m3u8 and ts files.
626 # when timeout or server terminate, dispose hls. 626 # when timeout or server terminate, dispose hls.
627 - # default: 300  
628 - hls_dispose 300; 627 + # @remark 0 to disable dispose.
  628 + # default: 0
  629 + hls_dispose 0;
629 # the max size to notify hls, 630 # the max size to notify hls,
630 # to read max bytes from ts of specified cdn network, 631 # to read max bytes from ts of specified cdn network,
631 # @remark only used when on_hls_notify is config. 632 # @remark only used when on_hls_notify is config.
@@ -3566,7 +3566,7 @@ int SrsConfig::get_hls_dispose(string vhost) @@ -3566,7 +3566,7 @@ int SrsConfig::get_hls_dispose(string vhost)
3566 { 3566 {
3567 SrsConfDirective* conf = get_hls(vhost); 3567 SrsConfDirective* conf = get_hls(vhost);
3568 3568
3569 - int DEFAULT = 300; 3569 + int DEFAULT = 0;
3570 3570
3571 if (!conf) { 3571 if (!conf) {
3572 return DEFAULT; 3572 return DEFAULT;
@@ -1155,6 +1155,14 @@ void SrsHls::dispose() @@ -1155,6 +1155,14 @@ void SrsHls::dispose()
1155 on_unpublish(); 1155 on_unpublish();
1156 } 1156 }
1157 1157
  1158 + // only dispose hls when positive.
  1159 + if (_req) {
  1160 + int hls_dispose = _srs_config->get_hls_dispose(_req->vhost);
  1161 + if (hls_dispose <= 0) {
  1162 + return;
  1163 + }
  1164 + }
  1165 +
1158 muxer->dispose(); 1166 muxer->dispose();
1159 } 1167 }
1160 1168