mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
mpegts trailer/header are now sent on every fragment switch to escape audio/video init crashes
This commit is contained in:
@ -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,
|
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"hls: video stream: %i", ctx->out_vstream);
|
"hls: video stream: %i", ctx->out_vstream);
|
||||||
|
|
||||||
if (ctx->header_sent) {
|
/*if (ctx->header_sent) {
|
||||||
if (av_write_trailer(ctx->out_format) < 0) {
|
if (av_write_trailer(ctx->out_format) < 0) {
|
||||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
||||||
"hls: av_write_trailer failed");
|
"hls: av_write_trailer failed");
|
||||||
}
|
}
|
||||||
ctx->header_sent = 0;
|
ctx->header_sent = 0;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return NGX_OK;
|
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,
|
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"hls: audio stream: %i %iHz",
|
"hls: audio stream: %i %iHz",
|
||||||
ctx->out_astream, codec_ctx->sample_rate);
|
ctx->out_astream, codec_ctx->sample_rate);
|
||||||
|
/*
|
||||||
if (ctx->header_sent) {
|
if (ctx->header_sent) {
|
||||||
if (av_write_trailer(ctx->out_format) < 0) {
|
if (av_write_trailer(ctx->out_format) < 0) {
|
||||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, 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;
|
ctx->header_sent = 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return NGX_OK;
|
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);
|
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
|
||||||
|
|
||||||
/*
|
|
||||||
if (av_write_trailer(ctx->out_format) < 0) {
|
if (av_write_trailer(ctx->out_format) < 0) {
|
||||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
||||||
"hls: av_write_trailer failed");
|
"hls: av_write_trailer failed");
|
||||||
}*/
|
}
|
||||||
|
ctx->header_sent = 0;
|
||||||
|
|
||||||
avio_flush(ctx->out_format->pb);
|
avio_flush(ctx->out_format->pb);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user