OSDN Git Service

swr: check that the context for swr_convert() has been initialized
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Feb 2014 21:29:51 +0000 (22:29 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 24 Feb 2014 07:23:42 +0000 (08:23 +0100)
Reviewed-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/swresample.c

index e11826e..54e06e1 100644 (file)
@@ -742,6 +742,11 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
     AudioData * in= &s->in;
     AudioData *out= &s->out;
 
+    if (!swr_is_initialized(s)) {
+        av_log(s, AV_LOG_ERROR, "Context has not been initialized\n");
+        return AVERROR(EINVAL);
+    }
+
     while(s->drop_output > 0){
         int ret;
         uint8_t *tmp_arg[SWR_CH_MAX];