[vlc-commits] modules: more use of vlc_tick_from_samples()

Steve Lhomme git at videolan.org
Tue Sep 25 12:19:46 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 25 10:33:31 2018 +0200| [87a2e6c0cbfbe2ff7a310d646c992963cae7bb79] | committer: Steve Lhomme

modules: more use of vlc_tick_from_samples()

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

 modules/codec/fdkaac.c      | 11 +++++------
 modules/mux/mp4/libmp4mux.c |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/codec/fdkaac.c b/modules/codec/fdkaac.c
index 6bdc9ebeb0..e0b3088c4a 100644
--- a/modules/codec/fdkaac.c
+++ b/modules/codec/fdkaac.c
@@ -412,12 +412,11 @@ static block_t *EncodeAudio(encoder_t *p_enc, block_t *p_aout_buf)
                     p_block->i_nb_samples = d_samples_delay;
                     //p_block->i_length = i_pts_out - p_sys->i_pts_last;
                 } else {
-                    double d_samples_forward = (double)out_args.numInSamples/(double)p_enc->fmt_in.audio.i_channels;
-                    double d_length = ((double)CLOCK_FREQ * d_samples_forward /
-                                            (double)p_enc->fmt_out.audio.i_rate);
-                    i_pts_out += (vlc_tick_t) d_length;
-                    p_block->i_length = (vlc_tick_t) d_length;
-                    p_block->i_nb_samples = d_samples_forward;
+                    vlc_tick_t d_length = vlc_tick_from_samples(out_args.numInSamples,
+                                                    p_enc->fmt_out.audio.i_rate * p_enc->fmt_in.audio.i_channels);
+                    i_pts_out += d_length;
+                    p_block->i_length = d_length;
+                    p_block->i_nb_samples = out_args.numInSamples / p_enc->fmt_in.audio.i_channels;
                 }
             }
             p_block->i_dts = p_block->i_pts = i_pts_out;
diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index bf2220f68c..664516b2ee 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -1289,7 +1289,7 @@ static bo_t *GetStblBox(vlc_object_t *p_obj, mp4mux_trackinfo_t *p_track, bool b
     bo_swap_32be(stts, 12, i_index);
 
     //msg_Dbg(p_obj, "total sout duration %"PRId64" reconverted from scaled %"PRId64,
-    //                i_total_mtime, i_total_scaled * CLOCK_FREQ / p_track->i_timescale );
+    //                i_total_mtime, vlc_tick_from_samples(i_total_scaled, p_track->i_timescale) );
 
     /* composition time handling */
     bo_t *ctts = NULL;



More information about the vlc-commits mailing list