diff options
author | Andrey Utkin <andrey.krieger.utkin@gmail.com> | 2011-12-08 13:56:29 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2011-12-14 18:17:21 +0100 |
commit | 4f820131fa9fbb0a64d7cc469fa471905fc91944 (patch) | |
tree | 7c291b220f142617c22de3c4d89c8c2fd4b4bc06 /libavcodec/mpegvideo.c | |
parent | 71ce76027d9df47f4ac80c2c114b47d51243ed8e (diff) | |
download | ffmpeg-4f820131fa9fbb0a64d7cc469fa471905fc91944.tar.gz |
mpegvideo: remove abort() in ff_find_unused_picture()
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index a874548680..ab57b51e87 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1144,21 +1144,7 @@ int ff_find_unused_picture(MpegEncContext *s, int shared) } } - av_log(s->avctx, AV_LOG_FATAL, - "Internal error, picture buffer overflow\n"); - /* We could return -1, but the codec would crash trying to draw into a - * non-existing frame anyway. This is safer than waiting for a random crash. - * Also the return of this is never useful, an encoder must only allocate - * as much as allowed in the specification. This has no relationship to how - * much libavcodec could allocate (and MAX_PICTURE_COUNT is always large - * enough for such valid streams). - * Plus, a decoder has to check stream validity and remove frames if too - * many reference frames are around. Waiting for "OOM" is not correct at - * all. Similarly, missing reference frames have to be replaced by - * interpolated/MC frames, anything else is a bug in the codec ... - */ - abort(); - return -1; + return AVERROR_INVALIDDATA; } static void update_noise_reduction(MpegEncContext *s){ @@ -1216,6 +1202,8 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) pic= s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header) else{ i= ff_find_unused_picture(s, 0); + if (i < 0) + return i; pic= &s->picture[i]; } @@ -1271,6 +1259,8 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* Allocate a dummy frame */ i= ff_find_unused_picture(s, 0); + if (i < 0) + return i; s->last_picture_ptr= &s->picture[i]; if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) return -1; @@ -1280,6 +1270,8 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) if ((s->next_picture_ptr == NULL || s->next_picture_ptr->f.data[0] == NULL) && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ i= ff_find_unused_picture(s, 0); + if (i < 0) + return i; s->next_picture_ptr= &s->picture[i]; if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) return -1; |