From 3d54d69e252bb537dc8fb03cc96ada084bd5da8d Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Wed, 19 Dec 2012 14:42:52 +0400 Subject: [PATCH] mpegts trailer/header are now sent on every fragment switch to escape audio/video init crashes --- hls/ngx_rtmp_hls_module.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hls/ngx_rtmp_hls_module.c b/hls/ngx_rtmp_hls_module.c index 62c1c5b..9554320 100644 --- a/hls/ngx_rtmp_hls_module.c +++ b/hls/ngx_rtmp_hls_module.c @@ -300,13 +300,13 @@ ngx_rtmp_hls_init_video(ngx_rtmp_session_t *s) ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, "hls: video stream: %i", ctx->out_vstream); - if (ctx->header_sent) { + /*if (ctx->header_sent) { if (av_write_trailer(ctx->out_format) < 0) { ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, "hls: av_write_trailer failed"); } ctx->header_sent = 0; - } + }*/ return NGX_OK; } @@ -359,7 +359,7 @@ ngx_rtmp_hls_init_audio(ngx_rtmp_session_t *s) ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, "hls: audio stream: %i %iHz", ctx->out_astream, codec_ctx->sample_rate); - +/* if (ctx->header_sent) { if (av_write_trailer(ctx->out_format) < 0) { ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, @@ -367,7 +367,7 @@ ngx_rtmp_hls_init_audio(ngx_rtmp_session_t *s) } ctx->header_sent = 0; } - +*/ return NGX_OK; } @@ -717,11 +717,11 @@ ngx_rtmp_hls_close_file(ngx_rtmp_session_t *s) ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module); - /* if (av_write_trailer(ctx->out_format) < 0) { ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, "hls: av_write_trailer failed"); - }*/ + } + ctx->header_sent = 0; avio_flush(ctx->out_format->pb);