diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index f18fb0b76503976b9653ea9e563403052d14093b..665d3e46a51a866cad8c4ee579f19139192533cd 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -680,11 +680,11 @@ again:
                 break;
 
             if (h->current_slice == 1) {
-            if (avctx->active_thread_type & FF_THREAD_FRAME && !h->avctx->hwaccel &&
-                i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) {
-                ff_thread_finish_setup(avctx);
-                h->setup_finished = 1;
-            }
+                if (avctx->active_thread_type & FF_THREAD_FRAME && !h->avctx->hwaccel &&
+                    i >= nals_needed && !h->setup_finished && h->cur_pic_ptr) {
+                    ff_thread_finish_setup(avctx);
+                    h->setup_finished = 1;
+                }
 
                 if (h->avctx->hwaccel &&
                     (ret = h->avctx->hwaccel->start_frame(h->avctx, buf, buf_size)) < 0)