C2BqBuffer: Reduce the retry count in case of dequeue-timeout

Handle android::TIMED_OUT error from igbp->dequeue.
Reduce the retry count to ensure fetchGraphicBlock() does not
block for too long

Bug: 120466624
Test: play 4k playback

Change-Id: I17977346dca24e13e87811430efa7f30b2ac2ea3
(cherry picked from commit 5da47df79750f8780a61c1da9d2acf56a7476022)
diff --git a/codec2/vndk/platform/C2BqBuffer.cpp b/codec2/vndk/platform/C2BqBuffer.cpp
index 7bf3d64..2ea4abe 100644
--- a/codec2/vndk/platform/C2BqBuffer.cpp
+++ b/codec2/vndk/platform/C2BqBuffer.cpp
@@ -207,12 +207,14 @@
         // dequeueBuffer returns flag.
         if (!transStatus.isOk() || status < android::OK) {
             ALOGD("cannot dequeue buffer %d", status);
-            if (transStatus.isOk() && status == android::INVALID_OPERATION) {
-              // Too many buffer dequeued. retrying after some time is required.
-              return C2_TIMED_OUT;
-            } else {
-              return C2_BAD_VALUE;
+            if (transStatus.isOk()) {
+                if (status == android::INVALID_OPERATION ||
+                    status == android::TIMED_OUT ||
+                    status == android::WOULD_BLOCK) {
+                    return C2_TIMED_OUT;
+                }
             }
+            return C2_BAD_VALUE;
         }
         ALOGV("dequeued a buffer successfully");
         native_handle_t* nh = nullptr;
@@ -328,7 +330,7 @@
             return mInit;
         }
 
-        static int kMaxIgbpRetry = 20; // TODO: small number can cause crash in releasing.
+        static int kMaxIgbpRetry = 1; // TODO: small number can cause crash in releasing.
         static int kMaxIgbpRetryDelayUs = 10000;
 
         int curTry = 0;