summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-11 20:19:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-12 03:23:53 +0100
commit9e73f6d1f9a242ea0b2fdb3bf22890d2a4422be0 (patch)
tree08cecd723315ec6ce4d239b3c2bb86befe14ca36 /libavcodec/mpegvideo.c
parent9dd0b7ad821ae1b60acd9ac8f6384c03bd28be51 (diff)
mpegvideo: dont allow last == current
this fixes deadlocks Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 0628f58c06..9fe93bf4ab 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1434,6 +1434,8 @@ static inline int pic_is_unused(MpegEncContext *s, Picture *pic)
&& pic->f.qscale_table //check if the frame has anything allocated
&& pic->period_since_free < s->avctx->thread_count)
return 0;
+ if (pic == s->last_picture_ptr)
+ return 0;
if (pic->f.data[0] == NULL)
return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
@@ -1447,7 +1449,7 @@ static int find_unused_picture(MpegEncContext *s, int shared)
if (shared) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
- if (s->picture[i].f.data[0] == NULL)
+ if (s->picture[i].f.data[0] == NULL && &s->picture[i] != s->last_picture_ptr)
return i;
}
} else {