]> git.sesse.net Git - vlc/commitdiff
* video output patch to improve handling of late pictures (by Meuuh)
authorLoïc Minier <lool@videolan.org>
Fri, 17 May 2002 14:17:05 +0000 (14:17 +0000)
committerLoïc Minier <lool@videolan.org>
Fri, 17 May 2002 14:17:05 +0000 (14:17 +0000)
include/config.h
src/video_output/video_output.c

index 9ac8c1a0e1639c0ffe6a322f1e70022c826662de..b683100375c9a7dae5f51b6861604e0cf2c26bff 100644 (file)
  * late, the thread will perform an idle loop. This time should be
  * at least VOUT_IDLE_SLEEP plus the time required to render a few
  * images, to avoid trashing of decoded images */
-#define VOUT_DISPLAY_DELAY              ((int)(0.500*CLOCK_FREQ))
+#define VOUT_DISPLAY_DELAY              ((int)(0.200*CLOCK_FREQ))
+
+/* Pictures which are VOUT_BOGUS_DELAY or more in advance probably have
+ * a bogus PTS and won't be displayed */
+#define VOUT_BOGUS_DELAY                ((int)(0.800*CLOCK_FREQ))
 
 /* Delay (in microseconds) before an idle screen is displayed */
 #define VOUT_IDLE_DELAY                 (5*CLOCK_FREQ)
index 766ea30b18fb7acc12cfabfc85b1f12599e9814a..27e8ee39e36c535b655bd678c97e5cdc2b36874f 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.175 2002/05/06 21:05:26 gbazin Exp $
+ * $Id: video_output.c,v 1.176 2002/05/17 14:17:05 lool Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -571,8 +571,30 @@ static void RunThread( vout_thread_t *p_vout)
                     p_picture->i_status = DESTROYED_PICTURE;
                     p_vout->i_heap_size--;
                 }
-                intf_WarnMsg( 1, "vout warning: late picture skipped (%p)",
-                              p_picture );
+                intf_WarnMsg( 1, "vout warning: late picture skipped (%lld)",
+                              current_date - display_date );
+                vlc_mutex_unlock( &p_vout->picture_lock );
+
+                continue;
+            }
+            else if( display_date > current_date + VOUT_BOGUS_DELAY )
+            {
+                /* Picture is waaay too early: it will be destroyed */
+                vlc_mutex_lock( &p_vout->picture_lock );
+                if( p_picture->i_refcount )
+                {
+                    /* Pretend we displayed the picture, but don't destroy
+                     * it since the decoder might still need it. */
+                    p_picture->i_status = DISPLAYED_PICTURE;
+                }
+                else
+                {
+                    /* Destroy the picture without displaying it */
+                    p_picture->i_status = DESTROYED_PICTURE;
+                    p_vout->i_heap_size--;
+                }
+                intf_WarnMsg( 1, "vout warning: early picture skipped (%lld)",
+                              display_date - current_date );
                 vlc_mutex_unlock( &p_vout->picture_lock );
 
                 continue;