mirror of
https://github.com/arut/nginx-rtmp-module.git
synced 2025-08-06 15:00:18 +08:00
recorder now writes correct flv track mask
This commit is contained in:
@ -790,6 +790,7 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
|
|||||||
void **app_conf;
|
void **app_conf;
|
||||||
ngx_int_t rc;
|
ngx_int_t rc;
|
||||||
ngx_rtmp_record_done_t v;
|
ngx_rtmp_record_done_t v;
|
||||||
|
u_char av;
|
||||||
|
|
||||||
rracf = rctx->conf;
|
rracf = rctx->conf;
|
||||||
|
|
||||||
@ -797,6 +798,23 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
|
|||||||
return NGX_AGAIN;
|
return NGX_AGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rctx->initialized) {
|
||||||
|
av = 0;
|
||||||
|
|
||||||
|
if (rctx->video) {
|
||||||
|
av |= 0x01;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rctx->audio) {
|
||||||
|
av |= 0x04;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ngx_write_file(&rctx->file, &av, 1, 4) == NGX_ERROR) {
|
||||||
|
ngx_log_error(NGX_LOG_CRIT, s->connection->log, ngx_errno,
|
||||||
|
"record: %V error writing av mask", &rracf->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ngx_close_file(rctx->file.fd) == NGX_FILE_ERROR) {
|
if (ngx_close_file(rctx->file.fd) == NGX_FILE_ERROR) {
|
||||||
err = ngx_errno;
|
err = ngx_errno;
|
||||||
ngx_log_error(NGX_LOG_CRIT, s->connection->log, err,
|
ngx_log_error(NGX_LOG_CRIT, s->connection->log, err,
|
||||||
@ -866,6 +884,12 @@ ngx_rtmp_record_write_frame(ngx_rtmp_session_t *s,
|
|||||||
"record: %V frame: mlen=%uD",
|
"record: %V frame: mlen=%uD",
|
||||||
&rracf->id, h->mlen);
|
&rracf->id, h->mlen);
|
||||||
|
|
||||||
|
if (h->type == NGX_RTMP_MSG_VIDEO) {
|
||||||
|
rctx->video = 1;
|
||||||
|
} else {
|
||||||
|
rctx->audio = 1;
|
||||||
|
}
|
||||||
|
|
||||||
timestamp = h->timestamp - rctx->epoch;
|
timestamp = h->timestamp - rctx->epoch;
|
||||||
|
|
||||||
/* write tag header */
|
/* write tag header */
|
||||||
|
@ -51,6 +51,8 @@ typedef struct {
|
|||||||
unsigned aac_header_sent:1;
|
unsigned aac_header_sent:1;
|
||||||
unsigned avc_header_sent:1;
|
unsigned avc_header_sent:1;
|
||||||
unsigned video_key_sent:1;
|
unsigned video_key_sent:1;
|
||||||
|
unsigned audio:1;
|
||||||
|
unsigned video:1;
|
||||||
} ngx_rtmp_record_rec_ctx_t;
|
} ngx_rtmp_record_rec_ctx_t;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user