From fba6777363eb74d926aa0eed281a77ff152a3ad5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 31 Dec 2011 22:15:45 +0100 Subject: [PATCH] h264: Fix recovery_frame initialization when recovery_frame is -1 Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index b0c5049483..27240e00d9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3896,7 +3896,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ break; if ( h->sei_recovery_frame_cnt >= 0 - && ((h->recovery_frame - h->frame_num) & ((1 << h->sps.log2_max_frame_num)-1)) > h->sei_recovery_frame_cnt) { + && ( h->recovery_frame<0 + || ((h->recovery_frame - h->frame_num) & ((1 << h->sps.log2_max_frame_num)-1)) > h->sei_recovery_frame_cnt)) { h->recovery_frame = (h->frame_num + h->sei_recovery_frame_cnt) % (1 << h->sps.log2_max_frame_num); }