[vlc-commits] [Git][videolan/vlc][master] input: don't lock to write stats if there are none
    Jean-Baptiste Kempf (@jbk) 
    gitlab at videolan.org
       
    Thu Feb 23 17:02:33 UTC 2023
    
    
  
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
b770c640 by Steve Lhomme at 2023-02-23T16:33:00+00:00
input: don't lock to write stats if there are none
- - - - -
1 changed file:
- src/input/input.c
Changes:
=====================================
src/input/input.c
=====================================
@@ -594,16 +594,17 @@ static void MainLoopStatistics( input_thread_t *p_input )
     es_out_SetTimes( priv->p_es_out, f_position, i_time, priv->normal_time,
                      i_length );
 
-    struct input_stats_t new_stats;
-    if( priv->stats != NULL )
-        input_stats_Compute( priv->stats, &new_stats );
+    if (priv->stats != NULL)
+    {
+        struct input_stats_t new_stats;
+        input_stats_Compute(priv->stats, &new_stats);
 
-    vlc_mutex_lock( &priv->p_item->lock );
-    if( priv->stats != NULL )
+        vlc_mutex_lock(&priv->p_item->lock);
         *priv->p_item->p_stats = new_stats;
-    vlc_mutex_unlock( &priv->p_item->lock );
+        vlc_mutex_unlock(&priv->p_item->lock);
 
-    input_SendEventStatistics( p_input, &new_stats );
+        input_SendEventStatistics(p_input, &new_stats);
+    }
 }
 
 /**
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b770c6400aaf76b947476d8f595da2b2571b762b
-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/b770c6400aaf76b947476d8f595da2b2571b762b
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
    
    
More information about the vlc-commits
mailing list