[vlc-commits] packetizer: dts: rewrite 18166 fix

Francois Cartegnie git at videolan.org
Fri Apr 28 18:16:42 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr 28 18:15:32 2017 +0200| [7305bf34d8a990f1e7f46cdebf0fbb05d2df5660] | committer: Francois Cartegnie

packetizer: dts: rewrite 18166 fix

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

 modules/packetizer/dts.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/modules/packetizer/dts.c b/modules/packetizer/dts.c
index cb2a4b95f0..2d4c9dbb7f 100644
--- a/modules/packetizer/dts.c
+++ b/modules/packetizer/dts.c
@@ -216,11 +216,8 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
                     return NULL;
                 break;
             }
-            /* Even frame size is likely incorrect FSIZE #18166.
-             * Sync minus one byte, we can always sync 1 byte further */
-            p_sys->i_input_size = p_sys->i_next_offset
-                                = (p_sys->dts.i_frame_size % 2) ? p_sys->dts.i_frame_size - 1
-                                                                : p_sys->dts.i_frame_size;
+
+            p_sys->i_input_size = p_sys->i_next_offset = p_sys->dts.i_frame_size;
             p_sys->i_state = STATE_NEXT_SYNC;
 
         case STATE_NEXT_SYNC:
@@ -250,6 +247,17 @@ static block_t *PacketizeBlock( decoder_t *p_dec, block_t **pp_block )
 
                 if( !vlc_dts_header_IsSync( p_header, VLC_DTS_HEADER_SIZE ) )
                 {
+                    /* Even frame size is likely incorrect FSIZE #18166 */
+                    if( (p_sys->dts.i_frame_size % 2) && p_sys->i_next_offset > 0 &&
+                        block_PeekOffsetBytes( &p_sys->bytestream,
+                                               p_sys->i_next_offset - 1, p_header,
+                                               VLC_DTS_HEADER_SIZE ) == 0 &&
+                         vlc_dts_header_IsSync( p_header, VLC_DTS_HEADER_SIZE ) )
+                    {
+                        p_sys->i_input_size = p_sys->i_next_offset = p_sys->dts.i_frame_size - 1;
+                        /* reenter */
+                        break;
+                    }
                     msg_Dbg( p_dec, "emulated sync word "
                              "(no sync on following frame)" );
                     p_sys->i_state = STATE_NOSYNC;



More information about the vlc-commits mailing list