Skip to content

Commit

Permalink
[misc] sync some bugs fix from nginx-rtmp-module pull requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
winshining committed Jun 19, 2018
1 parent 7c3d0bf commit 8804b00
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions ngx_rtmp_amf.c
@@ -1,6 +1,7 @@

/*
* Copyright (C) Roman Arutyunyan
* Copyright (C) Winshining
*/


Expand Down Expand Up @@ -328,7 +329,7 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
} else {
switch (ngx_rtmp_amf_get(ctx, &type8, 1)) {
case NGX_DONE:
if (elts->type & NGX_RTMP_AMF_OPTIONAL) {
if (elts && elts->type & NGX_RTMP_AMF_OPTIONAL) {
return NGX_OK;
}

Expand Down Expand Up @@ -375,7 +376,7 @@ ngx_rtmp_amf_read(ngx_rtmp_amf_ctx_t *ctx, ngx_rtmp_amf_elt_t *elts,
if (data == NULL) {
rc = ngx_rtmp_amf_get(ctx, data, len);

} else if (elts->len <= len) {
} else if (elts && elts->len <= len) {
rc = ngx_rtmp_amf_get(ctx, data, elts->len - 1);
if (rc != NGX_OK)
return NGX_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion ngx_rtmp_codec_module.c
Expand Up @@ -848,7 +848,7 @@ ngx_rtmp_codec_dump_header(ngx_rtmp_session_t *s, const char *type,
u_char hex[] = "0123456789abcdef";

for (pp = buf, p = in->buf->pos;
p < in->buf->last && pp < buf + sizeof(buf) - 1;
p < in->buf->last && pp < buf + sizeof(buf) - 2;
++p)
{
*pp++ = hex[*p >> 4];
Expand Down
2 changes: 1 addition & 1 deletion ngx_rtmp_exec_module.c
Expand Up @@ -640,7 +640,7 @@ ngx_rtmp_exec_child_dead(ngx_event_t *ev)
}

ngx_log_debug1(NGX_LOG_DEBUG_RTMP, e->log, 0,
"exec: shedule respawn %Mmsec", e->respawn_timeout);
"exec: schedule respawn %Mmsec", e->respawn_timeout);

e->respawn_evt.data = e;
e->respawn_evt.log = e->log;
Expand Down
2 changes: 1 addition & 1 deletion ngx_rtmp_handler.c
Expand Up @@ -730,7 +730,7 @@ ngx_rtmp_send_message(ngx_rtmp_session_t *s, ngx_chain_t *out,
{
ngx_uint_t nmsg;

nmsg = (s->out_last - s->out_pos) % s->out_queue + 1;
nmsg = ngx_abs(s->out_last - s->out_pos) % s->out_queue + 1;

if (priority > 3) {
priority = 3;
Expand Down
4 changes: 2 additions & 2 deletions ngx_rtmp_limit_module.c
Expand Up @@ -105,7 +105,7 @@ ngx_rtmp_limit_connect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
rc = n > (ngx_uint_t) lmcf->max_conn ? NGX_ERROR : NGX_OK;

ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"limit: inc conection counter: %uD", n);
"limit: inc connection counter: %uD", n);

if (rc != NGX_OK) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
Expand Down Expand Up @@ -141,7 +141,7 @@ ngx_rtmp_limit_disconnect(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,

(void) n;
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"limit: dec conection counter: %uD", n);
"limit: dec connection counter: %uD", n);

return NGX_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion ngx_rtmp_live_module.c
Expand Up @@ -72,7 +72,7 @@ static ngx_command_t ngx_rtmp_live_commands[] = {

{ ngx_string("stream_buckets"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
ngx_conf_set_str_slot,
ngx_conf_set_num_slot,
NGX_RTMP_APP_CONF_OFFSET,
offsetof(ngx_rtmp_live_app_conf_t, nbuckets),
NULL },
Expand Down
2 changes: 1 addition & 1 deletion ngx_rtmp_send.c
Expand Up @@ -114,7 +114,7 @@ ngx_rtmp_create_abort(ngx_rtmp_session_t *s, uint32_t csid)
"create: abort csid=%uD", csid);

{
NGX_RTMP_USER_START(s, NGX_RTMP_MSG_CHUNK_SIZE);
NGX_RTMP_USER_START(s, NGX_RTMP_MSG_ABORT);

NGX_RTMP_USER_OUT4(csid);

Expand Down

0 comments on commit 8804b00

Please sign in to comment.