Sync upstream updates from github.com/winshining/nginx-http-flv-module

This commit is contained in:
mxdyeah committed 2026-11-08 15:31:59 +08:00
1 parent 1be683b499
commit 20bbd5d297
16 files changed
+194 -61

No files matched your search

+2 -3
View File
@@ -12,10 +12,9 @@ Project author:
[email protected] [email protected]
Gnolizuh Gnolizuh
Beijing, China Shanghai, China
Contacts: Contacts:
h[email protected] https://github.com/gnolizuh
[email protected]
han4235 han4235
Suzhou, China Suzhou, China
+1 -1
View File
@@ -1,7 +1,7 @@
BSD 2-Clause License BSD 2-Clause License
Copyright (c) 2012-2017, Roman Arutyunyan 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, han4235, Vladimir Vainer
Copyright (c) 2018-2019, plainheart, HeyJupiter Copyright (c) 2018-2019, plainheart, HeyJupiter
Copyright (c) 2019, ever4Keny Copyright (c) 2019, ever4Keny
+3 -2
View File
@@ -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 | 备注 | | 功能 | nginx-http-flv-module | nginx-rtmp-module | 备注 |
| :----------------------: | :-------------------: | :---------------: | :--------------------------------------: | | :----------------------: | :-------------------: | :---------------: | :--------------------------------------: |
| HTTP-FLV (播放) | √ | x | 支持 HTTPS-FLV 和 chunked 回复 | | HTTP-FLV (HTTP/1.x 播放) | √ | x | 支持 HTTPS-FLV 和 chunked 回复 |
| GOP 缓存 | √ | x | | | GOP 缓存 | √ | x | |
| 虚拟主机 | √ | x | | | 虚拟主机 | √ | x | |
| 省略 `listen` 配置项 | √ | 见备注 | 配置中必须有一个 `listen` | | 省略 `listen` 配置项 | √ | 见备注 | 配置中必须有一个 `listen` |
@@ -37,6 +37,7 @@
| JSON 风格的数据信息 | √ | x | | | JSON 风格的数据信息 | √ | x | |
| 录制的数据信息 | √ | x | | | 录制的数据信息 | √ | x | |
| 大小端无关 | √ | 见备注 | `big-endian` 分支部分支持 | | 大小端无关 | √ | 见备注 | `big-endian` 分支部分支持 |
| 播放连接超时 | √ | x | |
## 兼容性 ## 兼容性
+2 -1
View File
@@ -26,7 +26,7 @@ Donate if you like this module. Many thanks to you!
| Features | nginx-http-flv-module | nginx-rtmp-module | Remarks | | 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 | | | GOP cache | √ | x | |
| Virtual Host | √ | x | | | Virtual Host | √ | x | |
| Omit `listen` directive | √ | See remarks | There MUST be at least one `listen` directive | | 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 | | | JSON style statistics | √ | x | |
| Statistics for recordings | √ | x | | | Statistics for recordings | √ | x | |
| Independent of endianness | √ | See remarks | Partially supported in branch `big-endian` | | Independent of endianness | √ | See remarks | Partially supported in branch `big-endian` |
| Timeout for play connections | √ | x | |
## Compatibility ## Compatibility
@@ -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, ngx_log_debug7(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"hls: open fragment file='%s', keyfile='%s', " "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->stream.data,
ctx->keyfile.data ? ctx->keyfile.data : (u_char *) "", ctx->keyfile.data ? ctx->keyfile.data : (u_char *) "",
ctx->frag, ctx->nfrags, ts, discont, counter); ctx->frag, ctx->nfrags, ts, discont, counter);
+20 -3
View File
@@ -323,7 +323,7 @@ ngx_http_flv_live_init_handlers(ngx_cycle_t *cycle)
return NGX_OK; 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_array_push(&cmcf->events[NGX_HTTP_FLV_LIVE_REQUEST]);
*h = 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_connection_t *c;
ngx_http_request_t *r; ngx_http_request_t *r;
u_char name[NGX_RTMP_MAX_NAME]; u_char name[NGX_RTMP_MAX_NAME];
ngx_str_t addr;
u_char addr_buf[NGX_SOCKADDR_STRLEN];
r = s->data; r = s->data;
c = s->connection; 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.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_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", 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; &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) \ #define NGX_RTMP_SET_STRPAR(name) \
s->name.len = ngx_strlen(v.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 (r->http_version == NGX_HTTP_VERSION_9
#if (NGX_HTTP_V2) #if (NGX_HTTP_V2)
|| r->http_version == NGX_HTTP_VERSION_20 || r->http_version == NGX_HTTP_VERSION_20
#endif
#if (NGX_HTTP_V3)
|| r->http_version == NGX_HTTP_VERSION_30
#endif #endif
) )
{ {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 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; return NGX_HTTP_NOT_ALLOWED;
} }
+5 -13
View File
@@ -12,6 +12,11 @@
#include "ngx_rtmp.h" #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 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, static ngx_int_t ngx_rtmp_optimize_servers(ngx_conf_t *cf,
ngx_rtmp_core_main_conf_t *cmcf, ngx_array_t *ports); 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.data = &ls->addr_text;
ls->log.handler = ngx_accept_log_error; 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->backlog = addr->opt.backlog;
ls->rcvbuf = addr->opt.rcvbuf; ls->rcvbuf = addr->opt.rcvbuf;
ls->sndbuf = addr->opt.sndbuf; ls->sndbuf = addr->opt.sndbuf;
+75 -18
View File
@@ -29,6 +29,9 @@ ngx_rtmp_amf_reverse_copy(void *dst, void* src, size_t len)
} }
#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 #ifdef NGX_DEBUG
static void static void
@@ -406,28 +409,58 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
/* fall through */ /* fall through */
case NGX_RTMP_AMF_OBJECT: case NGX_RTMP_AMF_OBJECT:
if (ngx_rtmp_amf_read_object(ctx, data, if (ctx->object_depth >= NGX_RTMP_AMF_OBJECT_MAX_DEPTH) {
data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0 ngx_log_error(NGX_LOG_WARN, ctx->log, 0,
) != NGX_OK) "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; return NGX_ERROR;
} }
break; break;
case NGX_RTMP_AMF_ARRAY: case NGX_RTMP_AMF_ARRAY:
if (ngx_rtmp_amf_read_array(ctx, data, if (ctx->array_depth >= NGX_RTMP_AMF_ARRAY_MAX_DEPTH) {
data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0 ngx_log_error(NGX_LOG_WARN, ctx->log, 0,
) != NGX_OK) "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; return NGX_ERROR;
} }
break; break;
case NGX_RTMP_AMF_VARIANT_: case NGX_RTMP_AMF_VARIANT_:
if (ngx_rtmp_amf_read_variant(ctx, data, if (ctx->variant_depth >= NGX_RTMP_AMF_VARIANT_MAX_DEPTH) {
data && elts ? elts->len / sizeof(ngx_rtmp_amf_elt_t) : 0 ngx_log_error(NGX_LOG_WARN, ctx->log, 0,
) != NGX_OK) "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; return NGX_ERROR;
} }
break; break;
@@ -535,6 +568,7 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
ngx_rtmp_amf_elt_t *elts, size_t nelts) ngx_rtmp_amf_elt_t *elts, size_t nelts)
{ {
size_t n; size_t n;
ngx_int_t rc;
ngx_int_t type; ngx_int_t type;
uint8_t type8; uint8_t type8;
void *data; void *data;
@@ -603,18 +637,41 @@ ngx_rtmp_amf_write(ngx_rtmp_amf_ctx_t *ctx,
case NGX_RTMP_AMF_OBJECT: case NGX_RTMP_AMF_OBJECT:
type8 = NGX_RTMP_AMF_END; type8 = NGX_RTMP_AMF_END;
if (ngx_rtmp_amf_write_object(ctx, data,
elts[n].len / sizeof(ngx_rtmp_amf_elt_t)) != NGX_OK if (ctx->object_depth >= NGX_RTMP_AMF_OBJECT_MAX_DEPTH) {
|| ngx_rtmp_amf_put(ctx, &type8, 1) != NGX_OK) 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; return NGX_ERROR;
} }
break; break;
case NGX_RTMP_AMF_ARRAY: case NGX_RTMP_AMF_ARRAY:
if (ngx_rtmp_amf_write_array(ctx, data, if (ctx->array_depth >= NGX_RTMP_AMF_ARRAY_MAX_DEPTH) {
elts[n].len / sizeof(ngx_rtmp_amf_elt_t)) != NGX_OK) 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; return NGX_ERROR;
} }
break; break;
+4
View File
@@ -50,6 +50,10 @@ typedef ngx_chain_t * (*ngx_rtmp_amf_alloc_pt)(void *arg);
typedef struct { typedef struct {
ngx_uint_t object_depth;
ngx_uint_t array_depth;
ngx_uint_t variant_depth;
ngx_chain_t *link, *first; ngx_chain_t *link, *first;
size_t offset; size_t offset;
ngx_rtmp_amf_alloc_pt alloc; ngx_rtmp_amf_alloc_pt alloc;
+46 -12
View File
@@ -366,41 +366,52 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
ls = cycle->listening.elts; ls = cycle->listening.elts;
for (n = 0; n < cycle->listening.nelts; ++n, ++ls) { for (n = 0; n < cycle->listening.nelts; ++n, ++ls) {
if ((ls->handler == ngx_rtmp_init_connection) && if (ls->handler != ngx_rtmp_init_connection ||
(ls->sockaddr && ls->sockaddr->sa_family == AF_UNIX)) ls->sockaddr == NULL || ls->sockaddr->sa_family != AF_UNIX)
{ {
continue;
}
c = ls->connection; c = ls->connection;
if (c) { if (c) {
if (c->read->active) { if (c->read->active) {
if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) { if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
/* /*
* delete the old accept events that were bound to * it seems that Linux-2.6.x OpenVZ sends events
* the old cycle read events array * for closed shared listening sockets unless
* the events was explicitly deleted
*/ */
ngx_del_event(c->read, ngx_del_event(c->read, NGX_READ_EVENT, 0);
NGX_READ_EVENT, NGX_CLOSE_EVENT);
} else {
ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
}
}
if (c->read->timer_set) {
ngx_del_timer(c->read);
}
ngx_free_connection(c); ngx_free_connection(c);
c->fd = (ngx_socket_t) -1; 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) { if (ngx_close_socket(ls->fd) == -1) {
ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_socket_errno, ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_socket_errno,
ngx_close_socket_n "%V failed", ngx_close_socket_n "%V failed", &ls->addr_text);
&ls->addr_text);
} }
ls->fd = (ngx_socket_t) -1; ls->fd = (ngx_socket_t) -1;
break; break;
} }
}
pid = ngx_getpid(); pid = ngx_getpid();
*ngx_snprintf(path, sizeof(path), *ngx_snprintf(path, sizeof(path),
@@ -434,6 +445,11 @@ ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cycle)
static char * static char *
ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf) 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_rtmp_auto_push_conf_t *apcf = conf;
ngx_conf_init_value(apcf->auto_push, 0); 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) { if (apcf->socket_dir.len == 0) {
ngx_str_set(&apcf->socket_dir, "/tmp"); 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; return NGX_CONF_OK;
} }
+1 -1
View File
@@ -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, ngx_log_error(NGX_LOG_WARN, s->connection->log, 0,
"connect: rtmps tcUrl received: %s", v.tc_url); "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);
} }
} }
@@ -7,6 +7,7 @@
#include <ngx_config.h> #include <ngx_config.h>
#include <ngx_core.h> #include <ngx_core.h>
#include <nginx.h> #include <nginx.h>
#include <ngx_http.h>
#include "ngx_rtmp_play_module.h" #include "ngx_rtmp_play_module.h"
#include "ngx_rtmp_cmd_module.h" #include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_netcall_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 *pfx, *sfx;
ngx_str_t name; ngx_str_t name;
ngx_uint_t n; 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); pmcf = ngx_rtmp_get_module_main_conf(s, ngx_rtmp_play_module);
@@ -1187,6 +1187,11 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
return NGX_OK; 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 { } else {
if (codec_ctx && codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC && if (codec_ctx && codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC &&
!rctx->aac_header_sent) !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); "record: %V skipping until AAC header", &rracf->id);
return NGX_OK; 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); return ngx_rtmp_record_write_frame(s, rctx, h, in, 1);
+6 -4
View File
@@ -282,6 +282,10 @@ ngx_rtmp_relay_push_reconnect(ngx_event_t *ev)
return; return;
} }
if (ctx->tag != &ngx_rtmp_relay_module) {
return;
}
t = racf->pushes.elts; t = racf->pushes.elts;
for (n = 0; n < racf->pushes.nelts; ++n, ++t) { for (n = 0; n < racf->pushes.nelts; ++n, ++t) {
target = *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) &url, s->connection->log) == NGX_OK)
{ {
target->url.default_port = 1935; target->url.default_port = 1935;
target->url.no_resolve = 1;
target->url.uri_part = 1; target->url.uri_part = 1;
target->url.url = url; target->url.url = url;
target->url.addrs = NULL;
target->url.naddrs = 0;
if(ngx_parse_url(s->connection->pool, &target->url) != NGX_OK) { if(ngx_parse_url(s->connection->pool, &target->url) != NGX_OK) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
"relay: invalid url='%V'", &target->url.url); "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; continue;
} }
return "unsuppored parameter"; return "unsupported parameter";
} }
if (is_static) { if (is_static) {
@@ -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); "%ui", (ngx_uint_t)lracf->max_frames) - buf);
NGX_RTMP_STAT_L(",\"interval\":"); NGX_RTMP_STAT_L(",\"interval\":");
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), NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", lracf->interval) - buf); "%ui", lracf->interval) - buf);
}
NGX_RTMP_STAT_L(",\"suffix\":\""); NGX_RTMP_STAT_L(",\"suffix\":\"");
NGX_RTMP_STAT_S(&lracf->suffix); NGX_RTMP_STAT_S(&lracf->suffix);
+2 -2
View File
@@ -9,8 +9,8 @@
#define _NGX_RTMP_VERSION_H_INCLUDED_ #define _NGX_RTMP_VERSION_H_INCLUDED_
#define nginx_rtmp_version 1002012 #define nginx_rtmp_version 1002015
#define NGINX_RTMP_VERSION "1.2.12" #define NGINX_RTMP_VERSION "1.2.15"
#endif /* _NGX_RTMP_VERSION_H_INCLUDED_ */ #endif /* _NGX_RTMP_VERSION_H_INCLUDED_ */