mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-06-30 08:29:02 +02:00
removed duplicate record attempts in no-interval mode
This commit is contained in:
parent
36e9b5f52d
commit
176a436942
|
@ -387,8 +387,12 @@ ngx_rtmp_record_make_path(ngx_rtmp_session_t *s,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ngx_rtmp_record_notify_error(ngx_rtmp_session_t *s,
|
ngx_rtmp_record_notify_error(ngx_rtmp_session_t *s,
|
||||||
ngx_rtmp_record_app_conf_t *rracf)
|
ngx_rtmp_record_rec_ctx_t *rctx)
|
||||||
{
|
{
|
||||||
|
ngx_rtmp_record_app_conf_t *rracf = rctx->conf;
|
||||||
|
|
||||||
|
rctx->failed = 1;
|
||||||
|
|
||||||
if (!rracf->notify) {
|
if (!rracf->notify) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -425,6 +429,7 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
|
||||||
|
|
||||||
rctx->last = *ngx_cached_time;
|
rctx->last = *ngx_cached_time;
|
||||||
rctx->file.offset = 0;
|
rctx->file.offset = 0;
|
||||||
|
rctx->failed = 0;
|
||||||
rctx->file.log = s->connection->log;
|
rctx->file.log = s->connection->log;
|
||||||
rctx->file.fd = ngx_open_file(path.data, NGX_FILE_WRONLY, NGX_FILE_TRUNCATE,
|
rctx->file.fd = ngx_open_file(path.data, NGX_FILE_WRONLY, NGX_FILE_TRUNCATE,
|
||||||
NGX_FILE_DEFAULT_ACCESS);
|
NGX_FILE_DEFAULT_ACCESS);
|
||||||
|
@ -438,7 +443,7 @@ ngx_rtmp_record_node_open(ngx_rtmp_session_t *s,
|
||||||
&rracf->id, &path);
|
&rracf->id, &path);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_rtmp_record_notify_error(s, rracf);
|
ngx_rtmp_record_notify_error(s, rctx);
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +593,7 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
|
||||||
ngx_log_error(NGX_LOG_CRIT, s->connection->log, err,
|
ngx_log_error(NGX_LOG_CRIT, s->connection->log, err,
|
||||||
"record: %V error closing file", &rracf->id);
|
"record: %V error closing file", &rracf->id);
|
||||||
|
|
||||||
ngx_rtmp_record_notify_error(s, rracf);
|
ngx_rtmp_record_notify_error(s, rctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
rctx->file.fd = NGX_INVALID_FILE;
|
rctx->file.fd = NGX_INVALID_FILE;
|
||||||
|
@ -690,7 +695,7 @@ ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
|
||||||
if (ngx_write_file(&rctx->file, hdr, ph - hdr, rctx->file.offset)
|
if (ngx_write_file(&rctx->file, hdr, ph - hdr, rctx->file.offset)
|
||||||
== NGX_ERROR)
|
== NGX_ERROR)
|
||||||
{
|
{
|
||||||
ngx_rtmp_record_notify_error(s, rracf);
|
ngx_rtmp_record_notify_error(s, rctx);
|
||||||
|
|
||||||
ngx_close_file(rctx->file.fd);
|
ngx_close_file(rctx->file.fd);
|
||||||
|
|
||||||
|
@ -824,7 +829,7 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
|
||||||
ngx_rtmp_record_node_open(s, rctx);
|
ngx_rtmp_record_node_open(s, rctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if (!rctx->failed) {
|
||||||
ngx_rtmp_record_node_open(s, rctx);
|
ngx_rtmp_record_node_open(s, rctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ typedef struct {
|
||||||
uint32_t epoch;
|
uint32_t epoch;
|
||||||
ngx_time_t last;
|
ngx_time_t last;
|
||||||
time_t timestamp;
|
time_t timestamp;
|
||||||
|
unsigned failed:1;
|
||||||
} ngx_rtmp_record_rec_ctx_t;
|
} ngx_rtmp_record_rec_ctx_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue