[vlc-commits] demux: flac: fix random audio pos on seek

Francois Cartegnie git at videolan.org
Fri Apr 7 15:45:54 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Apr  7 15:01:09 2017 +0200| [93c5244ff778bbdaf135d5860577b6d00cac0f76] | committer: Francois Cartegnie

demux: flac: fix random audio pos on seek

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

 modules/demux/flac.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 69730d8..9115244 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -215,6 +215,18 @@ static void Close( vlc_object_t * p_this )
     free( p_sys );
 }
 
+static void FlushPacketizer( decoder_t *p_packetizer )
+{
+    if( p_packetizer->pf_flush )
+        p_packetizer->pf_flush( p_packetizer );
+    else
+    {
+        block_t *p_block_out;
+        while( (p_block_out = p_packetizer->pf_packetize( p_packetizer, NULL )) )
+            block_Release( p_block_out );
+    }
+}
+
 /*****************************************************************************
  * Demux: reads and demuxes data packets
  *****************************************************************************
@@ -365,6 +377,14 @@ static int ControlSetTime( demux_t *p_demux, int64_t i_time )
     }
     p_sys->i_pts = VLC_TS_INVALID;
     p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+
+    FlushPacketizer( p_sys->p_packetizer );
+    if( p_sys->p_current_block )
+    {
+        block_Release( p_sys->p_current_block );
+        p_sys->p_current_block = NULL;
+    }
+
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list