Skip to content

Commit

Permalink
[misc] added timers for playing subscribers and fixed a overflow bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
winshining committed Oct 11, 2019
1 parent 10bd726 commit 71b2db0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
6 changes: 6 additions & 0 deletions ngx_http_flv_live_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,7 @@ ngx_http_flv_live_write_handler(ngx_event_t *wev)
ngx_http_request_t *r;
ngx_rtmp_session_t *s;
ngx_int_t n;
ngx_rtmp_live_ctx_t *lctx;
ngx_rtmp_core_srv_conf_t *cscf;
ngx_http_flv_live_ctx_t *ctx;

Expand Down Expand Up @@ -1565,6 +1566,11 @@ ngx_http_flv_live_write_handler(ngx_event_t *wev)
}
}

lctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_live_module);
if (lctx && !lctx->publishing && !wev->timer_set) {
ngx_add_timer(wev, s->timeout);
}

if (wev->active) {
ngx_del_event(wev, NGX_WRITE_EVENT, 0);
}
Expand Down
9 changes: 7 additions & 2 deletions ngx_rtmp_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

#include <ngx_config.h>
#include <ngx_core.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_live_module.h"
#include "ngx_rtmp_amf.h"
#include "ngx_rtmp_cmd_module.h"


static void ngx_rtmp_recv(ngx_event_t *rev);
Expand Down Expand Up @@ -503,6 +502,7 @@ ngx_rtmp_send(ngx_event_t *wev)
ngx_connection_t *c;
ngx_rtmp_session_t *s;
ngx_int_t n;
ngx_rtmp_live_ctx_t *lctx;
ngx_rtmp_core_srv_conf_t *cscf;

c = wev->data;
Expand Down Expand Up @@ -565,6 +565,11 @@ ngx_rtmp_send(ngx_event_t *wev)
}
}

lctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_live_module);
if (lctx && !lctx->publishing && !wev->timer_set) {
ngx_add_timer(wev, s->timeout);
}

if (wev->active) {
ngx_del_event(wev, NGX_WRITE_EVENT, 0);
}
Expand Down
6 changes: 3 additions & 3 deletions ngx_rtmp_stat_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
ngx_uint_t nclients, total_nclients;
ngx_uint_t f;
ngx_flag_t prev;
u_char buf[NGX_INT_T_LEN];
u_char buf[NGX_INT64_LEN + 4];
u_char bbuf[NGX_INT32_LEN];
ngx_rtmp_stat_loc_conf_t *slcf;
u_char *cname;
Expand Down Expand Up @@ -770,8 +770,8 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
}
if (codec->avc_profile) {
NGX_RTMP_STAT_L(",\"profile\":\"");
NGX_RTMP_STAT_CS(
ngx_rtmp_stat_get_avc_profile(codec->avc_profile));
NGX_RTMP_STAT_CS(ngx_rtmp_stat_get_avc_profile(
codec->avc_profile));
NGX_RTMP_STAT_L("\"");
}
if (codec->avc_compat) {
Expand Down
4 changes: 2 additions & 2 deletions ngx_rtmp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#define _NGX_RTMP_VERSION_H_INCLUDED_


#define nginx_rtmp_version 1002006
#define NGINX_RTMP_VERSION "1.2.6"
#define nginx_rtmp_version 1002007
#define NGINX_RTMP_VERSION "1.2.7"


#endif /* _NGX_RTMP_VERSION_H_INCLUDED_ */

0 comments on commit 71b2db0

Please sign in to comment.