mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
added 'busy' directive
This commit is contained in:
@ -287,6 +287,7 @@ typedef struct ngx_rtmp_core_srv_conf_s {
|
|||||||
size_t max_message;
|
size_t max_message;
|
||||||
ngx_flag_t play_time_fix;
|
ngx_flag_t play_time_fix;
|
||||||
ngx_flag_t publish_time_fix;
|
ngx_flag_t publish_time_fix;
|
||||||
|
ngx_flag_t busy;
|
||||||
size_t out_queue;
|
size_t out_queue;
|
||||||
size_t out_cork;
|
size_t out_cork;
|
||||||
|
|
||||||
|
@ -127,6 +127,13 @@ static ngx_command_t ngx_rtmp_core_commands[] = {
|
|||||||
offsetof(ngx_rtmp_core_srv_conf_t, out_cork),
|
offsetof(ngx_rtmp_core_srv_conf_t, out_cork),
|
||||||
NULL },
|
NULL },
|
||||||
|
|
||||||
|
{ ngx_string("busy"),
|
||||||
|
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_CONF_TAKE1,
|
||||||
|
ngx_conf_set_flag_slot,
|
||||||
|
NGX_RTMP_SRV_CONF_OFFSET,
|
||||||
|
offsetof(ngx_rtmp_core_srv_conf_t, busy),
|
||||||
|
NULL },
|
||||||
|
|
||||||
/* time fixes are needed for flash clients */
|
/* time fixes are needed for flash clients */
|
||||||
{ ngx_string("play_time_fix"),
|
{ ngx_string("play_time_fix"),
|
||||||
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
|
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
|
||||||
@ -232,6 +239,7 @@ ngx_rtmp_core_create_srv_conf(ngx_conf_t *cf)
|
|||||||
conf->out_cork = NGX_CONF_UNSET;
|
conf->out_cork = NGX_CONF_UNSET;
|
||||||
conf->play_time_fix = NGX_CONF_UNSET;
|
conf->play_time_fix = NGX_CONF_UNSET;
|
||||||
conf->publish_time_fix = NGX_CONF_UNSET;
|
conf->publish_time_fix = NGX_CONF_UNSET;
|
||||||
|
conf->busy = NGX_CONF_UNSET;
|
||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
@ -258,6 +266,7 @@ ngx_rtmp_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||||||
conf->out_queue / 8);
|
conf->out_queue / 8);
|
||||||
ngx_conf_merge_value(conf->play_time_fix, prev->play_time_fix, 1);
|
ngx_conf_merge_value(conf->play_time_fix, prev->play_time_fix, 1);
|
||||||
ngx_conf_merge_value(conf->publish_time_fix, prev->publish_time_fix, 1);
|
ngx_conf_merge_value(conf->publish_time_fix, prev->publish_time_fix, 1);
|
||||||
|
ngx_conf_merge_value(conf->busy, prev->busy, 0);
|
||||||
|
|
||||||
if (prev->pool == NULL) {
|
if (prev->pool == NULL) {
|
||||||
prev->pool = ngx_create_pool(4096, &cf->cycle->new_log);
|
prev->pool = ngx_create_pool(4096, &cf->cycle->new_log);
|
||||||
|
@ -164,6 +164,13 @@ ngx_rtmp_ping(ngx_event_t *pev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cscf->busy) {
|
||||||
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
||||||
|
"ping: not busy between pings");
|
||||||
|
ngx_rtmp_finalize_session(s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
||||||
"ping: schedule %Mms", cscf->ping_timeout);
|
"ping: schedule %Mms", cscf->ping_timeout);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user