[vlc-commits] es_out: fix potential division by zero

Felix Abecassis git at videolan.org
Wed May 7 19:28:43 CEST 2014


vlc | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Tue May  6 18:45:01 2014 +0200| [882be2a1f8e756201e3b225cac26d239c20bd080] | committer: Felix Abecassis

es_out: fix potential division by zero

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

 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) );



More information about the vlc-commits mailing list