[vlc-commits] mux:ts: simplify code

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 13 09:58:59 2018 +0200| [d91824a48c9a0151982cfb8260f86266fc1d5f70] | committer: Steve Lhomme

mux:ts: simplify code

only compute the packet length once

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

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

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index bac4d2e31b..b77c38b06c 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1533,13 +1533,13 @@ static bool MuxStreams(sout_mux_t *p_mux )
 
         /* do we need to issue pcr */
         bool b_pcr = false;
+        vlc_tick_t packet_length = i_pcr_length * i_packet_pos / i_packet_count;
         if( p_stream == p_pcr_stream &&
-            i_pcr_dts + i_packet_pos * i_pcr_length / i_packet_count >=
+            i_pcr_dts + packet_length >=
             p_sys->i_pcr + p_sys->i_pcr_delay )
         {
             b_pcr = true;
-            p_sys->i_pcr = i_pcr_dts + i_packet_pos *
-                i_pcr_length / i_packet_count;
+            p_sys->i_pcr = i_pcr_dts + packet_length;
         }
 
         /* Build the TS packet */



More information about the vlc-commits mailing list