[vlc-commits] mux: mp4: avoid divbyzero

Francois Cartegnie git at videolan.org
Sat May 9 19:04:04 CEST 2015


vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat May  9 16:48:26 2015 +0200| [e0c63aa86b3033375d6582d3424d9f2a7c9b9cdf] | committer: Jean-Baptiste Kempf

mux: mp4: avoid divbyzero

(cherry picked from commit 2a59243de40e64b90cd6fe8c3402de2706eac445)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c
index 9b39eb2..0cf146d 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -479,7 +479,7 @@ static int Mux(sout_mux_t *p_mux)
                 block_t *p_next = block_FifoShow(p_input->p_fifo);
                 if ( p_next->i_flags & BLOCK_FLAG_DISCONTINUITY )
                 { /* we have no way to know real length except by decoding */
-                    if ( p_stream->fmt.i_cat == VIDEO_ES )
+                    if ( p_stream->fmt.i_cat == VIDEO_ES && p_stream->fmt.video.i_frame_rate )
                     {
                         p_data->i_length = CLOCK_FREQ *
                                            p_stream->fmt.video.i_frame_rate_base /
@@ -489,7 +489,7 @@ static int Mux(sout_mux_t *p_mux)
                     }
                     else if ( p_stream->fmt.i_cat == AUDIO_ES &&
                               p_stream->fmt.audio.i_rate &&
-                              p_data->i_nb_samples )
+                              p_data->i_nb_samples && p_stream->fmt.audio.i_rate )
                     {
                         p_data->i_length = CLOCK_FREQ * p_data->i_nb_samples /
                                            p_stream->fmt.audio.i_rate;



More information about the vlc-commits mailing list