diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index 9730e12..f280dff 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -992,9 +992,13 @@ dpb_add(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
 
     // C.4.5.1 - Storage and marking of a reference decoded picture into the DPB
     if (GST_VAAPI_PICTURE_IS_REFERENCE(picture)) {
+        guint t = 0;
         while (priv->dpb_count == priv->dpb_size) {
+            ++t;
             if (!dpb_bump(decoder, picture))
                 return FALSE;
+            if (t >= 50)
+                return TRUE;
         }
     }
 
@@ -1007,7 +1011,10 @@ dpb_add(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
                 GST_VAAPI_PICTURE_FLAG_INTER_VIEW);
         if (!picture->output_flag && !StoreInterViewOnlyRefFlag)
             return TRUE;
+
+        guint t = 0;
         while (priv->dpb_count == priv->dpb_size) {
+            ++t;
             GstVaapiPictureH264 *found_picture;
             if (!StoreInterViewOnlyRefFlag) {
                 if (dpb_find_lowest_poc(decoder, picture, &found_picture) < 0 ||
@@ -1016,6 +1023,8 @@ dpb_add(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
             }
             if (!dpb_bump(decoder, picture))
                 return FALSE;
+            if (t >= 50)
+                return TRUE;
         }
     }
     gst_vaapi_frame_store_replace(&priv->dpb[priv->dpb_count++], fs);
@@ -1510,7 +1519,7 @@ decode_current_picture(GstVaapiDecoderH264 *decoder)
 error:
     /* XXX: fix for cases where first field failed to be decoded */
     gst_vaapi_picture_replace(&priv->current_picture, NULL);
-    return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
+    // return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
 
 drop_frame:
     priv->decoder_state = 0;
