Fix: Remove redundant enabled checks in HLS/DASH cleanup to prevent resource leaks. v6.0.173 v7.0.54 (#4161)
## Problem HLS and DASH components had redundant `enabled` flag checks in their `cycle()` and `cleanup_delay()` methods that prevented proper cleanup of files when components were disabled. This created a race condition where: 1. Stream stops publishing and HLS/DASH components get disabled 2. `cycle()` returns early without performing disposal operations 3. `cleanup_delay()` returns 0 instead of configured disposal timeout 4. Source cleanup doesn't wait long enough for file disposal 5. HLS/DASH files remain on disk without proper cleanup ## Root Cause The `enabled` flag should control processing of **new incoming streams**, but should NOT prevent **cleanup of existing files** from previously enabled streams. ## Solution Remove redundant `enabled` checks from: - `SrsHls::cycle()` and `SrsDash::cycle()` - Allow disposal logic to run even when disabled - `SrsHls::cleanup_delay()` and `SrsDash::cleanup_delay()` - Always return proper disposal timeout --------- Co-authored-by: winlin <winlinvip@gmail.com>
This commit is contained in:
parent
7aba442a38
commit
9b871fd862
|
|
@ -7,6 +7,7 @@ The changelog for SRS.
|
|||
<a name="v7-changes"></a>
|
||||
|
||||
## SRS 7.0 Changelog
|
||||
* v7.0, 2025-08-14, Merge [#4161](https://github.com/ossrs/srs/pull/4161): fix hls & dash segments cleanup. v7.0.54 (#4161)
|
||||
* v7.0, 2025-08-13, Merge [#4225](https://github.com/ossrs/srs/pull/4225): issue #4223: remove hls_acodec and hls_vcodec config. v7.0.53 (#4225)
|
||||
* v7.0, 2025-08-12, Merge [#4230](https://github.com/ossrs/srs/pull/4230): MP4 DVR: Fix audio/video synchronization issues in WebRTC recordings. v7.0.52 (#4230)
|
||||
* v7.0, 2025-08-12, Merge [#4301](https://github.com/ossrs/srs/pull/4301): Valgrind: Return error for unsupported check=new on Valgrind < 3.21. v7.0.52 (#4301)
|
||||
|
|
@ -67,6 +68,7 @@ The changelog for SRS.
|
|||
<a name="v6-changes"></a>
|
||||
|
||||
## SRS 6.0 Changelog
|
||||
* v6.0, 2025-08-14, Merge [#4161](https://github.com/ossrs/srs/pull/4161): fix hls & dash segments cleanup. v6.0.173 (#4161)
|
||||
* v6.0, 2025-08-12, Merge [#4230](https://github.com/ossrs/srs/pull/4230): MP4 DVR: Fix audio/video synchronization issues in WebRTC recordings. v6.0.172 (#4230)
|
||||
* v6.0, 2025-08-11, Merge [#4432](https://github.com/ossrs/srs/pull/4432): AI: HTTP-FLV: Fix heap-use-after-free crash during stream unmount. v6.0.171 (#4432)
|
||||
* v6.0, 2025-07-28, Merge [#4245](https://github.com/ossrs/srs/pull/4245): Allow Forward to be configured with Env Var. v6.0.170 (#4245)
|
||||
|
|
|
|||
|
|
@ -703,10 +703,6 @@ srs_error_t SrsDash::cycle()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (!enabled) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (last_update_time_ <= 0) {
|
||||
last_update_time_ = srs_get_system_time();
|
||||
}
|
||||
|
|
@ -737,10 +733,6 @@ srs_error_t SrsDash::cycle()
|
|||
|
||||
srs_utime_t SrsDash::cleanup_delay()
|
||||
{
|
||||
if (!enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We use larger timeout to cleanup the HLS, after disposed it if required.
|
||||
return _srs_config->get_dash_dispose(req->vhost) * 1.1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2320,10 +2320,6 @@ srs_error_t SrsHls::cycle()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if (!enabled) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (last_update_time <= 0) {
|
||||
last_update_time = srs_get_system_time();
|
||||
}
|
||||
|
|
@ -2363,10 +2359,6 @@ srs_error_t SrsHls::cycle()
|
|||
|
||||
srs_utime_t SrsHls::cleanup_delay()
|
||||
{
|
||||
if (!enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We use larger timeout to cleanup the HLS, after disposed it if required.
|
||||
return _srs_config->get_hls_dispose(req->vhost) * 1.1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 6
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 172
|
||||
#define VERSION_REVISION 173
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
#define VERSION_MAJOR 7
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 53
|
||||
#define VERSION_REVISION 54
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user