Skip to content

Commit

Permalink
drop PES also on invalid cc
Browse files Browse the repository at this point in the history
  • Loading branch information
erankor committed Jun 22, 2024
1 parent 9572014 commit 4720b8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions nginx-mpegts-module/src/ngx_ts_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ ngx_ts_read_pes(ngx_ts_stream_t *ts, ngx_ts_program_t *prog, ngx_ts_es_t *es,
ngx_log_error(NGX_LOG_WARN, ts->log, 0,
"TS invalid continuity counter, cur: %uD, last: %uD, pid: %uD",
(uint32_t) es->cont, (uint32_t) h->cont, (uint32_t) h->pid);
es->corrupt = 1;
}

es->cont = h->cont;
Expand Down Expand Up @@ -1086,15 +1087,22 @@ ngx_ts_read_pes(ngx_ts_stream_t *ts, ngx_ts_program_t *prog, ngx_ts_es_t *es,
ngx_log_error(NGX_LOG_WARN, ts->log, 0,
"TS invalid packet size, expected: %uD, actual: %uz",
(uint32_t) len, size);
ngx_ts_free_chain(ts, &es->bufs);
return NGX_OK;
es->corrupt = 1;
}
}

es->ptsf = ptsf;
if (!es->corrupt) {
es->ptsf = ptsf;

if (ngx_ts_run_handlers(NGX_TS_PES, ts, prog, es, br.cl) != NGX_OK) {
return NGX_ERROR;
if (ngx_ts_run_handlers(NGX_TS_PES, ts, prog, es, br.cl) != NGX_OK) {
return NGX_ERROR;
}

} else {
ngx_log_debug0(NGX_LOG_DEBUG_CORE, ts->log, 0,
"TS dropped corrupt packet");

es->corrupt = 0;
}

ngx_ts_free_chain(ts, &es->bufs);
Expand Down
1 change: 1 addition & 0 deletions nginx-mpegts-module/src/ngx_ts_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typedef struct {
unsigned ptsf:1;
unsigned rand:1;
unsigned video:1;
unsigned corrupt:1;
ngx_ts_bufs_t bufs; /* ES */
} ngx_ts_es_t;

Expand Down

0 comments on commit 4720b8b

Please sign in to comment.