[vlc-commits] mp4 mux: avoid division by zero when frame rate is unspecified

Rémi Denis-Courmont git at videolan.org
Wed Nov 19 17:28:39 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 19 18:28:04 2014 +0200| [8d6cef63228bc49d8c0c203a90bda43238d6a9c3] | committer: Rémi Denis-Courmont

mp4 mux: avoid division by zero when frame rate is unspecified

(Note sure if the bytestream will be correct though.)

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

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

diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c
index ee5d785..ad21408 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -488,8 +488,11 @@ static int AddStream(sout_mux_t *p_mux, sout_input_t *p_input)
         p_stream->i_timescale = p_stream->fmt.audio.i_rate;
         break;
     case VIDEO_ES:
-        p_stream->i_timescale = p_stream->fmt.video.i_frame_rate * 1000 /
-                                p_stream->fmt.video.i_frame_rate_base;
+        if( p_stream->fmt.video.i_frame_rate_base != 0 )
+            p_stream->i_timescale = p_stream->fmt.video.i_frame_rate * 1000
+                                    / p_stream->fmt.video.i_frame_rate_base;
+        else
+            p_stream->i_timescale = 0;
         break;
     default:
         p_stream->i_timescale = CLOCK_FREQ;



More information about the vlc-commits mailing list