[vlc-devel] [PATCH 6/6] decoder: simplify the lost audio block stat handling

Steve Lhomme robux4 at ycbcr.xyz
Wed Sep 4 11:04:02 CEST 2019


---
 src/input/decoder.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 0a4e00b91b4..6cf5d885a5f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1154,20 +1154,17 @@ static int DecoderPlayAudio( struct decoder_owner *p_owner, block_t *p_audio )
     return VLC_SUCCESS;
 }
 
-static void DecoderUpdateStatAudio( struct decoder_owner *p_owner,
-                                    unsigned lost )
+static void DecoderUpdateStatAudio( struct decoder_owner *p_owner, bool lost )
 {
     unsigned played = 0;
-
+    unsigned aout_lost = 0;
     if( p_owner->p_aout != NULL )
     {
-        unsigned aout_lost;
-
         aout_DecGetResetStats( p_owner->p_aout, &aout_lost, &played );
-        lost += aout_lost;
     }
+    if (lost) aout_lost++;
 
-    decoder_Notify(p_owner, on_new_audio_stats, 1, lost, played);
+    decoder_Notify(p_owner, on_new_audio_stats, 1, aout_lost, played);
 }
 
 static void DecoderQueueAudio( decoder_t *p_dec, block_t *p_aout_buf )
@@ -1176,7 +1173,7 @@ static void DecoderQueueAudio( decoder_t *p_dec, block_t *p_aout_buf )
 
     int success = DecoderPlayAudio( p_owner, p_aout_buf );
 
-    DecoderUpdateStatAudio( p_owner, success != VLC_SUCCESS ? 1 : 0 );
+    DecoderUpdateStatAudio( p_owner, success != VLC_SUCCESS );
 }
 
 static void DecoderPlaySpu( struct decoder_owner *p_owner, subpicture_t *p_subpic )
-- 
2.17.1



More information about the vlc-devel mailing list