[FFmpeg-cvslog] asyncts: reset delta to 0 when it's not used.

Anton Khirnov git at videolan.org
Wed May 23 22:00:57 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue May 22 20:44:07 2012 +0200| [f297dd3812510fc83080e265dc4534a3898005b0] | committer: Anton Khirnov

asyncts: reset delta to 0 when it's not used.

Fixes an invalid write.

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

 libavfilter/af_asyncts.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 5cde0bf..adb5347 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -182,10 +182,13 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
     if (labs(delta) > s->min_delta) {
         av_log(ctx, AV_LOG_VERBOSE, "Discontinuity - %"PRId64" samples.\n", delta);
         out_size += delta;
-    } else if (s->resample) {
-        int comp = av_clip(delta, -s->max_comp, s->max_comp);
-        av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp);
-        avresample_set_compensation(s->avr, delta, inlink->sample_rate);
+    } else {
+        if (s->resample) {
+            int comp = av_clip(delta, -s->max_comp, s->max_comp);
+            av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp);
+            avresample_set_compensation(s->avr, delta, inlink->sample_rate);
+        }
+        delta = 0;
     }
 
     if (out_size > 0) {



More information about the ffmpeg-cvslog mailing list