diff options
author | van <[email protected]> | 2008-08-18 06:07:19 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-08-18 06:07:19 +0000 |
commit | fb73802e00132d407e9f00dd1a3a9535e651cdc6 (patch) | |
tree | d67038f44099b11c36c98e0906963e6c03fed875 /contrib/patch-ffmpeg-mpegleak.patch | |
parent | 7628e62c73fc0010c29647bb8fcb7471e368aa5e (diff) |
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
Diffstat (limited to 'contrib/patch-ffmpeg-mpegleak.patch')
-rw-r--r-- | contrib/patch-ffmpeg-mpegleak.patch | 25 |
1 files 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; i<MAX_PICTURE_COUNT; i++){ - if(s->picture[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; i<MAX_PICTURE_COUNT; i++){ - if(s->picture[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; i<MAX_PICTURE_COUNT; i++){ + if (s->picture[i].coded_picture_number < s->picture[oldest].coded_picture_number) |