[FFmpeg-cvslog] swresample: Check the return value of resampler->init()

Michael Niedermayer git at videolan.org
Tue Jul 28 03:21:16 CEST 2015


ffmpeg | branch: release/2.5 | Michael Niedermayer <michaelni at gmx.at> | Wed Jun  3 00:48:29 2015 +0200| [fd989ff9ca4dfe3fb9b5b41737740d58b6c5a873] | committer: Michael Niedermayer

swresample: Check the return value of resampler->init()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 02915602d9313aa4b108342a3081244b9d2422bf)

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

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

 libswresample/swresample.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index a29dc62..c5ac1b3 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -255,6 +255,10 @@ av_cold int swr_init(struct SwrContext *s){
 
     if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
         s->resample = s->resampler->init(s->resample, s->out_sample_rate, s->in_sample_rate, s->filter_size, s->phase_shift, s->linear_interp, s->cutoff, s->int_sample_fmt, s->filter_type, s->kaiser_beta, s->precision, s->cheby);
+        if (!s->resample) {
+            av_log(s, AV_LOG_ERROR, "Failed to initilaize resampler\n");
+            return AVERROR(ENOMEM);
+        }
     }else
         s->resampler->free(&s->resample);
     if(    s->int_sample_fmt != AV_SAMPLE_FMT_S16P



More information about the ffmpeg-cvslog mailing list