Commit 9e73f6d1 authored by Michael Niedermayer's avatar Michael Niedermayer

mpegvideo: dont allow last == current

this fixes deadlocks
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 9dd0b7ad
...@@ -1434,6 +1434,8 @@ static inline int pic_is_unused(MpegEncContext *s, Picture *pic) ...@@ -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->f.qscale_table //check if the frame has anything allocated
&& pic->period_since_free < s->avctx->thread_count) && pic->period_since_free < s->avctx->thread_count)
return 0; return 0;
if (pic == s->last_picture_ptr)
return 0;
if (pic->f.data[0] == NULL) if (pic->f.data[0] == NULL)
return 1; return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
...@@ -1447,7 +1449,7 @@ static int find_unused_picture(MpegEncContext *s, int shared) ...@@ -1447,7 +1449,7 @@ static int find_unused_picture(MpegEncContext *s, int shared)
if (shared) { if (shared) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) { 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; return i;
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment