fixed crash in delete_stream

This commit is contained in:
Roman Arutyunyan 2012-06-18 18:07:51 +04:00
parent cba4ecc560
commit 43ceafc186
2 changed files with 6 additions and 4 deletions

View file

@ -9,7 +9,5 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
$ngx_addon_dir/ngx_rtmp_hls_module.c \
"
CORE_LIBS="$CORE_LIBS /home/rarutyunyan/root/lib/libavcodec.so /home/rarutyunyan/root/lib/libavformat.so"
CFLAGS="$CFLAGS -I/home/rarutyunyan/root/include"
CORE_LIBS="$CORE_LIBS -lavformat"

View file

@ -785,7 +785,7 @@ ngx_rtmp_hls_delete_stream(ngx_rtmp_session_t *s, ngx_rtmp_delete_stream_t *v)
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
if (hacf == NULL || !hacf->hls || ctx == NULL
|| (ctx->flags & NGX_RTMP_HLS_PUBLISHING) == 0)
|| (ctx->flags & NGX_RTMP_HLS_PUBLISHING) == 0)
{
goto next;
}
@ -798,6 +798,10 @@ ngx_rtmp_hls_delete_stream(ngx_rtmp_session_t *s, ngx_rtmp_delete_stream_t *v)
ngx_del_timer(&ctx->restart_evt);
}
if (ctx->out_format == NULL) {
goto next;
}
if (av_write_trailer(ctx->out_format) < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"hls: av_write_trailer failed");