aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vvc/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/vvc/thread.c')
-rw-r--r--libavcodec/vvc/thread.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/vvc/thread.c b/libavcodec/vvc/thread.c
index 74f8e4e9d0..86a7753c6a 100644
--- a/libavcodec/vvc/thread.c
+++ b/libavcodec/vvc/thread.c
@@ -466,12 +466,16 @@ static void report_frame_progress(VVCFrameContext *fc,
y = old = ft->row_progress[idx];
while (y < ft->ctu_height && atomic_load(&ft->rows[y].col_progress[idx]) == ft->ctu_width)
y++;
+ if (old != y)
+ ft->row_progress[idx] = y;
+ // ff_vvc_report_progress will acquire other frames' locks, which could lead to a deadlock
+ // We need to unlock ft->lock first
+ ff_mutex_unlock(&ft->lock);
+
if (old != y) {
const int progress = y == ft->ctu_height ? INT_MAX : y * ctu_size;
- ft->row_progress[idx] = y;
ff_vvc_report_progress(fc->ref, idx, progress);
}
- ff_mutex_unlock(&ft->lock);
}
}