From 20bbd5d29716932a0018bcad5822f8d7a7c2525d Mon Sep 17 00:00:00 2001 From: mxd Date: Sun, 8 Nov 2026 15:31:59 +0800 Subject: [PATCH] Sync upstream updates from github.com/winshining/nginx-http-flv-module --- ngx_http_flv_module/AUTHORS | 5 +- ngx_http_flv_module/LICENSE | 2 +- ngx_http_flv_module/README.CN.md | 5 +- ngx_http_flv_module/README.md | 3 +- ngx_http_flv_module/hls/ngx_rtmp_hls_module.c | 2 +- .../ngx_http_flv_live_module.c | 25 ++++- ngx_http_flv_module/ngx_rtmp.c | 18 +--- ngx_http_flv_module/ngx_rtmp_amf.c | 95 +++++++++++++++---- ngx_http_flv_module/ngx_rtmp_amf.h | 4 + .../ngx_rtmp_auto_push_module.c | 80 +++++++++++----- ngx_http_flv_module/ngx_rtmp_cmd_module.c | 2 +- ngx_http_flv_module/ngx_rtmp_play_module.c | 9 ++ ngx_http_flv_module/ngx_rtmp_record_module.c | 11 +++ ngx_http_flv_module/ngx_rtmp_relay_module.c | 10 +- ngx_http_flv_module/ngx_rtmp_stat_module.c | 10 +- ngx_http_flv_module/ngx_rtmp_version.h | 4 +- 16 files changed, 209 insertions(+), 76 deletions(-) diff --git a/ngx_http_flv_module/AUTHORS b/ngx_http_flv_module/AUTHORS index dda3fa0..6a438bf 100644 --- a/ngx_http_flv_module/AUTHORS +++ b/ngx_http_flv_module/AUTHORS @@ -12,10 +12,9 @@ Project author: winshining@163.com Gnolizuh - Beijing, China + Shanghai, China Contacts: - huzilong_007@163.com - huzilong@kingsoft.com + https://github.com/gnolizuh han4235 Suzhou, China diff --git a/ngx_http_flv_module/LICENSE b/ngx_http_flv_module/LICENSE index 795779f..9e72e4c 100644 --- a/ngx_http_flv_module/LICENSE +++ b/ngx_http_flv_module/LICENSE @@ -1,7 +1,7 @@ BSD 2-Clause License Copyright (c) 2012-2017, Roman Arutyunyan -Copyright (c) 2017-2025, Winshining +Copyright (c) 2017-2026, Winshining Copyright (c) 2018, han4235, Vladimir Vainer Copyright (c) 2018-2019, plainheart, HeyJupiter Copyright (c) 2019, ever4Keny diff --git a/ngx_http_flv_module/README.CN.md b/ngx_http_flv_module/README.CN.md index 5e292e5..4282e68 100644 --- a/ngx_http_flv_module/README.CN.md +++ b/ngx_http_flv_module/README.CN.md @@ -8,7 +8,7 @@ 如果您喜欢这个模块,可以通过赞赏来支持我的工作,非常感谢! -![reward_qrcode_winshining](https://gitee.com/winshining/nginx-http-flv-module/raw/master/qrcode/reward_qrcode_winshining.png) +![reward_qrcode_winshining](https://raw.githubusercontent.com/wiki/winshining/nginx-http-flv-module/reward_qrcode_winshining.png) ### 感谢 @@ -26,7 +26,7 @@ | 功能 | nginx-http-flv-module | nginx-rtmp-module | 备注 | | :----------------------: | :-------------------: | :---------------: | :--------------------------------------: | -| HTTP-FLV (播放) | √ | x | 支持 HTTPS-FLV 和 chunked 回复 | +| HTTP-FLV (HTTP/1.x 播放) | √ | x | 支持 HTTPS-FLV 和 chunked 回复 | | GOP 缓存 | √ | x | | | 虚拟主机 | √ | x | | | 省略 `listen` 配置项 | √ | 见备注 | 配置中必须有一个 `listen` | @@ -37,6 +37,7 @@ | JSON 风格的数据信息 | √ | x | | | 录制的数据信息 | √ | x | | | 大小端无关 | √ | 见备注 | `big-endian` 分支部分支持 | +| 播放连接超时 | √ | x | | ## 兼容性 diff --git a/ngx_http_flv_module/README.md b/ngx_http_flv_module/README.md index b2af3dc..3a61f27 100644 --- a/ngx_http_flv_module/README.md +++ b/ngx_http_flv_module/README.md @@ -26,7 +26,7 @@ Donate if you like this module. Many thanks to you! | Features | nginx-http-flv-module | nginx-rtmp-module | Remarks | | :--------------------------------: | :-------------------: | :---------------: | :--------------------------------------------: | -| HTTP-FLV (for play) | √ | x | HTTPS-FLV and chunked response supported | +| HTTP-FLV (HTTP/1.x for play) | √ | x | HTTPS-FLV and chunked response supported | | GOP cache | √ | x | | | Virtual Host | √ | x | | | Omit `listen` directive | √ | See remarks | There MUST be at least one `listen` directive | @@ -37,6 +37,7 @@ Donate if you like this module. Many thanks to you! | JSON style statistics | √ | x | | | Statistics for recordings | √ | x | | | Independent of endianness | √ | See remarks | Partially supported in branch `big-endian` | +| Timeout for play connections | √ | x | | ## Compatibility diff --git a/ngx_http_flv_module/hls/ngx_rtmp_hls_module.c b/ngx_http_flv_module/hls/ngx_rtmp_hls_module.c index 84cded2..e818e01 100644 --- a/ngx_http_flv_module/hls/ngx_rtmp_hls_module.c +++ b/ngx_http_flv_module/hls/ngx_rtmp_hls_module.c @@ -953,7 +953,7 @@ ngx_rtmp_hls_open_fragment(ngx_rtmp_session_t *s, uint64_t ts, ngx_log_debug7(NGX_LOG_DEBUG_RTMP, s->connection->log, 0, "hls: open fragment file='%s', keyfile='%s', " - "frag=%uL, n=%ui, time=%uL, discont=%i, cc=%u", + "frag=%uL, n=%ui, time=%uL, discont=%i, cc=%ui", ctx->stream.data, ctx->keyfile.data ? ctx->keyfile.data : (u_char *) "", ctx->frag, ctx->nfrags, ts, discont, counter); diff --git a/ngx_http_flv_module/ngx_http_flv_live_module.c b/ngx_http_flv_module/ngx_http_flv_live_module.c index d68e150..ff976e8 100644 --- a/ngx_http_flv_module/ngx_http_flv_live_module.c +++ b/ngx_http_flv_module/ngx_http_flv_live_module.c @@ -323,7 +323,7 @@ ngx_http_flv_live_init_handlers(ngx_cycle_t *cycle) return NGX_OK; } - /* rtmp live conf aready exsits, so add additional event handlers */ + /* rtmp live conf already exsits, so add additional event handlers */ h = ngx_array_push(&cmcf->events[NGX_HTTP_FLV_LIVE_REQUEST]); *h = ngx_http_flv_live_request; @@ -2064,6 +2064,8 @@ ngx_http_flv_live_connect_init(ngx_rtmp_session_t *s, ngx_str_t *app, ngx_connection_t *c; ngx_http_request_t *r; u_char name[NGX_RTMP_MAX_NAME]; + ngx_str_t addr; + u_char addr_buf[NGX_SOCKADDR_STRLEN]; r = s->data; c = s->connection; @@ -2074,8 +2076,20 @@ ngx_http_flv_live_connect_init(ngx_rtmp_session_t *s, ngx_str_t *app, ngx_memcpy(v.args, r->args.data, ngx_min(r->args.len, sizeof(v.args) - 1)); ngx_memcpy(v.flashver, "flv_live 1.1", ngx_strlen("flv_live 1.1")); - *ngx_snprintf(v.tc_url, NGX_RTMP_MAX_URL, "http://%V/%V", - &r->headers_in.host->value, app) = 0; + if (r->headers_in.host) { + *ngx_snprintf(v.tc_url, NGX_RTMP_MAX_URL - 1, "http://%V/%V", + &r->headers_in.host->value, app) = 0; + } else { + addr.len = sizeof(addr_buf); + addr.data = addr_buf; + + if (ngx_connection_local_sockaddr(c, &addr, 1) != NGX_OK) { + return NGX_ERROR; + } + + *ngx_snprintf(v.tc_url, NGX_RTMP_MAX_URL - 1, "http://%V/%V", + &addr, app) = 0; + } #define NGX_RTMP_SET_STRPAR(name) \ s->name.len = ngx_strlen(v.name); \ @@ -2482,11 +2496,14 @@ ngx_http_flv_live_handler(ngx_http_request_t *r) if (r->http_version == NGX_HTTP_VERSION_9 #if (NGX_HTTP_V2) || r->http_version == NGX_HTTP_VERSION_20 +#endif +#if (NGX_HTTP_V3) + || r->http_version == NGX_HTTP_VERSION_30 #endif ) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "flv live: HTTP version 0.9 or 2.0 not supported"); + "flv live: HTTP version 0.9, 2.0 or 3.0 not supported"); return NGX_HTTP_NOT_ALLOWED; } diff --git a/ngx_http_flv_module/ngx_rtmp.c b/ngx_http_flv_module/ngx_rtmp.c index 77260ed..51e6e46 100644 --- a/ngx_http_flv_module/ngx_rtmp.c +++ b/ngx_http_flv_module/ngx_rtmp.c @@ -12,6 +12,11 @@ #include "ngx_rtmp.h" +#if (nginx_version < 1002006) +#error The module can not be compiled with too older version than nginx-1.2.6. +#endif + + static char *ngx_rtmp_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static ngx_int_t ngx_rtmp_optimize_servers(ngx_conf_t *cf, ngx_rtmp_core_main_conf_t *cmcf, ngx_array_t *ports); @@ -823,19 +828,6 @@ ngx_rtmp_add_listening(ngx_conf_t *cf, ngx_rtmp_conf_addr_t *addr) ls->log.data = &ls->addr_text; ls->log.handler = ngx_accept_log_error; -#if (NGX_WIN32) - { - ngx_iocp_conf_t *iocpcf = NULL; - - if (ngx_get_conf(cf->cycle->conf_ctx, ngx_events_module)) { - iocpcf = ngx_event_get_conf(cf->cycle->conf_ctx, ngx_iocp_module); - } - if (iocpcf && iocpcf->acceptex_read) { - ls->post_accept_buffer_size = 1024; - } - } -#endif - ls->backlog = addr->opt.backlog; ls->rcvbuf = addr->opt.rcvbuf; ls->sndbuf = addr->opt.sndbuf; diff --git a/ngx_http_flv_module/ngx_rtmp_amf.c b/ngx_http_flv_module/ngx_rtmp_amf.c index a1852b9..7bbfb3b 100644 --- a/ngx_http_flv_module/ngx_rtmp_amf.c +++ b/ngx_http_flv_module/ngx_rtmp_amf.c @@ -28,7 +28,10 @@ ngx_rtmp_amf_reverse_copy(void *dst, void* src, size_t len) return dst; } -#define NGX_RTMP_AMF_DEBUG_SIZE 16 +#define NGX_RTMP_AMF_DEBUG_SIZE 16 +#define NGX_RTMP_AMF_OBJECT_MAX_DEPTH 32 +#define NGX_RTMP_AMF_ARRAY_MAX_DEPTH 32 +#define NGX_RTMP_AMF_VARIANT_MAX_DEPTH 32 #ifdef NGX_DEBUG static void @@ -406,28 +409,58 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts, /* fall through */ case NGX_RTMP_AMF_OBJECT: - if (ngx_rtmp_amf_read_object(ctx, data, - data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0 - ) != NGX_OK) - { + if (ctx->object_depth >= NGX_RTMP_AMF_OBJECT_MAX_DEPTH) { + ngx_log_error(NGX_LOG_WARN, ctx->log, 0, + "amf: tried to read object nested too deeply"); + return NGX_ERROR; + } + + ctx->object_depth++; + + rc = ngx_rtmp_amf_read_object(ctx, data, + data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0); + + ctx->object_depth--; + + if (rc != NGX_OK) { return NGX_ERROR; } break; case NGX_RTMP_AMF_ARRAY: - if (ngx_rtmp_amf_read_array(ctx, data, - data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0 - ) != NGX_OK) - { + if (ctx->array_depth >= NGX_RTMP_AMF_ARRAY_MAX_DEPTH) { + ngx_log_error(NGX_LOG_WARN, ctx->log, 0, + "amf: tried to read array nested too deeply"); + return NGX_ERROR; + } + + ctx->array_depth++; + + rc = ngx_rtmp_amf_read_array(ctx, data, + data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0); + + ctx->array_depth--; + + if (rc != NGX_OK) { return NGX_ERROR; } break; case NGX_RTMP_AMF_VARIANT_: - if (ngx_rtmp_amf_read_variant(ctx, data, - data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0 - ) != NGX_OK) - { + if (ctx->variant_depth >= NGX_RTMP_AMF_VARIANT_MAX_DEPTH) { + ngx_log_error(NGX_LOG_WARN, ctx->log, 0, + "amf: tried to read variant nested too deeply"); + return NGX_ERROR; + } + + ctx->variant_depth++; + + rc = ngx_rtmp_amf_read_variant(ctx, data, + data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0); + + ctx->variant_depth--; + + if (rc != NGX_OK) { return NGX_ERROR; } break; @@ -535,6 +568,7 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts, size_t nelts) { size_t n; + ngx_int_t rc; ngx_int_t type; uint8_t type8; void *data; @@ -603,18 +637,41 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx, case NGX_RTMP_AMF_OBJECT: type8 = NGX_RTMP_AMF_END; - if (ngx_rtmp_amf_write_object(ctx, data, - elts[n].len / sizeof(ngx_rtmp_amf_elt_t)) != NGX_OK - || ngx_rtmp_amf_put(ctx, &type8, 1) != NGX_OK) + + if (ctx->object_depth >= NGX_RTMP_AMF_OBJECT_MAX_DEPTH) { + ngx_log_error(NGX_LOG_WARN, ctx->log, 0, + "amf: tried to write object nested too deeply"); + return NGX_ERROR; + } + + ctx->object_depth++; + + rc = ngx_rtmp_amf_write_object(ctx, data, + elts[n].len / sizeof(ngx_rtmp_amf_elt_t)); + + ctx->object_depth--; + + if (rc != NGX_OK || ngx_rtmp_amf_put(ctx, &type8, 1) != NGX_OK) { return NGX_ERROR; } break; case NGX_RTMP_AMF_ARRAY: - if (ngx_rtmp_amf_write_array(ctx, data, - elts[n].len / sizeof(ngx_rtmp_amf_elt_t)) != NGX_OK) - { + if (ctx->array_depth >= NGX_RTMP_AMF_ARRAY_MAX_DEPTH) { + ngx_log_error(NGX_LOG_WARN, ctx->log, 0, + "amf: tried to write array nested too deeply"); + return NGX_ERROR; + } + + ctx->array_depth++; + + rc = ngx_rtmp_amf_write_array(ctx, data, + elts[n].len / sizeof(ngx_rtmp_amf_elt_t)); + + ctx->array_depth--; + + if (rc != NGX_OK) { return NGX_ERROR; } break; diff --git a/ngx_http_flv_module/ngx_rtmp_amf.h b/ngx_http_flv_module/ngx_rtmp_amf.h index 8f70a12..069c5fa 100644 --- a/ngx_http_flv_module/ngx_rtmp_amf.h +++ b/ngx_http_flv_module/ngx_rtmp_amf.h @@ -50,6 +50,10 @@ typedef ngx_chain_t * (*ngx_rtmp_amf_alloc_pt)(void *arg); typedef struct { + ngx_uint_t object_depth; + ngx_uint_t array_depth; + ngx_uint_t variant_depth; + ngx_chain_t *link, *first; size_t offset; ngx_rtmp_amf_alloc_pt alloc; diff --git a/ngx_http_flv_module/ngx_rtmp_auto_push_module.c b/ngx_http_flv_module/ngx_rtmp_auto_push_module.c index 071bf9c..db05222 100644 --- a/ngx_http_flv_module/ngx_rtmp_auto_push_module.c +++ b/ngx_http_flv_module/ngx_rtmp_auto_push_module.c @@ -17,8 +17,8 @@ static ngx_rtmp_delete_stream_pt next_delete_stream; static ngx_int_t ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle); static void ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle); -static void * ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cf); -static char * ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf); +static void *ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cf); +static char *ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf); #if (NGX_HAVE_UNIX_DOMAIN) static ngx_int_t ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v); @@ -366,40 +366,51 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle) ls = cycle->listening.elts; for (n = 0; n < cycle->listening.nelts; ++n, ++ls) { - if ((ls->handler == ngx_rtmp_init_connection) && - (ls->sockaddr && ls->sockaddr->sa_family == AF_UNIX)) + if (ls->handler != ngx_rtmp_init_connection || + ls->sockaddr == NULL || ls->sockaddr->sa_family != AF_UNIX) { - c = ls->connection; + continue; + } - if (c) { - if (c->read->active) { - if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) { + c = ls->connection; - /* - * delete the old accept events that were bound to - * the old cycle read events array - */ + if (c) { + if (c->read->active) { + if (ngx_event_flags & NGX_USE_EPOLL_EVENT) { - ngx_del_event(c->read, - NGX_READ_EVENT, NGX_CLOSE_EVENT); + /* + * it seems that Linux-2.6.x OpenVZ sends events + * for closed shared listening sockets unless + * the events was explicitly deleted + */ - ngx_free_connection(c); + ngx_del_event(c->read, NGX_READ_EVENT, 0); - c->fd = (ngx_socket_t) -1; - } + } else { + ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); } } - if (ngx_close_socket(ls->fd) == -1) { - ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_socket_errno, - ngx_close_socket_n "%V failed", - &ls->addr_text); + if (c->read->timer_set) { + ngx_del_timer(c->read); } - ls->fd = (ngx_socket_t) -1; + ngx_free_connection(c); - break; + c->fd = (ngx_socket_t) -1; } + + ngx_log_debug2(NGX_LOG_DEBUG_RTMP, cycle->log, 0, + "close listening %V #%d ", &ls->addr_text, ls->fd); + + if (ngx_close_socket(ls->fd) == -1) { + ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_socket_errno, + ngx_close_socket_n "%V failed", &ls->addr_text); + } + + ls->fd = (ngx_socket_t) -1; + + break; } pid = ngx_getpid(); @@ -434,6 +445,11 @@ ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cycle) static char * ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf) { +#if (NGX_HAVE_UNIX_DOMAIN) + struct sockaddr_un saun; + size_t len; + u_char *p; +#endif ngx_rtmp_auto_push_conf_t *apcf = conf; ngx_conf_init_value(apcf->auto_push, 0); @@ -442,6 +458,24 @@ ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf) if (apcf->socket_dir.len == 0) { ngx_str_set(&apcf->socket_dir, "/tmp"); } +#if (NGX_HAVE_UNIX_DOMAIN) + else { + p = apcf->socket_dir.data + apcf->socket_dir.len - 1; + + while ((p > apcf->socket_dir.data) && (*p == '/' || *p == '\\')) { + *p-- = '\0'; + } + + apcf->socket_dir.len = p + 1 - apcf->socket_dir.data; + len = apcf->socket_dir.len + sizeof(NGX_RTMP_AUTO_PUSH_SOCKNAME); + + if (len + 1 + NGX_INT_T_LEN >= sizeof(saun.sun_path)) { + ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, + "auto_push: too long \"rtmp_socket_dir\" directive"); + return NGX_CONF_ERROR; + } + } +#endif return NGX_CONF_OK; } diff --git a/ngx_http_flv_module/ngx_rtmp_cmd_module.c b/ngx_http_flv_module/ngx_rtmp_cmd_module.c index ede6496..b3ea1a3 100644 --- a/ngx_http_flv_module/ngx_rtmp_cmd_module.c +++ b/ngx_http_flv_module/ngx_rtmp_cmd_module.c @@ -182,7 +182,7 @@ ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, ngx_log_error(NGX_LOG_WARN, s->connection->log, 0, "connect: rtmps tcUrl received: %s", v.tc_url); - ngx_memmove(v.tc_url + 4, v.tc_url + 5, ngx_strlen(v.tc_url) - 5); + ngx_memmove(v.tc_url + 4, v.tc_url + 5, ngx_strlen(v.tc_url) - 4); } } diff --git a/ngx_http_flv_module/ngx_rtmp_play_module.c b/ngx_http_flv_module/ngx_rtmp_play_module.c index 1f17690..ea0c895 100644 --- a/ngx_http_flv_module/ngx_rtmp_play_module.c +++ b/ngx_http_flv_module/ngx_rtmp_play_module.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "ngx_rtmp_play_module.h" #include "ngx_rtmp_cmd_module.h" #include "ngx_rtmp_netcall_module.h" @@ -697,6 +698,14 @@ ngx_rtmp_play_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v) ngx_str_t *pfx, *sfx; ngx_str_t name; ngx_uint_t n; + ngx_http_request_t *r; + + r = s->data; + if (r) { + ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, + "play: skipping live request"); + goto next; + } pmcf = ngx_rtmp_get_module_main_conf(s, ngx_rtmp_play_module); diff --git a/ngx_http_flv_module/ngx_rtmp_record_module.c b/ngx_http_flv_module/ngx_rtmp_record_module.c index fec3b96..41f6d92 100644 --- a/ngx_http_flv_module/ngx_rtmp_record_module.c +++ b/ngx_http_flv_module/ngx_rtmp_record_module.c @@ -1187,6 +1187,11 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx, return NGX_OK; } + if (ngx_rtmp_is_codec_header(in)) { + ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, + "record: video header has been written already"); + return NGX_OK; + } } else { if (codec_ctx && codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC && !rctx->aac_header_sent) @@ -1195,6 +1200,12 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx, "record: %V skipping until AAC header", &rracf->id); return NGX_OK; } + + if (ngx_rtmp_is_codec_header(in)) { + ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, + "record: audio header has been written already"); + return NGX_OK; + } } return ngx_rtmp_record_write_frame(s, rctx, h, in, 1); diff --git a/ngx_http_flv_module/ngx_rtmp_relay_module.c b/ngx_http_flv_module/ngx_rtmp_relay_module.c index 2aca461..bb0ca9e 100644 --- a/ngx_http_flv_module/ngx_rtmp_relay_module.c +++ b/ngx_http_flv_module/ngx_rtmp_relay_module.c @@ -282,6 +282,10 @@ ngx_rtmp_relay_push_reconnect(ngx_event_t *ev) return; } + if (ctx->tag != &ngx_rtmp_relay_module) { + return; + } + t = racf->pushes.elts; for (n = 0; n < racf->pushes.nelts; ++n, ++t) { target = *t; @@ -614,12 +618,10 @@ ngx_rtmp_relay_create_remote_ctx(ngx_rtmp_session_t *s, ngx_str_t *name, &url, s->connection->log) == NGX_OK) { target->url.default_port = 1935; + target->url.no_resolve = 1; target->url.uri_part = 1; target->url.url = url; - target->url.addrs = NULL; - target->url.naddrs = 0; - if(ngx_parse_url(s->connection->pool, &target->url) != NGX_OK) { ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, "relay: invalid url='%V'", &target->url.url); @@ -1793,7 +1795,7 @@ ngx_rtmp_relay_push_pull(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) continue; } - return "unsuppored parameter"; + return "unsupported parameter"; } if (is_static) { diff --git a/ngx_http_flv_module/ngx_rtmp_stat_module.c b/ngx_http_flv_module/ngx_rtmp_stat_module.c index 6b0340b..df55f9b 100644 --- a/ngx_http_flv_module/ngx_rtmp_stat_module.c +++ b/ngx_http_flv_module/ngx_rtmp_stat_module.c @@ -1393,8 +1393,14 @@ ngx_rtmp_stat_application_recorders(ngx_http_request_t *r, ngx_chain_t ***lll, "%ui", (ngx_uint_t)lracf->max_frames) - buf); NGX_RTMP_STAT_L(",\"interval\":"); - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%ui", lracf->interval) - buf); + + if (lracf->interval == NGX_CONF_UNSET_MSEC) { + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), + "%d", -1) - buf); + } else { + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), + "%ui", lracf->interval) - buf); + } NGX_RTMP_STAT_L(",\"suffix\":\""); NGX_RTMP_STAT_S(&lracf->suffix); diff --git a/ngx_http_flv_module/ngx_rtmp_version.h b/ngx_http_flv_module/ngx_rtmp_version.h index 7dc5c5d..d5a58b0 100644 --- a/ngx_http_flv_module/ngx_rtmp_version.h +++ b/ngx_http_flv_module/ngx_rtmp_version.h @@ -9,8 +9,8 @@ #define _NGX_RTMP_VERSION_H_INCLUDED_ -#define nginx_rtmp_version 1002012 -#define NGINX_RTMP_VERSION "1.2.12" +#define nginx_rtmp_version 1002015 +#define NGINX_RTMP_VERSION "1.2.15" #endif /* _NGX_RTMP_VERSION_H_INCLUDED_ */