From fb73802e00132d407e9f00dd1a3a9535e651cdc6 Mon Sep 17 00:00:00 2001 From: van Date: Mon, 18 Aug 2008 06:07:19 +0000 Subject: If we try to release old frames in the loop that searches for a free one we may free one that's in use & crash in avcodec_default_release_buffer. (Bug tracked down by eddyg). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1641 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- contrib/patch-ffmpeg-mpegleak.patch | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/contrib/patch-ffmpeg-mpegleak.patch b/contrib/patch-ffmpeg-mpegleak.patch index 88538922f..74907258b 100644 --- a/contrib/patch-ffmpeg-mpegleak.patch +++ b/contrib/patch-ffmpeg-mpegleak.patch @@ -24,23 +24,7 @@ Index: libavcodec/mpegvideo.c =================================================================== --- libavcodec/mpegvideo.c (revision 14820) +++ libavcodec/mpegvideo.c (working copy) -@@ -772,6 +772,15 @@ - }else{ - for(i=0; ipicture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME -+ /* XXX there seems to be a leak caused by h264 in mpeg transport -+ * streams: Over-the-air streams have a lot of errors. A picture -+ * may be marked as referenced but the actual references get lost -+ * so it never gets released. We take care of that here by purging -+ * pictures that are impossibly old. -+ */ -+ if (s->coded_picture_number - s->picture[i].coded_picture_number > -+ 32*MAX_PICTURE_COUNT) -+ s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]); - } - for(i=0; ipicture[i].data[0]==NULL) return i; -@@ -779,19 +788,15 @@ +@@ -779,19 +779,18 @@ } av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); @@ -57,8 +41,11 @@ Index: libavcodec/mpegvideo.c - */ - abort(); - return -1; -+ /* assume that we don't have a picture because of the leak described above. -+ * just release the oldest we have & reuse its slot. */ ++ /* XXX there seems to be a leak caused by h264 in mpeg transport ++ * streams: Over-the-air streams have a lot of errors. A picture ++ * may be marked as referenced but the actual references get lost ++ * so it never gets released. We take care of that here by releasing ++ * the oldest we have & reusing its slot. */ + int oldest=0; + for(i=0; ipicture[i].coded_picture_number < s->picture[oldest].coded_picture_number) -- cgit v1.2.3