mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-06-30 00:28:58 +02:00
added global record on/off feature
This commit is contained in:
parent
4a775d6f0b
commit
8c5b864339
|
@ -584,13 +584,21 @@ ngx_rtmp_record_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
||||||
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_record_module);
|
racf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_record_module);
|
||||||
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_record_module);
|
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_record_module);
|
||||||
|
|
||||||
if (racf == NULL || ctx == NULL || racf->flags & NGX_RTMP_RECORD_OFF) {
|
if (racf == NULL || ctx == NULL) {
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (racf->flags & NGX_RTMP_RECORD_OFF) {
|
||||||
|
if (ctx->file.fd != NGX_INVALID_FILE) {
|
||||||
|
ngx_rtmp_record_close(s);
|
||||||
|
}
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyframe = (ngx_rtmp_get_video_frame_type(in) == NGX_RTMP_VIDEO_KEY_FRAME);
|
keyframe = (ngx_rtmp_get_video_frame_type(in) == NGX_RTMP_VIDEO_KEY_FRAME);
|
||||||
|
|
||||||
if (keyframe && racf->interval != (ngx_msec_t)NGX_CONF_UNSET) {
|
if (keyframe) {
|
||||||
|
if (racf->interval != (ngx_msec_t)NGX_CONF_UNSET) {
|
||||||
next = ctx->last;
|
next = ctx->last;
|
||||||
next.msec += racf->interval;
|
next.msec += racf->interval;
|
||||||
next.sec += (next.msec / 1000);
|
next.sec += (next.msec / 1000);
|
||||||
|
@ -605,6 +613,9 @@ ngx_rtmp_record_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
|
||||||
"record: failed");
|
"record: failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (ctx->file.fd == NGX_INVALID_FILE) {
|
||||||
|
ngx_rtmp_record_open(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->file.fd == NGX_INVALID_FILE) {
|
if (ctx->file.fd == NGX_INVALID_FILE) {
|
||||||
|
|
Loading…
Reference in a new issue