[vlc-commits] mux: mp4: avoid divbyzero

Francois Cartegnie git at videolan.org
Sat May 9 16:49:23 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat May  9 16:48:26 2015 +0200| [2a59243de40e64b90cd6fe8c3402de2706eac445] | committer: Francois Cartegnie

mux: mp4: avoid divbyzero

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

 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 f366167..428b596 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -2950,7 +2950,7 @@ static void WriteFragments(sout_mux_t *p_mux, bool b_flush)
  * This is the end boundary case. */
 static void LengthLocalFixup(sout_mux_t *p_mux, const mp4_stream_t *p_stream, block_t *p_entrydata)
 {
-    if ( p_stream->fmt.i_cat == VIDEO_ES )
+    if ( p_stream->fmt.i_cat == VIDEO_ES && p_stream->fmt.video.i_frame_rate )
     {
         p_entrydata->i_length = CLOCK_FREQ *
                 p_stream->fmt.video.i_frame_rate_base /
@@ -2960,7 +2960,7 @@ static void LengthLocalFixup(sout_mux_t *p_mux, const mp4_stream_t *p_stream, bl
     }
     else if (p_stream->fmt.i_cat == AUDIO_ES &&
              p_stream->fmt.audio.i_rate &&
-             p_entrydata->i_nb_samples)
+             p_entrydata->i_nb_samples && p_stream->fmt.audio.i_rate)
     {
         p_entrydata->i_length = CLOCK_FREQ * p_entrydata->i_nb_samples /
                 p_stream->fmt.audio.i_rate;



More information about the vlc-commits mailing list