[vlc-commits] mux: mp4: ensure non negative elst times

Francois Cartegnie git at videolan.org
Fri Jul 27 15:53:01 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 27 15:45:58 2018 +0200| [d538e3582b40e036429bc759997593a735025296] | committer: Francois Cartegnie

mux: mp4: ensure non negative elst times

because shit can happen with dts less streams

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

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

diff --git a/modules/mux/mp4/mp4.c b/modules/mux/mp4/mp4.c
index 0d5b2a4c72..18cef6991c 100644
--- a/modules/mux/mp4/mp4.c
+++ b/modules/mux/mp4/mp4.c
@@ -537,12 +537,12 @@ static bool CreateCurrentEdit(mp4_stream_t *p_stream, vlc_tick_t i_mux_start_dts
     if(p_stream->mux.i_edits_count == 0)
     {
         p_newedit->i_start_time = 0;
-        p_newedit->i_start_offset = p_stream->i_first_dts - i_mux_start_dts;
+        p_newedit->i_start_offset = __MAX(0, p_stream->i_first_dts - i_mux_start_dts);
     }
     else
     {
         const mp4mux_edit_t *p_lastedit = &p_realloc[p_stream->mux.i_edits_count - 1];
-        p_newedit->i_start_time = p_lastedit->i_start_time + p_lastedit->i_duration;
+        p_newedit->i_start_time = __MAX(0, p_lastedit->i_start_time + p_lastedit->i_duration);
         p_newedit->i_start_offset = 0;
     }
 



More information about the vlc-commits mailing list