summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-14 23:58:10 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-14 23:58:10 +0100
commite462257242fc037c99206457d1316e1ff9e5306f (patch)
tree045910517a8b587f7a016b1c46403e1d1021f4f2 /libavcodec/mpegvideo.c
parenta1be5bc79d7ac4c7c7ed79c4d72b4f1945ecb55c (diff)
parent115a57302a7d6661426304bec3a5bc72d0edf4b0 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits) applehttp: Properly clean up if unable to probe a segment applehttp: Avoid reading uninitialized memory fate: Replace misleading "aac" in the name of an ADTS test with "adts". fate: Drop pointless "-an" from pictor test command. fate: split off image codec FATE tests into their own file fate: split off WMA codec FATE tests into their own file fate: split off lossless video and audio FATE tests into their own files fate: split off qtrle codec FATE tests into their own file fate: split off Ut Video codec FATE tests into their own file fate: split off screen codec FATE tests into their own file fate: split off Real Inc. codec FATE tests into their own file fate: split off AC-3 codec FATE tests into their own file mpegvideo: remove abort() in ff_find_unused_picture() rv40: NEON optimised loop filter strength selection rv40: rearrange loop filter functions configure: cosmetics: sort some lists where appropriate swscale_mmx: drop no longer required parameters from VSCALEX macros swscale: Mark yuv2planeX_8_mmx as MMX2; it contains MMX2 instructions. build: conditionally compile x86 H.264 chroma optimizations v410 encoder and decoder ... Conflicts: Changelog configure doc/developer.texi doc/general.texi libavcodec/arm/asm.S libavcodec/avcodec.h libavcodec/v410dec.c libavcodec/v410enc.c libavcodec/version.h libavcodec/x86/Makefile libavcodec/x86/dsputil_mmx.c libswscale/x86/swscale_mmx.c tests/Makefile tests/fate2.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 2b792642c5..8924046dc4 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1095,21 +1095,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){
@@ -1167,6 +1153,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];
}
@@ -1222,6 +1210,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];
s->last_picture_ptr->f.key_frame = 0;
if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
@@ -1238,6 +1228,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];
s->next_picture_ptr->f.key_frame = 0;
if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)