diff options
Diffstat (limited to 'src/libmpeg2/decode.c')
-rw-r--r-- | src/libmpeg2/decode.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 866a7b1b0..4778fe55a 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -183,12 +183,14 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (picture->mpeg1) picture->current_frame->pts = 0; - mpeg2dec->frames_to_drop = picture->current_frame->draw (picture->current_frame); + if( !picture->current_frame->drawn ) + mpeg2dec->frames_to_drop = picture->current_frame->draw (picture->current_frame); picture->current_frame->drawn = 1; - /* frame must not be freed if we still have a copy of it */ - if( picture->current_frame != picture->backward_reference_frame ) - picture->current_frame->free (picture->current_frame); + if( picture->current_frame == picture->backward_reference_frame ) + picture->backward_reference_frame = NULL; + + picture->current_frame->free (picture->current_frame); picture->current_frame = NULL; picture->throwaway_frame = NULL; |