* src/video_output/video_output.c, include/video_output.h:
authorGildas Bazin <gbazin@videolan.org>
Mon, 24 Mar 2003 23:50:46 +0000 (23:50 +0000)
committerGildas Bazin <gbazin@videolan.org>
Mon, 24 Mar 2003 23:50:46 +0000 (23:50 +0000)
   take into account the caching delay when dropping frames that are too
   far into the future.

include/video_output.h
src/video_output/video_output.c

index 0ffdad4..2d7d100 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously opened video output thread.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_output.h,v 1.92 2003/01/28 22:03:21 sam Exp $
+ * $Id: video_output.h,v 1.93 2003/03/24 23:50:46 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -114,6 +114,8 @@ struct vout_thread_t
     mtime_t             display_jitter;    /* average deviation from the PTS */
     count_t             c_jitter_samples;  /* number of samples used for the *
                                             * calculation of the jitter      */
+    /* delay created by internal caching */
+    int                 i_pts_delay;
 
     /* Filter chain */
     char *psz_filter_chain;
index 00238b5..07fc9ce 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.213 2003/02/26 18:15:33 massiot Exp $
+ * $Id: video_output.c,v 1.214 2003/03/24 23:50:46 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -37,6 +37,7 @@
 
 #include "video.h"
 #include "video_output.h"
+#include <vlc/input.h>                 /* for input_thread_t and i_pts_delay */
 
 #if defined( SYS_DARWIN )
 #include "darwin_specific.h"
@@ -179,10 +180,11 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
                                unsigned int i_width, unsigned int i_height,
                                vlc_fourcc_t i_chroma, unsigned int i_aspect )
 {
-    vout_thread_t * p_vout;                             /* thread descriptor */
-    int             i_index;                                /* loop variable */
-    char          * psz_plugin;
-    vlc_value_t     val;
+    vout_thread_t  * p_vout;                            /* thread descriptor */
+    input_thread_t * p_input_thread;
+    int              i_index;                               /* loop variable */
+    char           * psz_plugin;
+    vlc_value_t      val;
 
     /* Allocate descriptor */
     p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT );
@@ -357,6 +359,19 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
         return NULL;
     }
 
+    /* Calculate delay created by internal caching */
+    p_input_thread = (input_thread_t *)vlc_object_find( p_vout,
+                                           VLC_OBJECT_INPUT, FIND_PARENT );
+    if( p_input_thread )
+    {
+        p_vout->i_pts_delay = p_input_thread->i_pts_delay + VOUT_BOGUS_DELAY;
+        vlc_object_release( p_input_thread );
+    }
+    else
+    {
+        p_vout->i_pts_delay = VOUT_BOGUS_DELAY;
+    }
+
     /* Create thread and set locks */
     vlc_mutex_init( p_vout, &p_vout->picture_lock );
     vlc_mutex_init( p_vout, &p_vout->subpicture_lock );
@@ -699,7 +714,7 @@ static void RunThread( vout_thread_t *p_vout)
                 continue;
             }
 
-            if( display_date > current_date + VOUT_BOGUS_DELAY )
+            if( display_date > current_date + p_vout->i_pts_delay )
             {
                 /* Picture is waaay too early: it will be destroyed */
                 vlc_mutex_lock( &p_vout->picture_lock );