]> git.sesse.net Git - vlc/commitdiff
* Buffer choice optimizations - vout4 should eat even less CPU now.
authorSam Hocevar <sam@videolan.org>
Thu, 13 Dec 2001 20:47:46 +0000 (20:47 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 13 Dec 2001 20:47:46 +0000 (20:47 +0000)
  * Minor warning fix for Hurd.

include/threads.h
src/video_output/vout_pictures.c

index 6163fa7127d45e00494b83ee4abdc840756fdc8f..b37a616c99db657beb6c5c04801c644af35de69e 100644 (file)
@@ -3,7 +3,7 @@
  * This header provides a portable threads implementation.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: threads.h,v 1.31 2001/12/03 13:58:59 massiot Exp $
+ * $Id: threads.h,v 1.32 2001/12/13 20:47:46 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -939,7 +939,8 @@ static __inline__ void _vlc_thread_join( char * psz_file, int i_line,
     i_ret = pthread_join( thread, NULL );
 
 #elif defined( HAVE_CTHREADS_H )
-    i_ret = cthread_join( thread );
+    cthread_join( thread );
+    i_ret = 1;
 
 #elif defined( HAVE_KERNEL_SCHEDULER_H )
     int32 exit_value;
index caa5cf3dcfcc8d08143f5aaa67dd37b4698f31e2..30c1e2c6145315439721fa2e14d405d09679e9b9 100644 (file)
@@ -2,7 +2,7 @@
  * vout_pictures.c : picture management functions
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vout_pictures.c,v 1.2 2001/12/13 12:47:17 sam Exp $
+ * $Id: vout_pictures.c,v 1.3 2001/12/13 20:47:46 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -134,10 +134,21 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
      * Look for an empty place. XXX: we start at 1 because the first
      * directbuffer is reserved for memcpy()ed pictures.
      */
-    for( i_picture = 0; i_picture < I_RENDERPICTURES; i_picture++ )
+    for( i_picture = 0;
+         i_picture < I_RENDERPICTURES && p_free_picture == NULL;
+         i_picture++ )
     {
         p_picture = PP_RENDERPICTURE[ i_picture ];
 
+        /* If the picture we found is a memory buffer, and we might have
+         * enough room later for a direct buffer, skip it. If no other
+         * pictures are found, the video decoder will try again later. */
+        if( p_vout->b_direct && ( p_vout->output.i_pictures > 3 )
+             && ( p_picture->i_type != DIRECT_PICTURE ) )
+        {
+            break;
+        }
+
         switch( p_picture->i_status )
         {
             case DESTROYED_PICTURE:
@@ -151,11 +162,8 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
                 return( p_picture );
 
             case FREE_PICTURE:
-                if( p_free_picture == NULL )
-                {
-                    /* Picture is empty and ready for allocation */
-                    p_free_picture = p_picture;
-                }
+                /* Picture is empty and ready for allocation */
+                p_free_picture = p_picture;
                 break;
 
             default:
@@ -174,7 +182,6 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
         {
             /* Copy picture information, set some default values */
             p_free_picture->i_status = RESERVED_PICTURE;
-            p_free_picture->i_type = MEMORY_PICTURE;
             p_free_picture->i_matrix_coefficients = 1;
             p_free_picture->i_refcount = 0;
             p_vout->i_heap_size++;
@@ -484,6 +491,8 @@ static void NewPicture( vout_thread_t *p_vout, picture_t *p_picture )
             return;
     }
 
+    p_picture->i_type = MEMORY_PICTURE;
+
     /* Allocate memory */
     switch( p_vout->render.i_chroma )
     {