Commit 3272846c authored by François Cartegnie's avatar François Cartegnie 🤞

codec: feed empty cc blocks when reordering

avoids latency in cc processing due to reorder
parent ecb368ef
......@@ -854,7 +854,7 @@ static void DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p
if( p_avcc )
{
cc_Extract( &p_sys->cc, CC_PAYLOAD_RAW, true, p_avcc->data, p_avcc->size );
if( p_sys->cc.i_data )
if( p_sys->cc.b_reorder || p_sys->cc.i_data )
{
block_t *p_cc = block_Alloc( p_sys->cc.i_data );
if( p_cc )
......
......@@ -707,7 +707,7 @@ static void SendCc( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_cc = NULL;
if( p_sys->cc.i_data <= 0 )
if( !p_sys->cc.b_reorder && p_sys->cc.i_data <= 0 )
return;
p_cc = block_Alloc( p_sys->cc.i_data);
......@@ -716,8 +716,8 @@ static void SendCc( decoder_t *p_dec )
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
p_cc->i_dts =
p_cc->i_pts = p_sys->cc.b_reorder ? p_sys->i_cc_pts : p_sys->i_cc_dts;
p_cc->i_flags = ( p_sys->cc.b_reorder ? p_sys->i_cc_flags : BLOCK_FLAG_TYPE_P ) & ( BLOCK_FLAG_TYPE_I|BLOCK_FLAG_TYPE_P|BLOCK_FLAG_TYPE_B);
decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present, 0 );
p_cc->i_flags = p_sys->i_cc_flags & BLOCK_FLAG_TYPE_MASK;
decoder_QueueCc( p_dec, p_cc, p_sys->cc.pb_present, p_sys->cc.b_reorder ? 0 : -1 );
}
cc_Flush( &p_sys->cc );
return;
......
......@@ -90,7 +90,7 @@ block_t * cc_storage_get_current( cc_storage_t *p_ccs, bool pb_present[4],
for( int i = 0; i < 4; i++ )
pb_present[i] = p_ccs->current.pb_present[i];
if( p_ccs->current.i_data <= 0 )
if( !p_ccs->current.b_reorder && p_ccs->current.i_data <= 0 )
return NULL;
p_block = block_Alloc( p_ccs->current.i_data);
......
......@@ -322,7 +322,7 @@ static block_t *GetCc( decoder_t *p_dec, bool pb_present[4], int *pi_reorder_dep
for( i = 0; i < 4; i++ )
pb_present[i] = p_sys->cc.pb_present[i];
if( p_sys->cc.i_data <= 0 )
if( !p_sys->cc.b_reorder && p_sys->cc.i_data <= 0 )
return NULL;
p_cc = block_Alloc( p_sys->cc.i_data );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment