]> git.sesse.net Git - vlc/commitdiff
* modules/packetizer/mpegvideo.c: fixed major bug where the first frame could be...
authorGildas Bazin <gbazin@videolan.org>
Tue, 27 Jan 2004 14:05:33 +0000 (14:05 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 27 Jan 2004 14:05:33 +0000 (14:05 +0000)
* src/stream_output/stream_output.c: guard against non-dated packets in sout_InputSendBuffer().

modules/packetizer/mpegvideo.c
src/stream_output/stream_output.c

index 849bc557683d9929a3c5c72a64ad47e2a5849f6d..8129ddd6e5a58c3eb3f385b45f87b2ad9f913ef9 100644 (file)
@@ -2,7 +2,7 @@
  * mpegvideo.c: parse and packetize an MPEG1/2 video stream
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: mpegvideo.c,v 1.27 2004/01/25 17:58:30 murray Exp $
+ * $Id: mpegvideo.c,v 1.28 2004/01/27 14:05:33 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Eric Petit <titer@videolan.org>
@@ -294,6 +294,10 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
                 break;
             }
 
+            /* When starting the stream we can have the first frame with
+             * a null DTS (i_interpolated_pts is initialized to 0) */
+            if( !p_pic->i_dts ) p_pic->i_dts = p_pic->i_pts;
+
             /* So p_block doesn't get re-added several times */
             *pp_block = block_BytestreamPop( &p_sys->bytestream );
 
index 3e983b16600acea7d8b17403ef89372f162151f9..82a2ae12939dcda5d2e50df07959df6dc30953cf 100644 (file)
@@ -2,7 +2,7 @@
  * stream_output.c : stream output module
  *****************************************************************************
  * Copyright (C) 2002-2004 VideoLAN
- * $Id: stream_output.c,v 1.38 2004/01/23 17:56:14 gbazin Exp $
+ * $Id: stream_output.c,v 1.39 2004/01/27 14:05:33 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -237,7 +237,6 @@ int sout_InputDelete( sout_packetizer_input_t *p_input )
     return( VLC_SUCCESS);
 }
 
-
 int sout_InputSendBuffer( sout_packetizer_input_t *p_input,
                           sout_buffer_t *p_buffer )
 {
@@ -250,8 +249,16 @@ int sout_InputSendBuffer( sout_packetizer_input_t *p_input,
         return VLC_SUCCESS;
     }
 
+    if( !p_buffer->i_dts )
+    {
+        msg_Warn( p_sout, "trying to send non-dated packet to stream output!");
+        sout_BufferDelete( p_input->p_sout, p_buffer );
+        return VLC_SUCCESS;
+    }
+
     vlc_mutex_lock( &p_sout->lock );
-    i_ret = p_sout->p_stream->pf_send( p_sout->p_stream, p_input->id, p_buffer );
+    i_ret = p_sout->p_stream->pf_send( p_sout->p_stream,
+                                       p_input->id, p_buffer );
     vlc_mutex_unlock( &p_sout->lock );
 
     return i_ret;