[vlc-commits] codec: feed empty cc blocks when reordering

Francois Cartegnie git at videolan.org
Tue Sep 26 22:44:02 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 20 10:51:03 2017 +0200| [3272846cbbce39902a4df187407addb593851b21] | committer: Francois Cartegnie

codec: feed empty cc blocks when reordering

avoids latency in cc processing due to reorder

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3272846cbbce39902a4df187407addb593851b21
---

 modules/codec/avcodec/video.c    | 2 +-
 modules/codec/libmpeg2.c         | 6 +++---
 modules/packetizer/hxxx_common.c | 2 +-
 modules/packetizer/mpegvideo.c   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 316222d331..e24319169e 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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 )
diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c
index 4105e69c9a..2cbc96cf08 100644
--- a/modules/codec/libmpeg2.c
+++ b/modules/codec/libmpeg2.c
@@ -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;
diff --git a/modules/packetizer/hxxx_common.c b/modules/packetizer/hxxx_common.c
index 745921966b..0eecf9aff2 100644
--- a/modules/packetizer/hxxx_common.c
+++ b/modules/packetizer/hxxx_common.c
@@ -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);
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 83c403b0d0..71126d8979 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -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 );



More information about the vlc-commits mailing list