mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-11 23:01:09 +02:00
Write ENDLIST tag on stream end
This commit is contained in:
parent
8e344d7994
commit
e73d44f0fb
|
@ -529,7 +529,7 @@ ngx_rtmp_hls_write_variant_playlist(ngx_rtmp_session_t *s)
|
||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
|
ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s, int final)
|
||||||
{
|
{
|
||||||
static u_char buffer[1024];
|
static u_char buffer[1024];
|
||||||
ngx_fd_t fd;
|
ngx_fd_t fd;
|
||||||
|
@ -687,6 +687,15 @@ ngx_rtmp_hls_write_playlist(ngx_rtmp_session_t *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (final)
|
||||||
|
{
|
||||||
|
p = ngx_slprintf(p, end, "#EXT-X-ENDLIST\n");
|
||||||
|
n = ngx_write_fd(fd, buffer, p - buffer);
|
||||||
|
if (n < 0) {
|
||||||
|
goto write_err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngx_close_file(fd);
|
ngx_close_file(fd);
|
||||||
|
|
||||||
if (ngx_rtmp_hls_rename_file(ctx->playlist_bak.data, ctx->playlist.data)
|
if (ngx_rtmp_hls_rename_file(ctx->playlist_bak.data, ctx->playlist.data)
|
||||||
|
@ -967,7 +976,7 @@ ngx_rtmp_hls_get_fragment_datetime(ngx_rtmp_session_t *s, uint64_t ts)
|
||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_rtmp_hls_close_fragment(ngx_rtmp_session_t *s)
|
ngx_rtmp_hls_close_final_fragment(ngx_rtmp_session_t *s, int final)
|
||||||
{
|
{
|
||||||
ngx_rtmp_hls_ctx_t *ctx;
|
ngx_rtmp_hls_ctx_t *ctx;
|
||||||
|
|
||||||
|
@ -985,12 +994,19 @@ ngx_rtmp_hls_close_fragment(ngx_rtmp_session_t *s)
|
||||||
|
|
||||||
ngx_rtmp_hls_next_frag(s);
|
ngx_rtmp_hls_next_frag(s);
|
||||||
|
|
||||||
ngx_rtmp_hls_write_playlist(s);
|
ngx_rtmp_hls_write_playlist(s, final);
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static ngx_int_t
|
||||||
|
ngx_rtmp_hls_close_fragment(ngx_rtmp_session_t *s)
|
||||||
|
{
|
||||||
|
return ngx_rtmp_hls_close_final_fragment(s, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static ngx_int_t
|
static ngx_int_t
|
||||||
ngx_rtmp_hls_open_fragment(ngx_rtmp_session_t *s, uint64_t ts,
|
ngx_rtmp_hls_open_fragment(ngx_rtmp_session_t *s, uint64_t ts,
|
||||||
ngx_int_t discont)
|
ngx_int_t discont)
|
||||||
|
@ -1651,7 +1667,7 @@ ngx_rtmp_hls_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"hls: close stream");
|
"hls: close stream");
|
||||||
|
|
||||||
ngx_rtmp_hls_close_fragment(s);
|
ngx_rtmp_hls_close_final_fragment(s, 1);
|
||||||
|
|
||||||
next:
|
next:
|
||||||
return next_close_stream(s, v);
|
return next_close_stream(s, v);
|
||||||
|
|
Loading…
Reference in a new issue