Skip to content
Snippets Groups Projects
Commit 09a265cf authored by François Cartegnie's avatar François Cartegnie :fingers_crossed: Committed by Jean-Baptiste Kempf
Browse files

demux: ts: flag truncation as corruption

parent 10ffa49f
No related branches found
No related tags found
No related merge requests found
......@@ -193,6 +193,11 @@ bool ts_pes_Gather( ts_pes_parse_callback *cb,
/* On dropped blocks discontinuity */
else if( p_pkt->i_flags & BLOCK_FLAG_DISCONTINUITY )
{
/* If we know the final size and didn't gather enough bytes it is corrupted
or if the discontinuity doesn't carry the start code */
if( p_pes->gather.i_gathered && (p_pes->gather.i_data_size ||
(b_aligned_ts_payload && !b_unit_start) ) )
p_pes->gather.i_block_flags |= BLOCK_FLAG_CORRUPTED;
b_ret |= ts_pes_Push( cb, p_pes, NULL, true, i_append_pcr );
/* it can't match the target size and need to resync on sync code */
......@@ -201,8 +206,8 @@ bool ts_pes_Gather( ts_pes_parse_callback *cb,
p_pes->gather.i_saved = 0;
/* Propagate to output block to notify packetizers/decoders */
if( p_pes->p_es )
p_pes->p_es->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED;
p_pes->gather.i_block_flags|= BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED;
p_pes->p_es->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
p_pes->gather.i_block_flags|= BLOCK_FLAG_DISCONTINUITY;
}
if ( unlikely(p_pes->gather.i_saved > 0) )
......
......@@ -280,8 +280,9 @@ int main()
block_ChainProperties(output, &outputcount, &outputsize, NULL);
ASSERT(outputcount == 2);
ASSERT(outputsize == sizeof(aligned1) * 2 - 1);
ASSERT(output->i_flags & BLOCK_FLAG_CORRUPTED); /* First block is corrupted 15/16 bytes */
ASSERT((output->i_flags & BLOCK_FLAG_DISCONTINUITY) == 0);
ASSERT(output->p_next->i_flags & BLOCK_FLAG_DISCONTINUITY); /* Next block resumes as discont */
ASSERT(output->p_next->i_flags == BLOCK_FLAG_DISCONTINUITY); /* Next block resumes as discont */
RESET;
PKT_FROM(aligned1);
......@@ -295,6 +296,7 @@ int main()
block_ChainProperties(output, &outputcount, &outputsize, NULL);
ASSERT(outputcount == 1);
ASSERT(outputsize == sizeof(aligned1));
//ASSERT(output->i_flags == BLOCK_FLAG_CORRUPTED); /* First might be corrupted but we don't really know */
RESET;
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment