diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 044be6bfe9..4d08642779 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2267,6 +2267,7 @@ static void flush_dpb(AVCodecContext *avctx){
     h->s.first_field= 0;
     ff_h264_reset_sei(h);
     ff_mpeg_flush(avctx);
+    h->recovery_frame= -1;
     h->sync= 0;
 }