Revert "Revert "Propagate error from worker to main thread during lf MT""

This reverts commit 5f8db64abce68a3698fb732697ae50880bc9cac4.

Reason for revert: Re-submit with the fix for oss-fuzz:61802.

Reset 'worker->had_error' inside loop_filter_rows_mt().

Bug: oss-fuzz:61802
Bug: aomedia:3276
Change-Id: Ibbea95e4d8826ca9129c9768d0e09c6628480eb2
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 3b601d0..045a1a0 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -538,8 +538,8 @@
     av1_thread_loop_filter_rows(
         lf_data->frame_buffer, lf_data->cm, lf_data->planes, lf_data->xd,
         cur_job_info->mi_row, cur_job_info->plane, cur_job_info->dir,
-        lpf_opt_level, lf_sync, lf_data->params_buf, lf_data->tx_buf,
-        mib_size_log2);
+        lpf_opt_level, lf_sync, &thread_data->error_info, lf_data->params_buf,
+        lf_data->tx_buf, mib_size_log2);
   }
 }
 
@@ -583,6 +583,7 @@
   (void)unused;
 
   struct aom_internal_error_info *const error_info = &thread_data->error_info;
+  AV1LfSync *const lf_sync = thread_data->lf_sync;
   MACROBLOCKD *const xd = &thread_data->td->mb.e_mbd;
   xd->error_info = error_info;
 
@@ -600,6 +601,16 @@
     pthread_mutex_unlock(enc_row_mt_mutex_);
 #endif
     set_encoding_done(cpi);
+
+    if (cpi->mt_info.pipeline_lpf_mt_with_enc) {
+#if CONFIG_MULTITHREAD
+      pthread_mutex_lock(lf_sync->job_mutex);
+      lf_sync->lf_mt_exit = true;
+      pthread_mutex_unlock(lf_sync->job_mutex);
+#endif
+      av1_set_vert_loop_filter_done(&cpi->common, lf_sync,
+                                    cpi->common.seq_params->mib_size_log2);
+    }
     return 0;
   }
   error_info->setjmp = 1;