diff --git a/modules/demux/mpeg/ts_pes.c b/modules/demux/mpeg/ts_pes.c index abc9694186..bcd7feb7e9 100644 --- a/modules/demux/mpeg/ts_pes.c +++ b/modules/demux/mpeg/ts_pes.c @@ -268,8 +268,9 @@ bool ts_pes_Gather( ts_pes_parse_callback *cb, assert( p_pes->gather.i_data_size > p_pes->gather.i_gathered || p_pes->gather.i_data_size == 0 ); - /* If we started reading a fixed size */ - if( p_pes->gather.i_data_size > p_pes->gather.i_gathered && !b_single_payload ) + /* If we started reading a fixed size that might not end on boundary */ + if( unlikely(!b_aligned_ts_payload) && + p_pes->gather.i_data_size > p_pes->gather.i_gathered ) { const size_t i_remain = p_pes->gather.i_data_size - p_pes->gather.i_gathered; /* Append whole block */ diff --git a/test/modules/demux/ts_pes.c b/test/modules/demux/ts_pes.c index e42b0434a2..75d971b112 100644 --- a/test/modules/demux/ts_pes.c +++ b/test/modules/demux/ts_pes.c @@ -173,7 +173,7 @@ int main(void) ASSERT(output); block_ChainProperties(output, &outputcount, &outputsize, NULL); ASSERT(outputcount == 1); - ASSERT(outputsize == 256); + ASSERT(outputsize == 300); RESET; /* no packets assembly from unit start, early termination by fixed size */