[vlc-commits] input: remove sout decoder buffering.

Felix Abecassis git at videolan.org
Fri Dec 13 18:23:21 CET 2013


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Wed Dec 11 11:46:12 2013 +0100| [40fde063cc48fdeebe14966b3d320b675f5e1dfa] | committer: Jean-Baptiste Kempf

input: remove sout decoder buffering.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/input/decoder.c |   80 +++++++--------------------------------------------
 1 file changed, 11 insertions(+), 69 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 59f0466..9b8f056 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -139,9 +139,6 @@ struct decoder_owner_sys_t
         bool b_first;
         bool b_full;
         int  i_count;
-
-        block_t       *p_block;
-        block_t       **pp_block_next;
     } buffer;
 
     /* Flushing */
@@ -544,12 +541,6 @@ void input_DecoderStartBuffering( decoder_t *p_dec )
     p_owner->buffer.b_full = false;
     p_owner->buffer.i_count = 0;
 
-    assert( !p_owner->buffer.p_block );
-
-    p_owner->buffer.p_block = NULL;
-    p_owner->buffer.pp_block_next = &p_owner->buffer.p_block;
-
-
     p_owner->b_buffering = true;
 
     vlc_cond_signal( &p_owner->wait_request );
@@ -859,7 +850,6 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
     p_owner->buffer.b_first = true;
     p_owner->buffer.b_full = false;
     p_owner->buffer.i_count = 0;
-    p_owner->buffer.p_block = NULL;
 
     p_owner->b_flushing = false;
 
@@ -1486,63 +1476,23 @@ static void DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block )
 
     vlc_mutex_lock( &p_owner->lock );
 
-    if( p_owner->b_buffering || p_owner->buffer.p_block )
+    if( p_owner->b_buffering )
     {
-        block_ChainLastAppend( &p_owner->buffer.pp_block_next, p_sout_block );
-
-        p_owner->buffer.i_count++;
-        /* XXX it is important to be full after the first one */
-        if( p_owner->buffer.i_count > 0 )
-        {
-            p_owner->buffer.b_full = true;
-            vlc_cond_signal( &p_owner->wait_acknowledge );
-        }
+        p_owner->buffer.b_full = true;
+        vlc_cond_signal( &p_owner->wait_acknowledge );
     }
 
-    for( ;; )
-    {
-        bool b_has_more = false;
-        bool b_reject = DecoderWaitUnblock( p_dec );
-
-        if( p_owner->b_buffering )
-        {
-            vlc_mutex_unlock( &p_owner->lock );
-            return;
-        }
-
-        /* */
-        if( p_owner->buffer.p_block )
-        {
-            p_sout_block = p_owner->buffer.p_block;
-
-            p_owner->buffer.p_block = p_sout_block->p_next;
-            p_owner->buffer.i_count--;
-
-            b_has_more = p_owner->buffer.p_block != NULL;
-            if( !b_has_more )
-                p_owner->buffer.pp_block_next = &p_owner->buffer.p_block;
-        }
-        p_sout_block->p_next = NULL;
-
-        DecoderFixTs( p_dec, &p_sout_block->i_dts, &p_sout_block->i_pts,
-                      &p_sout_block->i_length, NULL, INT64_MAX );
+    bool b_reject = DecoderWaitUnblock( p_dec );
 
-        vlc_mutex_unlock( &p_owner->lock );
+    DecoderFixTs( p_dec, &p_sout_block->i_dts, &p_sout_block->i_pts,
+                  &p_sout_block->i_length, NULL, INT64_MAX );
 
-        if( !b_reject )
-            sout_InputSendBuffer( p_owner->p_sout_input, p_sout_block ); // FIXME --VLC_TS_INVALID inspect stream_output/*
-        else
-            block_Release( p_sout_block );
+    vlc_mutex_unlock( &p_owner->lock );
 
-        if( !b_has_more )
-            break;
-        vlc_mutex_lock( &p_owner->lock );
-        if( !p_owner->buffer.p_block )
-        {
-            vlc_mutex_unlock( &p_owner->lock );
-            break;
-        }
-    }
+    if( !b_reject )
+        sout_InputSendBuffer( p_owner->p_sout_input, p_sout_block ); // FIXME --VLC_TS_INVALID inspect stream_output/*
+    else
+        block_Release( p_sout_block );
 }
 #endif
 
@@ -1552,14 +1502,6 @@ static void DecoderFlushBuffering( decoder_t *p_dec )
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
     vlc_assert_locked( &p_owner->lock );
-    if( p_owner->buffer.p_block )
-    {
-        block_ChainRelease( p_owner->buffer.p_block );
-
-        p_owner->buffer.i_count = 0;
-        p_owner->buffer.p_block = NULL;
-        p_owner->buffer.pp_block_next = &p_owner->buffer.p_block;
-    }
 }
 
 #ifdef ENABLE_SOUT



More information about the vlc-commits mailing list