[MPlayer-cvslog] r37204 - trunk/libaf/af_scaletempo.c

reimar subversion at mplayerhq.hu
Sun May 18 18:43:35 CEST 2014


Author: reimar
Date: Sun May 18 18:43:34 2014
New Revision: 37204

Log:
scaletempo: add hack for smoother speed changes.

Modified:
   trunk/libaf/af_scaletempo.c

Modified: trunk/libaf/af_scaletempo.c
==============================================================================
--- trunk/libaf/af_scaletempo.c	Sat May 17 03:38:00 2014	(r37203)
+++ trunk/libaf/af_scaletempo.c	Sun May 18 18:43:34 2014	(r37204)
@@ -333,6 +333,7 @@ static int control(struct af_instance_s*
       s->samples_standing = s->bytes_standing / bps;
       s->output_overlap   = NULL;
     } else {
+      int old_overlap = s->bytes_overlap;
       s->samples_overlap  = frames_overlap * nch;
       s->bytes_overlap    = frames_overlap * nch * bps;
       s->bytes_standing   = s->bytes_stride - s->bytes_overlap;
@@ -343,7 +344,10 @@ static int control(struct af_instance_s*
         mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
         return AF_ERROR;
       }
-      memset(s->buf_overlap, 0, s->bytes_overlap);
+      // not necessarily correct, but keeping old data if possible
+      // avoids clicks when changing speed.
+      if (s->bytes_overlap != old_overlap)
+        memset(s->buf_overlap, 0, s->bytes_overlap);
       if (use_int) {
         int32_t* pb = s->table_blend;
         int64_t blend = 0;


More information about the MPlayer-cvslog mailing list