Commit e0c63aa8 authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

mux: mp4: avoid divbyzero

(cherry picked from commit 2a59243de40e64b90cd6fe8c3402de2706eac445)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent ca28163f
...@@ -479,7 +479,7 @@ static int Mux(sout_mux_t *p_mux) ...@@ -479,7 +479,7 @@ static int Mux(sout_mux_t *p_mux)
block_t *p_next = block_FifoShow(p_input->p_fifo); block_t *p_next = block_FifoShow(p_input->p_fifo);
if ( p_next->i_flags & BLOCK_FLAG_DISCONTINUITY ) if ( p_next->i_flags & BLOCK_FLAG_DISCONTINUITY )
{ /* we have no way to know real length except by decoding */ { /* 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_data->i_length = CLOCK_FREQ *
p_stream->fmt.video.i_frame_rate_base / p_stream->fmt.video.i_frame_rate_base /
...@@ -489,7 +489,7 @@ static int Mux(sout_mux_t *p_mux) ...@@ -489,7 +489,7 @@ static int Mux(sout_mux_t *p_mux)
} }
else if ( p_stream->fmt.i_cat == AUDIO_ES && else if ( p_stream->fmt.i_cat == AUDIO_ES &&
p_stream->fmt.audio.i_rate && 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_data->i_length = CLOCK_FREQ * p_data->i_nb_samples /
p_stream->fmt.audio.i_rate; p_stream->fmt.audio.i_rate;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment