Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fecdd1a7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Codec2 C2BlockPool: Use C2_BLOCKING instead of C2_TIMED_OUT"

parents 9a7bdd55 5f3fb6f3
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ public:
        c2_status_t status;
        do {
            status = mBase->fetchLinearBlock(capacity, usage, block);
        } while (status == C2_TIMED_OUT);
        } while (status == C2_BLOCKING);
        return status;
    }

@@ -162,7 +162,7 @@ public:
        c2_status_t status;
        do {
            status = mBase->fetchCircularBlock(capacity, usage, block);
        } while (status == C2_TIMED_OUT);
        } while (status == C2_BLOCKING);
        return status;
    }

@@ -174,7 +174,7 @@ public:
        do {
            status = mBase->fetchGraphicBlock(width, height, format, usage,
                                              block);
        } while (status == C2_TIMED_OUT);
        } while (status == C2_BLOCKING);
        return status;
    }

+3 −0
Original line number Diff line number Diff line
@@ -888,6 +888,7 @@ public:
     * \retval C2_OK        the operation was successful
     * \retval C2_NO_MEMORY not enough memory to complete any required allocation
     * \retval C2_TIMED_OUT the operation timed out
     * \retval C2_BLOCKING  the operation is blocked
     * \retval C2_REFUSED   no permission to complete any required allocation
     * \retval C2_BAD_VALUE capacity or usage are not supported (invalid) (caller error)
     * \retval C2_OMITTED   this pool does not support linear blocks
@@ -916,6 +917,7 @@ public:
     * \retval C2_OK        the operation was successful
     * \retval C2_NO_MEMORY not enough memory to complete any required allocation
     * \retval C2_TIMED_OUT the operation timed out
     * \retval C2_BLOCKING  the operation is blocked
     * \retval C2_REFUSED   no permission to complete any required allocation
     * \retval C2_BAD_VALUE capacity or usage are not supported (invalid) (caller error)
     * \retval C2_OMITTED   this pool does not support circular blocks
@@ -946,6 +948,7 @@ public:
     * \retval C2_OK        the operation was successful
     * \retval C2_NO_MEMORY not enough memory to complete any required allocation
     * \retval C2_TIMED_OUT the operation timed out
     * \retval C2_BLOCKING  the operation is blocked
     * \retval C2_REFUSED   no permission to complete any required allocation
     * \retval C2_BAD_VALUE width, height, format or usage are not supported (invalid) (caller
     *                      error)
+12 −8
Original line number Diff line number Diff line
@@ -207,13 +207,17 @@ private:
        // 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) {
                    // Dequeue buffer is blocked temporarily. Retrying is
                    // required.
                    return C2_BLOCKING;
                }
            }
            return C2_BAD_VALUE;
        }
        ALOGV("dequeued a buffer successfully");
        native_handle_t* nh = nullptr;
        hidl_handle fenceHandle;
@@ -227,7 +231,7 @@ private:
            if (status == -ETIME) {
                // fence is not signalled yet.
                (void)mProducer->cancelBuffer(slot, fenceHandle).isOk();
                return C2_TIMED_OUT;
                return C2_BLOCKING;
            }
            if (status != android::NO_ERROR) {
                ALOGD("buffer fence wait error %d", status);
@@ -353,14 +357,14 @@ public:
                return C2_OK;
            }
            c2_status_t status = fetchFromIgbp_l(width, height, format, usage, block);
            if (status == C2_TIMED_OUT) {
            if (status == C2_BLOCKING) {
                lock.unlock();
                ::usleep(kMaxIgbpRetryDelayUs);
                continue;
            }
            return status;
        }
        return C2_TIMED_OUT;
        return C2_BLOCKING;
    }

    void setRenderCallback(const OnRenderCallback &renderCallback) {