Skip to content

Commit 28b7e83

Browse files
committed
[fix] fixed duplicate writing of audio & video sequence headers.
Privously, audio & video sequence headers were extracted as `avc_header` and `aac_header` in codec module, then in record module, `avc_header` & `aac_header` were firstly written. If `in` chain itself is the sequence header, audio & video sequence header were duplicatively written.
1 parent cf50a2d commit 28b7e83

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ngx_rtmp_record_module.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,11 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
11871187
return NGX_OK;
11881188
}
11891189

1190+
if (ngx_rtmp_is_codec_header(in)) {
1191+
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
1192+
"record: video header has been written already");
1193+
return NGX_OK;
1194+
}
11901195
} else {
11911196
if (codec_ctx && codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC &&
11921197
!rctx->aac_header_sent)
@@ -1195,6 +1200,12 @@ ngx_rtmp_record_node_av(ngx_rtmp_session_t *s, ngx_rtmp_record_rec_ctx_t *rctx,
11951200
"record: %V skipping until AAC header", &rracf->id);
11961201
return NGX_OK;
11971202
}
1203+
1204+
if (ngx_rtmp_is_codec_header(in)) {
1205+
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
1206+
"record: audio header has been written already");
1207+
return NGX_OK;
1208+
}
11981209
}
11991210

12001211
return ngx_rtmp_record_write_frame(s, rctx, h, in, 1);

0 commit comments

Comments
 (0)