[vlc-commits] audiotrack: handle getPlaybackheadPosition() invalid values

Thomas Guillem git at videolan.org
Tue Dec 1 12:16:12 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Nov 25 14:02:24 2020 +0100| [bf960b367919f4e2d445ed45b51015e9d1e32132] | committer: Thomas Guillem

audiotrack: handle getPlaybackheadPosition() invalid values

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf960b367919f4e2d445ed45b51015e9d1e32132
---

 modules/audio_output/audiotrack.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index a371104730..b146ecdb36 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -683,6 +683,8 @@ AudioTrack_GetSmoothPositionUs( JNIEnv *env, audio_output_t *p_aout )
     if( i_now - p_sys->smoothpos.i_last_time >= SMOOTHPOS_INTERVAL_US )
     {
         i_audiotrack_us = FRAMES_TO_US( AudioTrack_getPlaybackHeadPosition( env, p_aout ) );
+        if( i_audiotrack_us == 0 )
+            goto bailout;
 
         p_sys->smoothpos.i_last_time = i_now;
 
@@ -702,8 +704,9 @@ AudioTrack_GetSmoothPositionUs( JNIEnv *env, audio_output_t *p_aout )
     }
     if( p_sys->smoothpos.i_us != 0 )
         return p_sys->smoothpos.i_us + i_now - AudioTrack_GetLatencyUs( env, p_aout );
-    else
-        return 0;
+
+bailout:
+    return 0;
 }
 
 static vlc_tick_t



More information about the vlc-commits mailing list