[vlc-commits] mux:ts: simplify code

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


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

mux:ts: simplify code

Compute the buffer duration only once.

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

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

diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index b77c38b06c..d7a6a59334 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1652,11 +1652,12 @@ static block_t *FixPES( sout_mux_t *p_mux, block_fifo_t *p_fifo )
         i_copy = __MIN( STD_PES_PAYLOAD - i_size, p_next->i_buffer );
 
         memcpy( &p_data->p_buffer[i_size], p_next->p_buffer, i_copy );
+        vlc_tick_t offset = p_next->i_length * i_copy / p_next->i_buffer;
         if( p_next->i_pts )
-            p_next->i_pts += p_next->i_length * i_copy / p_next->i_buffer;
+            p_next->i_pts += offset;
         if( p_next->i_dts )
-            p_next->i_dts += p_next->i_length * i_copy / p_next->i_buffer;
-        p_next->i_length -= p_next->i_length * i_copy / p_next->i_buffer;
+            p_next->i_dts += offset;
+        p_next->i_length -= offset;
         p_next->i_buffer -= i_copy;
         p_next->p_buffer += i_copy;
         p_next->i_flags |= BLOCK_FLAG_NO_KEYFRAME;



More information about the vlc-commits mailing list