implemented rtmp init process event queue

This commit is contained in:
Roman Arutyunyan 2013-02-01 17:19:32 +04:00
parent 98efe9ed7f
commit 2a9d41496a
4 changed files with 23 additions and 2 deletions

View file

@ -32,6 +32,9 @@ static char * ngx_rtmp_merge_applications(ngx_conf_t *cf,
ngx_uint_t ngx_rtmp_max_module;
ngx_thread_volatile ngx_event_t *ngx_rtmp_init_process_events;
static ngx_command_t ngx_rtmp_commands[] = {
{ ngx_string("rtmp"),

View file

@ -568,6 +568,9 @@ ngx_rtmp_is_codec_header(ngx_chain_t *in)
}
extern ngx_thread_volatile ngx_event_t *ngx_rtmp_init_process_events;
extern ngx_rtmp_bandwidth_t ngx_rtmp_bw_out;
extern ngx_rtmp_bandwidth_t ngx_rtmp_bw_in;

View file

@ -330,7 +330,7 @@ ngx_rtmp_exec_init_process(ngx_cycle_t *cycle)
e->respawn_evt.data = e;
e->respawn_evt.log = e->log;
e->respawn_evt.handler = ngx_rtmp_exec_respawn;
ngx_post_event((&e->respawn_evt), &ngx_posted_events);
ngx_post_event((&e->respawn_evt), &ngx_rtmp_init_process_events);
}
return NGX_OK;

View file

@ -15,6 +15,7 @@ static ngx_int_t ngx_rtmp_stat_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_stat_create_loc_conf(ngx_conf_t *cf);
static char * ngx_rtmp_stat_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_stat_init_process(ngx_cycle_t *cycle);
static time_t start_time;
@ -87,7 +88,7 @@ ngx_module_t ngx_rtmp_stat_module = {
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
NULL, /* init module */
NULL, /* init process */
ngx_rtmp_stat_init_process, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
NULL, /* exit process */
@ -96,6 +97,20 @@ ngx_module_t ngx_rtmp_stat_module = {
};
static ngx_int_t
ngx_rtmp_stat_init_process(ngx_cycle_t *cycle)
{
/* Run posted events;
* HTTP module's init_process is called after event module's
* init_process. That makes is possible to use event-related
* calls. RTMP modules are core modules with early
* initializers */
ngx_event_process_posted(cycle, &ngx_rtmp_init_process_events);
return NGX_OK;
}
#define NGX_RTMP_STAT_BUFSIZE 256