[vlc-commits] packetizer: dirac: block sanitizing must clean reordering (fix #12051)

Francois Cartegnie git at videolan.org
Mon Sep 22 23:43:55 CEST 2014


vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 22 20:12:18 2014 +0200| [55b88a4073c41c263a0d0f310e95fb6082ffece9] | committer: Jean-Baptiste Kempf

packetizer: dirac: block sanitizing must clean reordering (fix #12051)

(cherry picked from commit fa551675f5a01fd6bfbe72f670aba67ed061d4fa)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/packetizer/dirac.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index 6deec71..71b0b11 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -1179,6 +1179,34 @@ static int dirac_TimeGenPush( decoder_t *p_dec, block_t *p_block_in )
     return 0;
 }
 
+
+static void dirac_ReorderDequeueAndReleaseBlock( decoder_t *p_dec, block_t *p_block )
+{
+    decoder_sys_t *p_sys = p_dec->p_sys;
+    /* Check if that block is present in reorder queue and release it
+       if needed */
+    struct dirac_reorder_entry **pp_at = &p_sys->reorder_buf.p_head;
+    for( ; *pp_at; pp_at = &(*pp_at)->p_next )
+    {
+        /* backup address in case we remove member */
+        struct dirac_reorder_entry *p_entry = *pp_at;
+        if ( p_entry->p_eu == p_block )
+        {
+            /* unlink member */
+            *pp_at = (*pp_at)->p_next;
+
+            /* Add to empty reorder entry list*/
+            p_entry->p_next = p_sys->reorder_buf.p_empty;
+            p_sys->reorder_buf.p_empty = p_entry;
+
+            p_sys->reorder_buf.u_size--;
+            break;
+        }
+    }
+
+    block_Release( p_block );
+}
+
 /*****************************************************************************
  * Packetize: form dated encapsulation units from anything
  *****************************************************************************/
@@ -1307,7 +1335,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
             block_t *p_block_next = p_block->p_next;
             if( p_block->i_pts > VLC_TS_INVALID && p_block->i_dts > VLC_TS_INVALID )
                 break;
-            block_Release( p_block );
+            dirac_ReorderDequeueAndReleaseBlock( p_dec, p_block );
             p_sys->p_outqueue = p_block = p_block_next;
         }
     }



More information about the vlc-commits mailing list