1 Index: libavcodec/mpegvideo.c
2 ===================================================================
3 --- ffmpeg.orig/libavcodec/mpegvideo.c (revision 20594)
4 +++ ffmpeg/libavcodec/mpegvideo.c (working copy)
8 av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n");
9 - /* We could return -1, but the codec would crash trying to draw into a
10 - * non-existing frame anyway. This is safer than waiting for a random crash.
11 - * Also the return of this is never useful, an encoder must only allocate
12 - * as much as allowed in the specification. This has no relationship to how
13 - * much libavcodec could allocate (and MAX_PICTURE_COUNT is always large
14 - * enough for such valid streams).
15 - * Plus, a decoder has to check stream validity and remove frames if too
16 - * many reference frames are around. Waiting for "OOM" is not correct at
17 - * all. Similarly, missing reference frames have to be replaced by
18 - * interpolated/MC frames, anything else is a bug in the codec ...
22 + /* XXX there seems to be a leak caused by h264 in mpeg transport
23 + * streams: Over-the-air streams have a lot of errors. A picture
24 + * may be marked as referenced but the actual references get lost
25 + * so it never gets released. We take care of that here by releasing
26 + * the oldest we have & reusing its slot. */
28 + for(i=0; i<MAX_PICTURE_COUNT; i++){
29 + if (s->picture[i].coded_picture_number < s->picture[oldest].coded_picture_number)
32 + s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[oldest]);
36 static void update_noise_reduction(MpegEncContext *s){
37 Index: libavcodec/h264.c
38 ===================================================================
39 --- ffmpeg.orig/libavcodec/h264.c (revision 20594)
40 +++ ffmpeg/libavcodec/h264.c (working copy)
42 * stream. Need to discard one frame. Prevents overrun of the
43 * short_ref and long_ref buffers.
45 - av_log(h->s.avctx, AV_LOG_ERROR,
46 + av_log(h->s.avctx, AV_LOG_DEBUG,
47 "number of reference frames exceeds max (probably "
48 "corrupt input), discarding one\n");
52 if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
53 if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
54 - av_log(avctx, AV_LOG_ERROR, "no frame!\n");
55 + av_log(avctx, AV_LOG_DEBUG, "no frame!\n");