ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HLS: TS slices that have been generated should not be cleared when the server exits or restarts.

wuxianlijiang opened this issue · comments

Version: 2.0.239 Release
Environment: CentOS 6
Configuration:

vhost dvr.host.com{
    hls {
        enabled         on;
        hls_path        /home/video/rec/live;
		hls_ts_file   [stream]/[stream]-[seq].ts;
		hls_m3u8_file  [stream].m3u8;
		hls_fragment    10;
		hls_window      86400;
		#hls_window      60;
		hls_wait_keyframe       on;
		hls_dispose     0;
		hls_cleanup     off;
    }
}

Situation: After restarting the SRS service, the previously recorded m3u8 and ts files are cleared, leaving only an empty ts directory.
Expectation: Whether stopping the stream or restarting SRS, the recorded data should not be cleared. Thank you!

TRANS_BY_GPT3

Reproduction of the situation:

  1. Use Adobe Flash Media Live Encoder (or other encoders) to stream.
    url: rtmp://domain.com/live stream:live0501AM
    Later, you can find live0501AM.m3u8 and the live0501AM folder with ts files inside at /home/video/rec/live.

  2. Attempting to stop and disconnect the live streaming will not delete the files generated above.

  3. Enter service srs restart in the shell,
    you can see that the m3u8 files generated in the above directory have been cleared, and the ts files under live0501AM have also been cleared.

  4. If you terminate the service with killall srs, the situation will be the same as in step 3.

TRANS_BY_GPT3

Already reproduced:

[2017-05-01 16:28:12.156][trace][22819][104] user terminate program, gracefully quit.
[2017-05-01 16:28:13.029][trace][22819][100] cleanup for gracefully terminate.
[2017-05-01 16:28:13.029][warn][22819][100][35] main cycle terminated, system quit normally.
[2017-05-01 16:28:13.031][trace][22819][100] gracefully dispose hls /live/livestream
[2017-05-01 16:28:13.031][trace][22819][100] srs terminated

It should be that Dispose was not disabled, resulting in cleanup.

TRANS_BY_GPT3

When killall srs or /etc/init.d/srs stop or /etc/init.d/srs restart is executed, it will attempt to clean the Server. At this time, it will unpublish the stream, clean temporary files, and then clean HLS (which means deleting all TS files).

In reality, only when hls_dispose is not 0, which means cleaning is enabled, can all TS files be cleaned.

TRANS_BY_GPT3

commented

hls_dispose' is set to 0, but after restarting, the ts files are still cleared.

TRANS_BY_GPT3

commented

Set 'hls_cleanup' to 'off'; even after restarting, the 'ts' files are still being cleaned up.

TRANS_BY_GPT3