Skip to content

Commit

Permalink
recorder now writes correct flv track mask
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Jan 20, 2014
1 parent 51c1459 commit fac68de
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ngx_rtmp_record_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,31 @@ 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;

if (rctx->file.fd == NGX_INVALID_FILE) {
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,
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions ngx_rtmp_record_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down

0 comments on commit fac68de

Please sign in to comment.