swr: fix handling of timestamps that cause multiple drops or silence injections
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Jan 2013 17:39:06 +0000 (18:39 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 13 Jan 2013 17:39:06 +0000 (18:39 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/swresample.c

index 1942302..ad33467 100644 (file)
@@ -873,7 +873,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts){
     if(s->min_compensation >= FLT_MAX) {
         return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate));
     } else {
-        int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts;
+        int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts + s->drop_output*(int64_t)s->in_sample_rate;
         double fdelta = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate);
 
         if(fabs(fdelta) > s->min_compensation) {