[FFmpeg-cvslog] aresample: check return code of swr_convert()

Michael Niedermayer git at videolan.org
Thu May 17 22:47:58 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu May 17 22:38:34 2012 +0200| [b3e1b95afaff7ed53baef2d193e0968cade7e94b] | committer: Michael Niedermayer

aresample: check return code of swr_convert()

Issue found by comparing af_resample.c and af_aresample.c

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavfilter/af_aresample.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index dde79e2..8e616e2 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -169,6 +169,11 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref
 
     n_out = swr_convert(aresample->swr, outsamplesref->data, n_out,
                                  (void *)insamplesref->data, n_in);
+    if (n_out <= 0) {
+        avfilter_unref_buffer(outsamplesref);
+        avfilter_unref_buffer(insamplesref);
+        return;
+    }
 
     avfilter_copy_buffer_ref_props(outsamplesref, insamplesref);
     outsamplesref->audio->sample_rate = outlink->sample_rate;



More information about the ffmpeg-cvslog mailing list