]> git.sesse.net Git - vlc/commitdiff
Improved vout picture locking scheme.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 14 Oct 2008 20:46:21 +0000 (22:46 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 15 Oct 2008 19:29:40 +0000 (21:29 +0200)
src/video_output/video_output.c

index d0a8dc9af23cca8c4894462dd9ae7ebe910159b5..ae354e7c1b8edc7337115ee8a16f552ecfbbce75 100644 (file)
@@ -931,10 +931,9 @@ static void* RunThread( vlc_object_t *p_this )
         picture_t *p_directbuffer;
         int i_index;
 
-        /*
-         * Find the picture to display (the one with the earliest date).
-         * This operation does not need lock, since only READY_PICTUREs
-         * are handled. */
+        /* Find the picture to display (the one with the earliest date). */
+        vlc_mutex_lock( &p_vout->picture_lock );
+
         for( i_index = 0; i_index < I_RENDERPICTURES; i_index++ )
         {
             picture_t *p_pic = PP_RENDERPICTURE[i_index];
@@ -1014,6 +1013,7 @@ static void* RunThread( vlc_object_t *p_this )
                 p_vout->p->i_picture_lost++;
                 msg_Warn( p_vout, "late picture skipped (%"PRId64")",
                                   current_date - display_date );
+                vlc_mutex_unlock( &p_vout->picture_lock );
                 continue;
             }
 
@@ -1043,6 +1043,7 @@ static void* RunThread( vlc_object_t *p_this )
                 }
             }
         }
+        vlc_mutex_unlock( &p_vout->picture_lock );
 
         if( p_picture == NULL )
             i_idle_loops++;