Merge branch '2.0release' of github.com:simple-rtmp-server/srs into 2.0release

pull/444/head
winlin 10 years ago
commit 4400b12515

@ -624,8 +624,9 @@ vhost with-hls.srs.com {
# the timeout in seconds to dispose the hls, # the timeout in seconds to dispose the hls,
# dispose is to remove all hls files, m3u8 and ts files. # dispose is to remove all hls files, m3u8 and ts files.
# when timeout or server terminate, dispose hls. # when timeout or server terminate, dispose hls.
# default: 300 # @remark 0 to disable dispose.
hls_dispose 300; # default: 0
hls_dispose 0;
# the max size to notify hls, # the max size to notify hls,
# to read max bytes from ts of specified cdn network, # to read max bytes from ts of specified cdn network,
# @remark only used when on_hls_notify is config. # @remark only used when on_hls_notify is config.

@ -3566,7 +3566,7 @@ int SrsConfig::get_hls_dispose(string vhost)
{ {
SrsConfDirective* conf = get_hls(vhost); SrsConfDirective* conf = get_hls(vhost);
int DEFAULT = 300; int DEFAULT = 0;
if (!conf) { if (!conf) {
return DEFAULT; return DEFAULT;

@ -1124,6 +1124,7 @@ int SrsHlsCache::reap_segment(string log_desc, SrsHlsMuxer* muxer, int64_t segme
SrsHls::SrsHls() SrsHls::SrsHls()
{ {
_req = NULL;
source = NULL; source = NULL;
handler = NULL; handler = NULL;
@ -1144,6 +1145,7 @@ SrsHls::SrsHls()
SrsHls::~SrsHls() SrsHls::~SrsHls()
{ {
srs_freep(_req);
srs_freep(codec); srs_freep(codec);
srs_freep(sample); srs_freep(sample);
srs_freep(jitter); srs_freep(jitter);
@ -1160,6 +1162,14 @@ void SrsHls::dispose()
on_unpublish(); on_unpublish();
} }
// only dispose hls when positive.
if (_req) {
int hls_dispose = _srs_config->get_hls_dispose(_req->vhost);
if (hls_dispose <= 0) {
return;
}
}
muxer->dispose(); muxer->dispose();
} }
@ -1212,7 +1222,8 @@ int SrsHls::on_publish(SrsRequest* req)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
_req = req; srs_freep(_req);
_req = req->copy();
// update the hls time, for hls_dispose. // update the hls time, for hls_dispose.
last_update_time = srs_get_system_time_ms(); last_update_time = srs_get_system_time_ms();

Loading…
Cancel
Save