Merge branch '2.0release' of github.com:simple-rtmp-server/srs into 2.0release
正在显示
3 个修改的文件
包含
16 行增加
和
4 行删除
@@ -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; |
@@ -1124,6 +1124,7 @@ int SrsHlsCache::reap_segment(string log_desc, SrsHlsMuxer* muxer, int64_t segme | @@ -1124,6 +1124,7 @@ int SrsHlsCache::reap_segment(string log_desc, SrsHlsMuxer* muxer, int64_t segme | ||
1124 | 1124 | ||
1125 | SrsHls::SrsHls() | 1125 | SrsHls::SrsHls() |
1126 | { | 1126 | { |
1127 | + _req = NULL; | ||
1127 | source = NULL; | 1128 | source = NULL; |
1128 | handler = NULL; | 1129 | handler = NULL; |
1129 | 1130 | ||
@@ -1144,6 +1145,7 @@ SrsHls::SrsHls() | @@ -1144,6 +1145,7 @@ SrsHls::SrsHls() | ||
1144 | 1145 | ||
1145 | SrsHls::~SrsHls() | 1146 | SrsHls::~SrsHls() |
1146 | { | 1147 | { |
1148 | + srs_freep(_req); | ||
1147 | srs_freep(codec); | 1149 | srs_freep(codec); |
1148 | srs_freep(sample); | 1150 | srs_freep(sample); |
1149 | srs_freep(jitter); | 1151 | srs_freep(jitter); |
@@ -1160,6 +1162,14 @@ void SrsHls::dispose() | @@ -1160,6 +1162,14 @@ void SrsHls::dispose() | ||
1160 | on_unpublish(); | 1162 | on_unpublish(); |
1161 | } | 1163 | } |
1162 | 1164 | ||
1165 | + // only dispose hls when positive. | ||
1166 | + if (_req) { | ||
1167 | + int hls_dispose = _srs_config->get_hls_dispose(_req->vhost); | ||
1168 | + if (hls_dispose <= 0) { | ||
1169 | + return; | ||
1170 | + } | ||
1171 | + } | ||
1172 | + | ||
1163 | muxer->dispose(); | 1173 | muxer->dispose(); |
1164 | } | 1174 | } |
1165 | 1175 | ||
@@ -1212,7 +1222,8 @@ int SrsHls::on_publish(SrsRequest* req) | @@ -1212,7 +1222,8 @@ int SrsHls::on_publish(SrsRequest* req) | ||
1212 | { | 1222 | { |
1213 | int ret = ERROR_SUCCESS; | 1223 | int ret = ERROR_SUCCESS; |
1214 | 1224 | ||
1215 | - _req = req; | 1225 | + srs_freep(_req); |
1226 | + _req = req->copy(); | ||
1216 | 1227 | ||
1217 | // update the hls time, for hls_dispose. | 1228 | // update the hls time, for hls_dispose. |
1218 | last_update_time = srs_get_system_time_ms(); | 1229 | last_update_time = srs_get_system_time_ms(); |
-
请 注册 或 登录 后发表评论