mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-10 14:31:07 +02:00
recorder now writes correct flv track mask
This commit is contained in:
parent
51c1459e04
commit
fac68de376
|
@ -790,6 +790,7 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
|
|||
void **app_conf;
|
||||
ngx_int_t rc;
|
||||
ngx_rtmp_record_done_t v;
|
||||
u_char av;
|
||||
|
||||
rracf = rctx->conf;
|
||||
|
||||
|
@ -797,6 +798,23 @@ ngx_rtmp_record_node_close(ngx_rtmp_session_t *s,
|
|||
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) {
|
||||
err = ngx_errno;
|
||||
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",
|
||||
&rracf->id, h->mlen);
|
||||
|
||||
if (h->type == NGX_RTMP_MSG_VIDEO) {
|
||||
rctx->video = 1;
|
||||
} else {
|
||||
rctx->audio = 1;
|
||||
}
|
||||
|
||||
timestamp = h->timestamp - rctx->epoch;
|
||||
|
||||
/* write tag header */
|
||||
|
|
|
@ -51,6 +51,8 @@ typedef struct {
|
|||
unsigned aac_header_sent:1;
|
||||
unsigned avc_header_sent:1;
|
||||
unsigned video_key_sent:1;
|
||||
unsigned audio:1;
|
||||
unsigned video:1;
|
||||
} ngx_rtmp_record_rec_ctx_t;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue