added max_message

This commit is contained in:
Roman Arutyunyan 2012-03-21 19:32:18 +04:00
parent 3980a59237
commit 7b70e92413
4 changed files with 23 additions and 7 deletions

13
TODO
View file

@ -1,14 +1,13 @@
- fix time wrapping problem (% 0x00ffffff)
- add support of flv file writing & streaming
- check compilation with IPv6 enabled
- fix broken data_frame
- add HTTP callbacks for all calls
- check compilation with IPv6 enabled
- remove macros hell from ngx_rtmp_send.c
- add max message size
- fix broken data_frame(?)
- fix time wrapping problem (% 0x00ffffff)

View file

@ -243,6 +243,7 @@ typedef struct ngx_rtmp_core_srv_conf_s {
ngx_chain_t *free;
ngx_chain_t *free_chains;
size_t max_buf;
size_t max_message;
ngx_flag_t wait_key_frame;
ngx_rtmp_conf_ctx_t *ctx;

View file

@ -84,6 +84,13 @@ static ngx_command_t ngx_rtmp_core_commands[] = {
offsetof(ngx_rtmp_core_srv_conf_t, max_buf),
NULL },
{ ngx_string("max_message"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot,
NGX_RTMP_SRV_CONF_OFFSET,
offsetof(ngx_rtmp_core_srv_conf_t, max_message),
NULL },
{ ngx_string("wait_key_frame"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_flag_slot,
@ -164,6 +171,7 @@ ngx_rtmp_core_create_srv_conf(ngx_conf_t *cf)
conf->chunk_size = NGX_CONF_UNSET;
conf->ack_window = NGX_CONF_UNSET;
conf->max_buf = NGX_CONF_UNSET;
conf->max_message = NGX_CONF_UNSET;
conf->wait_key_frame = NGX_CONF_UNSET;
return conf;
@ -183,6 +191,7 @@ ngx_rtmp_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_value(conf->chunk_size, prev->chunk_size, 4096);
ngx_conf_merge_uint_value(conf->ack_window, prev->ack_window, 5000000);
ngx_conf_merge_size_value(conf->max_buf, prev->max_buf, 128 * 1024);
ngx_conf_merge_size_value(conf->max_message, prev->max_message, 1024 * 1024);
ngx_conf_merge_value(conf->wait_key_frame, prev->wait_key_frame, 1);
if (prev->pool == NULL) {

View file

@ -712,6 +712,13 @@ ngx_rtmp_recv(ngx_event_t *rev)
/* header done */
b->pos = p;
if (h->mlen > cscf->max_message) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ERROR,
"too big message: %uz", cscf->max_message);
ngx_rtmp_close_connection(c);
return;
}
}
size = b->last - b->pos;