[vlc-devel] [PATCH 5/7] es_out: fix potential division by zero

Felix Abecassis felix.abecassis at gmail.com
Tue May 6 19:08:29 CEST 2014


---
 src/input/es_out.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index f0334f5..c8ae945 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -620,7 +620,11 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
 
     if( i_stream_duration <= i_buffering_duration && !b_forced )
     {
-        const double f_level = __MAX( (double)i_stream_duration / i_buffering_duration, 0 );
+        double f_level;
+        if (i_buffering_duration == 0)
+            f_level = 0;
+        else
+            f_level = __MAX( (double)i_stream_duration / i_buffering_duration, 0 );
         input_SendEventCache( p_sys->p_input, f_level );
 
         msg_Dbg( p_sys->p_input, "Buffering %d%%", (int)(100 * f_level) );
-- 
1.9.1




More information about the vlc-devel mailing list