[vlc-commits] mux:ts: simplify test

Steve Lhomme git at videolan.org
Tue Sep 18 15:55:51 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 13 09:56:35 2018 +0200| [00bc4892df4ea874c3b770210e8caf67d2c99c6c] | committer: Steve Lhomme

mux:ts: simplify test

The i_frag can be computed first.

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

 modules/mux/mpeg/ts.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index 152cea5248..bac4d2e31b 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1474,11 +1474,10 @@ static bool MuxStreams(sout_mux_t *p_mux )
              p_pes = p_pes->p_next )
         {
             int i_size = p_pes->i_buffer;
-            if( p_pes->i_dts + p_pes->i_length >
-                p_pcr_stream->state.i_pes_dts + p_pcr_stream->state.i_pes_length )
+            vlc_tick_t i_frag = p_pcr_stream->state.i_pes_dts +
+                             p_pcr_stream->state.i_pes_length - p_pes->i_dts;
+            if( p_pes->i_length > i_frag )
             {
-                vlc_tick_t i_frag = p_pcr_stream->state.i_pes_dts +
-                    p_pcr_stream->state.i_pes_length - p_pes->i_dts;
                 if( i_frag < 0 )
                 {
                     /* Next stream */



More information about the vlc-commits mailing list