implemented default buflen setting

This commit is contained in:
Roman Arutyunyan 2014-01-16 22:56:08 +04:00
parent a8094dfef1
commit 39717828d6
5 changed files with 14 additions and 6 deletions

View File

@ -318,6 +318,7 @@ typedef struct ngx_rtmp_core_srv_conf_s {
ngx_flag_t busy;
size_t out_queue;
size_t out_cork;
ngx_msec_t buflen;
ngx_rtmp_conf_ctx_t *ctx;
} ngx_rtmp_core_srv_conf_t;

View File

@ -150,6 +150,13 @@ static ngx_command_t ngx_rtmp_core_commands[] = {
offsetof(ngx_rtmp_core_srv_conf_t, publish_time_fix),
NULL },
{ ngx_string("buflen"),
NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
NGX_RTMP_SRV_CONF_OFFSET,
offsetof(ngx_rtmp_core_srv_conf_t, buflen),
NULL },
ngx_null_command
};
@ -240,6 +247,7 @@ ngx_rtmp_core_create_srv_conf(ngx_conf_t *cf)
conf->out_cork = NGX_CONF_UNSET_SIZE;
conf->play_time_fix = NGX_CONF_UNSET;
conf->publish_time_fix = NGX_CONF_UNSET;
conf->buflen = NGX_CONF_UNSET_MSEC;
conf->busy = NGX_CONF_UNSET;
return conf;
@ -267,6 +275,7 @@ ngx_rtmp_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
conf->out_queue / 8);
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_msec_value(conf->buflen, prev->buflen, 1000);
ngx_conf_merge_value(conf->busy, prev->busy, 0);
if (prev->pool == NULL) {

View File

@ -47,7 +47,6 @@ typedef struct {
#define NGX_RTMP_FLV_BUFFER (1024*1024)
#define NGX_RTMP_FLV_DEFAULT_BUFLEN 1000
#define NGX_RTMP_FLV_BUFLEN_ADDON 1000
#define NGX_RTMP_FLV_TAG_HEADER 11
#define NGX_RTMP_FLV_DATA_OFFSET 13
@ -531,8 +530,8 @@ next:
return NGX_OK;
}
buflen = (s->buflen ? s->buflen + NGX_RTMP_FLV_BUFLEN_ADDON:
NGX_RTMP_FLV_DEFAULT_BUFLEN);
buflen = s->buflen + NGX_RTMP_FLV_BUFLEN_ADDON;
end_timestamp = (ngx_current_msec - ctx->epoch) +
ctx->start_timestamp + buflen;

View File

@ -193,6 +193,7 @@ ngx_rtmp_init_session(ngx_connection_t *c, ngx_rtmp_addr_conf_t *addr_conf)
s->epoch = ngx_current_msec;
s->timeout = cscf->timeout;
s->buflen = cscf->buflen;
ngx_rtmp_set_chunk_size(s, NGX_RTMP_DEFAULT_CHUNK_SIZE);

View File

@ -220,7 +220,6 @@ ngx_rtmp_mp4_from_rtmp_timestamp(ngx_rtmp_mp4_track_t *t, uint32_t ts)
}
#define NGX_RTMP_MP4_DEFAULT_BUFLEN 1000
#define NGX_RTMP_MP4_BUFLEN_ADDON 1000
@ -2124,8 +2123,7 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
return rc;
}
buflen = (s->buflen ? s->buflen + NGX_RTMP_MP4_BUFLEN_ADDON:
NGX_RTMP_MP4_DEFAULT_BUFLEN);
buflen = s->buflen + NGX_RTMP_MP4_BUFLEN_ADDON;
counter = 0;
last_timestamp = 0;