lavc/utils: check return value of avcodec_fill_audio_frame() for < 0
authorStefano Sabatini <stefasab@gmail.com>
Sun, 25 Nov 2012 18:47:54 +0000 (19:47 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Sun, 25 Nov 2012 19:34:01 +0000 (20:34 +0100)
Assume that the value is always negative in case of error, as stated in
the docs, do not assume that the value cannot be != 0 in case of success.

libavcodec/utils.c

index 4749d73..6a5c735 100644 (file)
@@ -418,7 +418,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
         }
         if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
                                             avctx->sample_fmt, buf->data[0],
-                                            buf->audio_data_size, 0)))
+                                            buf->audio_data_size, 0)) < 0)
             return ret;
 
         if (frame->extended_data == frame->data)
@@ -1383,7 +1383,7 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
         if ((ret = avcodec_fill_audio_frame(frame, avctx->channels,
                                             avctx->sample_fmt,
                                             (const uint8_t *)samples,
-                                            samples_size, 1)))
+                                            samples_size, 1)) < 0)
             return ret;
 
         /* fabricate frame pts from sample count.