[FFmpeg-cvslog] msrle: return meaningful error codes.

Anton Khirnov git at videolan.org
Mon Jan 14 14:49:06 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Nov 17 17:48:38 2012 +0100| [9e6764900a0732a4719ca219ceb59a4ae9d9be3b] | committer: Anton Khirnov

msrle: return meaningful error codes.

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

 libavcodec/msrle.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index 7cd8823..7bca67f 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -63,7 +63,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
         break;
     default:
         av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     s->frame.data[0] = NULL;
@@ -79,15 +79,16 @@ static int msrle_decode_frame(AVCodecContext *avctx,
     int buf_size = avpkt->size;
     MsrleContext *s = avctx->priv_data;
     int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
+    int ret;
 
     s->buf = buf;
     s->size = buf_size;
 
     s->frame.reference = 1;
     s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
+    if ((ret = avctx->reget_buffer(avctx, &s->frame)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
+        return ret;
     }
 
     if (avctx->bits_per_coded_sample <= 8) {



More information about the ffmpeg-cvslog mailing list