Skip to content

Commit 71b2db0

Browse files
committed
[misc] added timers for playing subscribers and fixed a overflow bug.
1 parent 10bd726 commit 71b2db0

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

ngx_http_flv_live_module.c

+6
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ ngx_http_flv_live_write_handler(ngx_event_t *wev)
14981498
ngx_http_request_t *r;
14991499
ngx_rtmp_session_t *s;
15001500
ngx_int_t n;
1501+
ngx_rtmp_live_ctx_t *lctx;
15011502
ngx_rtmp_core_srv_conf_t *cscf;
15021503
ngx_http_flv_live_ctx_t *ctx;
15031504

@@ -1565,6 +1566,11 @@ ngx_http_flv_live_write_handler(ngx_event_t *wev)
15651566
}
15661567
}
15671568

1569+
lctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_live_module);
1570+
if (lctx && !lctx->publishing && !wev->timer_set) {
1571+
ngx_add_timer(wev, s->timeout);
1572+
}
1573+
15681574
if (wev->active) {
15691575
ngx_del_event(wev, NGX_WRITE_EVENT, 0);
15701576
}

ngx_rtmp_handler.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
#include <ngx_config.h>
99
#include <ngx_core.h>
10-
#include "ngx_rtmp.h"
10+
#include "ngx_rtmp_live_module.h"
1111
#include "ngx_rtmp_amf.h"
12-
#include "ngx_rtmp_cmd_module.h"
1312

1413

1514
static void ngx_rtmp_recv(ngx_event_t *rev);
@@ -503,6 +502,7 @@ ngx_rtmp_send(ngx_event_t *wev)
503502
ngx_connection_t *c;
504503
ngx_rtmp_session_t *s;
505504
ngx_int_t n;
505+
ngx_rtmp_live_ctx_t *lctx;
506506
ngx_rtmp_core_srv_conf_t *cscf;
507507

508508
c = wev->data;
@@ -565,6 +565,11 @@ ngx_rtmp_send(ngx_event_t *wev)
565565
}
566566
}
567567

568+
lctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_live_module);
569+
if (lctx && !lctx->publishing && !wev->timer_set) {
570+
ngx_add_timer(wev, s->timeout);
571+
}
572+
568573
if (wev->active) {
569574
ngx_del_event(wev, NGX_WRITE_EVENT, 0);
570575
}

ngx_rtmp_stat_module.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
508508
ngx_uint_t nclients, total_nclients;
509509
ngx_uint_t f;
510510
ngx_flag_t prev;
511-
u_char buf[NGX_INT_T_LEN];
511+
u_char buf[NGX_INT64_LEN + 4];
512512
u_char bbuf[NGX_INT32_LEN];
513513
ngx_rtmp_stat_loc_conf_t *slcf;
514514
u_char *cname;
@@ -770,8 +770,8 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
770770
}
771771
if (codec->avc_profile) {
772772
NGX_RTMP_STAT_L(",\"profile\":\"");
773-
NGX_RTMP_STAT_CS(
774-
ngx_rtmp_stat_get_avc_profile(codec->avc_profile));
773+
NGX_RTMP_STAT_CS(ngx_rtmp_stat_get_avc_profile(
774+
codec->avc_profile));
775775
NGX_RTMP_STAT_L("\"");
776776
}
777777
if (codec->avc_compat) {

ngx_rtmp_version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#define _NGX_RTMP_VERSION_H_INCLUDED_
1010

1111

12-
#define nginx_rtmp_version 1002006
13-
#define NGINX_RTMP_VERSION "1.2.6"
12+
#define nginx_rtmp_version 1002007
13+
#define NGINX_RTMP_VERSION "1.2.7"
1414

1515

1616
#endif /* _NGX_RTMP_VERSION_H_INCLUDED_ */

0 commit comments

Comments
 (0)