[vlc-commits] input: remove subpicture 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:11 2013 +0100| [d6ee0fb364a634b1eba8e2db002430e2ed1ee6e1] | committer: Jean-Baptiste Kempf

input: remove subpicture decoder buffering.

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

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

 src/input/decoder.c |   95 +++++++++------------------------------------------
 1 file changed, 16 insertions(+), 79 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index ecb8f6d..59f0466 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -140,9 +140,6 @@ struct decoder_owner_sys_t
         bool b_full;
         int  i_count;
 
-        subpicture_t  *p_subpic;
-        subpicture_t  **pp_subpic_next;
-
         block_t       *p_block;
         block_t       **pp_block_next;
     } buffer;
@@ -547,11 +544,7 @@ void input_DecoderStartBuffering( decoder_t *p_dec )
     p_owner->buffer.b_full = false;
     p_owner->buffer.i_count = 0;
 
-    assert( !p_owner->buffer.p_subpic &&
-            !p_owner->buffer.p_block );
-
-    p_owner->buffer.p_subpic = NULL;
-    p_owner->buffer.pp_subpic_next = &p_owner->buffer.p_subpic;
+    assert( !p_owner->buffer.p_block );
 
     p_owner->buffer.p_block = NULL;
     p_owner->buffer.pp_block_next = &p_owner->buffer.p_block;
@@ -866,7 +859,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_subpic = NULL;
     p_owner->buffer.p_block = NULL;
 
     p_owner->b_flushing = false;
@@ -1460,71 +1452,28 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic )
     /* */
     vlc_mutex_lock( &p_owner->lock );
 
-    if( p_owner->b_buffering || p_owner->buffer.p_subpic )
+    if( p_owner->b_buffering )
     {
-        p_subpic->p_next = NULL;
-
-        *p_owner->buffer.pp_subpic_next = p_subpic;
-        p_owner->buffer.pp_subpic_next = &p_subpic->p_next;
-
-        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_subpic )
-        {
-            p_subpic = p_owner->buffer.p_subpic;
-
-            p_owner->buffer.p_subpic = p_subpic->p_next;
-            p_owner->buffer.i_count--;
-
-            b_has_more = p_owner->buffer.p_subpic != NULL;
-            if( !b_has_more )
-                p_owner->buffer.pp_subpic_next = &p_owner->buffer.p_subpic;
-        }
-
-        /* */
-        DecoderFixTs( p_dec, &p_subpic->i_start, &p_subpic->i_stop, NULL,
-                      NULL, INT64_MAX );
+    bool b_reject = DecoderWaitUnblock( p_dec );
 
-        if( p_subpic->i_start <= VLC_TS_INVALID )
-            b_reject = true;
+    DecoderFixTs( p_dec, &p_subpic->i_start, &p_subpic->i_stop, NULL,
+                  NULL, INT64_MAX );
 
-        DecoderWaitDate( p_dec, &b_reject,
-                         p_subpic->i_start - SPU_MAX_PREPARE_TIME );
-        vlc_mutex_unlock( &p_owner->lock );
+    if( p_subpic->i_start <= VLC_TS_INVALID )
+        b_reject = true;
 
-        if( !b_reject )
-            vout_PutSubpicture( p_vout, p_subpic );
-        else
-            subpicture_Delete( p_subpic );
+    DecoderWaitDate( p_dec, &b_reject,
+                     p_subpic->i_start - SPU_MAX_PREPARE_TIME );
+    vlc_mutex_unlock( &p_owner->lock );
 
-        if( !b_has_more )
-            break;
-        vlc_mutex_lock( &p_owner->lock );
-        if( !p_owner->buffer.p_subpic )
-        {
-            vlc_mutex_unlock( &p_owner->lock );
-            break;
-        }
-    }
+    if( !b_reject )
+        vout_PutSubpicture( p_vout, p_subpic );
+    else
+        subpicture_Delete( p_subpic );
 }
 
 #ifdef ENABLE_SOUT
@@ -1603,18 +1552,6 @@ static void DecoderFlushBuffering( decoder_t *p_dec )
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
     vlc_assert_locked( &p_owner->lock );
-    while( p_owner->buffer.p_subpic )
-    {
-        subpicture_t *p_subpic = p_owner->buffer.p_subpic;
-
-        p_owner->buffer.p_subpic = p_subpic->p_next;
-        p_owner->buffer.i_count--;
-
-        subpicture_Delete( p_subpic );
-
-        if( !p_owner->buffer.p_subpic )
-            p_owner->buffer.pp_subpic_next = &p_owner->buffer.p_subpic;
-    }
     if( p_owner->buffer.p_block )
     {
         block_ChainRelease( p_owner->buffer.p_block );



More information about the vlc-commits mailing list