Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git] / ffmpeg / libswresample / resample.c
index 2a8aa7e2d0f0b90a4baf60c6591eb5beb37a2c6c..d0f6e2078820a9ebba5ea6fc3367bc4e55b00db4 100644 (file)
@@ -399,11 +399,11 @@ static int invert_initial_buffer(ResampleContext *c, AudioData *dst, const Audio
 
     res = num - *out_sz;
     *out_idx = c->filter_length + (c->index >> c->phase_shift);
-    *out_sz = 1 + c->filter_length * 2 - *out_idx;
+    *out_sz = FFMAX(*out_sz + c->filter_length,
+                    1 + c->filter_length * 2) - *out_idx;
     c->index &= c->phase_mask;
-    av_assert1(res > 0);
 
-    return res;
+    return FFMAX(res, 0);
 }
 
 struct Resampler const swri_resampler={