[vlc-commits] [Git][videolan/vlc][master] mux: ts: simplify bufferchain

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Sep 29 11:03:22 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2f4e9829 by Francois Cartegnie at 2022-09-29T10:17:06+00:00
mux: ts: simplify bufferchain

- - - - -


1 changed file:

- modules/mux/mpeg/ts.c


Changes:

=====================================
modules/mux/mpeg/ts.c
=====================================
@@ -255,7 +255,7 @@ typedef struct pmt_map_t   /* Holds the mapping between the pmt-pid/pmt table */
 
 typedef struct
 {
-    int     i_depth;
+    size_t   i_depth;
     block_t *p_first;
     block_t **pp_last;
 } sout_buffer_chain_t;
@@ -269,51 +269,33 @@ static inline void BufferChainInit  ( sout_buffer_chain_t *c )
 
 static inline void BufferChainAppend( sout_buffer_chain_t *c, block_t *b )
 {
-    *c->pp_last = b;
-    c->i_depth++;
-
-    while( b->p_next )
-    {
-        b = b->p_next;
+    for( block_t *bb = b; bb; bb = bb->p_next )
         c->i_depth++;
-    }
-    c->pp_last = &b->p_next;
+    block_ChainLastAppend( &c->pp_last, b );
 }
 
 static inline block_t *BufferChainGet( sout_buffer_chain_t *c )
 {
     block_t *b = c->p_first;
-
     if( b )
     {
         c->i_depth--;
         c->p_first = b->p_next;
-
+        b->p_next = NULL;
         if( c->p_first == NULL )
-        {
             c->pp_last = &c->p_first;
-        }
-
-        b->p_next = NULL;
     }
     return b;
 }
 
 static inline block_t *BufferChainPeek( sout_buffer_chain_t *c )
 {
-    block_t *b = c->p_first;
-
-    return b;
+    return c->p_first;
 }
 
 static inline void BufferChainClean( sout_buffer_chain_t *c )
 {
-    block_t *b;
-
-    while( ( b = BufferChainGet( c ) ) )
-    {
-        block_Release( b );
-    }
+    block_ChainRelease(c->p_first);
     BufferChainInit( c );
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2f4e98294c5b61da432eb6a252107f99f1d50d61

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2f4e98294c5b61da432eb6a252107f99f1d50d61
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list