diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-11-28 10:54:35 +0100 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2014-05-31 20:05:19 -0400 |
commit | 07558d0b9fa0923e8b53f6eb7f2b69c4d631f11a (patch) | |
tree | 8310a7d0000026afd539e8922f403a5876dade9a /libavcodec | |
parent | 27ac9585c97d35b809382be5634c8e5f7211243a (diff) | |
download | ffmpeg-07558d0b9fa0923e8b53f6eb7f2b69c4d631f11a.tar.gz |
mpegvideo: set reference/pict_type on generated reference frames
Otherwise the generic code will unref them, which can then result in
last_picture_ptr == current_picture_ptr, which causes deadlocks at least
in rv40.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 8df3061174..f3e2c12911 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1269,6 +1269,10 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); s->last_picture_ptr = &s->picture[i]; + + s->last_picture_ptr->f.reference = 3; + s->last_picture_ptr->f.pict_type = AV_PICTURE_TYPE_I; + if (ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) return -1; ff_thread_report_progress((AVFrame *) s->last_picture_ptr, @@ -1282,6 +1286,10 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); s->next_picture_ptr = &s->picture[i]; + + s->next_picture_ptr->f.reference = 3; + s->next_picture_ptr->f.pict_type = AV_PICTURE_TYPE_I; + if (ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) return -1; ff_thread_report_progress((AVFrame *) s->next_picture_ptr, |