[vlc-commits] demux: asf: flush remaining tail data (fix #5356)

Francois Cartegnie git at videolan.org
Wed Dec 4 16:43:30 CET 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec  4 16:41:37 2013 +0100| [5b8529385dd01563c3c2acee570e204c5ad5daa8] | committer: Francois Cartegnie

demux: asf: flush remaining tail data (fix #5356)

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

 modules/demux/asf/asf.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index d373a59..6be1039 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -67,6 +67,7 @@ vlc_module_end ()
  *****************************************************************************/
 static int Demux  ( demux_t * );
 static int Control( demux_t *, int i_query, va_list args );
+static void FlushRemainingPackets( demux_t *p_demux );
 
 #define MAX_ASF_TRACKS 128
 
@@ -194,6 +195,7 @@ static int Demux( demux_t *p_demux )
         /* Read and demux a packet */
         if( ( i_result = DemuxPacket( p_demux ) ) <= 0 )
         {
+            FlushRemainingPackets( p_demux );
             return i_result;
         }
         if( i_time_begin == -1 )
@@ -1346,6 +1348,22 @@ error:
     ASF_FreeObjectRoot( p_demux->s, p_sys->p_root );
     return VLC_EGENERIC;
 }
+
+/*****************************************************************************
+ * FlushRemainingPackets: flushes tail packets
+ *****************************************************************************/
+
+static void FlushRemainingPackets( demux_t *p_demux )
+{
+    demux_sys_t *p_sys = p_demux->p_sys;
+    for ( unsigned int i = 0; i < MAX_ASF_TRACKS; i++ )
+    {
+        asf_track_t *tk = p_sys->track[i];
+        if( tk && tk->p_frame )
+            SendPacket( p_demux, tk );
+    }
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -1372,6 +1390,7 @@ static void DemuxEnd( demux_t *p_demux )
         {
             if( tk->p_frame )
             {
+                msg_Warn( p_demux, "Still one frame for track %u, something is wrong", i );
                 block_ChainRelease( tk->p_frame );
             }
             if( tk->p_es )



More information about the vlc-commits mailing list