Skip to content

Commit

Permalink
fixed dash/hls cleanup when recorder{} block exists
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Dec 16, 2013
1 parent 7eb0f4e commit aa4bcf8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 51 deletions.
49 changes: 24 additions & 25 deletions dash/ngx_rtmp_dash_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,6 @@ ngx_rtmp_dash_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_value(conf->dash, prev->dash, 0);
ngx_conf_merge_msec_value(conf->fraglen, prev->fraglen, 5000);
ngx_conf_merge_msec_value(conf->playlen, prev->playlen, 30000);
ngx_conf_merge_str_value(conf->path, prev->path, "");
ngx_conf_merge_value(conf->cleanup, prev->cleanup, 1);
ngx_conf_merge_value(conf->nested, prev->nested, 0);

Expand All @@ -1464,37 +1463,37 @@ ngx_rtmp_dash_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)

/* schedule cleanup */

if (conf->path.len == 0 || !conf->cleanup) {
return NGX_CONF_OK;
}

if (conf->path.data[conf->path.len - 1] == '/') {
conf->path.len--;
}
if (conf->dash && conf->path.len && conf->cleanup) {
if (conf->path.data[conf->path.len - 1] == '/') {
conf->path.len--;
}

cleanup = ngx_pcalloc(cf->pool, sizeof(*cleanup));
if (cleanup == NULL) {
return NGX_CONF_ERROR;
}
cleanup = ngx_pcalloc(cf->pool, sizeof(*cleanup));
if (cleanup == NULL) {
return NGX_CONF_ERROR;
}

cleanup->path = conf->path;
cleanup->playlen = conf->playlen;
cleanup->path = conf->path;
cleanup->playlen = conf->playlen;

conf->slot = ngx_pcalloc(cf->pool, sizeof(*conf->slot));
if (conf->slot == NULL) {
return NGX_CONF_ERROR;
}
conf->slot = ngx_pcalloc(cf->pool, sizeof(*conf->slot));
if (conf->slot == NULL) {
return NGX_CONF_ERROR;
}

conf->slot->manager = ngx_rtmp_dash_cleanup;
conf->slot->name = conf->path;
conf->slot->data = cleanup;
conf->slot->conf_file = cf->conf_file->file.name.data;
conf->slot->line = cf->conf_file->line;
conf->slot->manager = ngx_rtmp_dash_cleanup;
conf->slot->name = conf->path;
conf->slot->data = cleanup;
conf->slot->conf_file = cf->conf_file->file.name.data;
conf->slot->line = cf->conf_file->line;

if (ngx_add_path(cf, &conf->slot) != NGX_OK) {
return NGX_CONF_ERROR;
if (ngx_add_path(cf, &conf->slot) != NGX_OK) {
return NGX_CONF_ERROR;
}
}

ngx_conf_merge_str_value(conf->path, prev->path, "");

return NGX_CONF_OK;
}

Expand Down
51 changes: 25 additions & 26 deletions hls/ngx_rtmp_hls_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2144,7 +2144,6 @@ ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_msec_value(conf->muxdelay, prev->muxdelay, 700);
ngx_conf_merge_msec_value(conf->sync, prev->sync, 2);
ngx_conf_merge_msec_value(conf->playlen, prev->playlen, 30000);
ngx_conf_merge_str_value(conf->path, prev->path, "");
ngx_conf_merge_value(conf->continuous, prev->continuous, 1);
ngx_conf_merge_value(conf->nested, prev->nested, 0);
ngx_conf_merge_uint_value(conf->naming, prev->naming,
Expand All @@ -2166,39 +2165,39 @@ ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)

/* schedule cleanup */

if (conf->path.len == 0 || !conf->cleanup ||
conf->type == NGX_RTMP_HLS_TYPE_EVENT)
if (conf->hls && conf->path.len && conf->cleanup &&
conf->type != NGX_RTMP_HLS_TYPE_EVENT)
{
return NGX_CONF_OK;
}

if (conf->path.data[conf->path.len - 1] == '/') {
conf->path.len--;
}
if (conf->path.data[conf->path.len - 1] == '/') {
conf->path.len--;
}

cleanup = ngx_pcalloc(cf->pool, sizeof(*cleanup));
if (cleanup == NULL) {
return NGX_CONF_ERROR;
}
cleanup = ngx_pcalloc(cf->pool, sizeof(*cleanup));
if (cleanup == NULL) {
return NGX_CONF_ERROR;
}

cleanup->path = conf->path;
cleanup->playlen = conf->playlen;
cleanup->path = conf->path;
cleanup->playlen = conf->playlen;

conf->slot = ngx_pcalloc(cf->pool, sizeof(*conf->slot));
if (conf->slot == NULL) {
return NGX_CONF_ERROR;
}
conf->slot = ngx_pcalloc(cf->pool, sizeof(*conf->slot));
if (conf->slot == NULL) {
return NGX_CONF_ERROR;
}

conf->slot->manager = ngx_rtmp_hls_cleanup;
conf->slot->name = conf->path;
conf->slot->data = cleanup;
conf->slot->conf_file = cf->conf_file->file.name.data;
conf->slot->line = cf->conf_file->line;
conf->slot->manager = ngx_rtmp_hls_cleanup;
conf->slot->name = conf->path;
conf->slot->data = cleanup;
conf->slot->conf_file = cf->conf_file->file.name.data;
conf->slot->line = cf->conf_file->line;

if (ngx_add_path(cf, &conf->slot) != NGX_OK) {
return NGX_CONF_ERROR;
if (ngx_add_path(cf, &conf->slot) != NGX_OK) {
return NGX_CONF_ERROR;
}
}

ngx_conf_merge_str_value(conf->path, prev->path, "");

return NGX_CONF_OK;
}

Expand Down

0 comments on commit aa4bcf8

Please sign in to comment.