From bf663ef1b0cdf01d8fd4c02ae66258057cc66b5d Mon Sep 17 00:00:00 2001
From: zhongqinxuan <zhongqinxuan@allwinnertech.com>
Date: Thu, 15 Jan 2026 10:54:20 +0800
Subject: [PATCH] fix deadlock bug due to insufficient buffer in repair
 request.

---
  sys/v4l2/gstv4l2object.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index ee699fb..9450c9f 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -4989,6 +4989,12 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
      * frame. */
     own_min = min + obj->min_buffers + 2;
 
+    if (own_min < 4) {
+        GST_WARNING_OBJECT (obj->element, "Calculated own_min=%d is too low, forcing to 4 to prevent driver starvation", own_min);
+        own_min = 4;
+    }
+    GST_INFO_OBJECT (obj->element, "Allocation decision: downstream min=%d, driver min=%d -> own_min=%d", min, obj->min_buffers, own_min);
+
     /* If no allocation parameters where provided, allow for a little more
      * buffers and enable copy threshold */
     if (!update) {
-- 
2.25.1

