Making it fail if e.g. soxr is used makes the function completely
useless.
---
 libswresample/swresample.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 9ab29d6..0ef556a 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -852,9 +852,13 @@ int swr_get_out_samples(struct SwrContext *s, int 
in_samples)
         return AVERROR(EINVAL);
 
     if (s->resampler && s->resample) {
-        if (!s->resampler->get_out_samples)
-            return AVERROR(ENOSYS);
-        out_samples = s->resampler->get_out_samples(s, in_samples);
+        if (s->resampler->get_out_samples) {
+            out_samples = s->resampler->get_out_samples(s, in_samples);
+        } else {
+            out_samples = av_rescale_rnd(in_samples, s->out_sample_rate,
+                                         s->in_sample_rate, AV_ROUND_UP) +
+                          swr_get_delay(s, s->out_sample_rate);
+        }
     } else {
         out_samples = s->in_buffer_count + in_samples;
         av_assert0(s->out_sample_rate == s->in_sample_rate);
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to