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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-03 00:48:29 +02:00
parent 21e40f006a
commit 02915602d9
1 changed files with 4 additions and 0 deletions

View File

@ -254,6 +254,10 @@ av_cold int swr_init(struct SwrContext *s){
if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){ 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); 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 }else
s->resampler->free(&s->resample); s->resampler->free(&s->resample);
if( s->int_sample_fmt != AV_SAMPLE_FMT_S16P if( s->int_sample_fmt != AV_SAMPLE_FMT_S16P