Skip to content
Snippets Groups Projects
Commit deb4e388 authored by Chih-Yu Huang's avatar Chih-Yu Huang
Browse files

C2PooledBlockPool: remove retry logic

C2PooledBlockPool is used by VideoFramePool. Currently VideoFramePool
has exponential backoff retry, so we don't need another retry logic in
C2PooledBlockPool. This CL removes the unnecessary retry logic.

Bug: 160110407
Test: tast.arc.VideoDecodeAccel.h264_vm

Change-Id: I73ffd4b27000846eeea1e5bffbedb21e16795593
parent a109e7db
No related branches found
No related tags found
No related merge requests found
...@@ -14,19 +14,6 @@ ...@@ -14,19 +14,6 @@
#include <log/log.h> #include <log/log.h>
namespace android { namespace android {
namespace {
// The wait time for another try to fetch a buffer from bufferpool.
const int64_t kFetchRetryDelayUs = 10 * 1000;
int64_t GetNowUs() {
struct timespec t;
t.tv_sec = 0;
t.tv_nsec = 0;
clock_gettime(CLOCK_MONOTONIC, &t);
int64_t nsecs = static_cast<int64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;
return nsecs / 1000ll;
}
} // namespace
using android::hardware::media::bufferpool::BufferPoolData; using android::hardware::media::bufferpool::BufferPoolData;
...@@ -57,14 +44,6 @@ c2_status_t C2VdaPooledBlockPool::fetchGraphicBlock(uint32_t width, uint32_t hei ...@@ -57,14 +44,6 @@ c2_status_t C2VdaPooledBlockPool::fetchGraphicBlock(uint32_t width, uint32_t hei
ALOG_ASSERT(block != nullptr); ALOG_ASSERT(block != nullptr);
std::lock_guard<std::mutex> lock(mMutex); std::lock_guard<std::mutex> lock(mMutex);
if (mNextFetchTimeUs != 0) {
int delayUs = GetNowUs() - mNextFetchTimeUs;
if (delayUs > 0) {
::usleep(delayUs);
}
mNextFetchTimeUs = 0;
}
std::shared_ptr<C2GraphicBlock> fetchBlock; std::shared_ptr<C2GraphicBlock> fetchBlock;
c2_status_t err = c2_status_t err =
C2PooledBlockPool::fetchGraphicBlock(width, height, format, usage, &fetchBlock); C2PooledBlockPool::fetchGraphicBlock(width, height, format, usage, &fetchBlock);
...@@ -89,7 +68,6 @@ c2_status_t C2VdaPooledBlockPool::fetchGraphicBlock(uint32_t width, uint32_t hei ...@@ -89,7 +68,6 @@ c2_status_t C2VdaPooledBlockPool::fetchGraphicBlock(uint32_t width, uint32_t hei
return C2_OK; return C2_OK;
} }
ALOGV("No buffer could be recycled now, wait for another try..."); ALOGV("No buffer could be recycled now, wait for another try...");
mNextFetchTimeUs = GetNowUs() + kFetchRetryDelayUs;
return C2_TIMED_OUT; return C2_TIMED_OUT;
} }
......
...@@ -47,9 +47,6 @@ private: ...@@ -47,9 +47,6 @@ private:
std::set<uint32_t> mBufferIds GUARDED_BY(mMutex); std::set<uint32_t> mBufferIds GUARDED_BY(mMutex);
// The maximum count of allocated buffers. // The maximum count of allocated buffers.
size_t mBufferCount GUARDED_BY(mMutex){0}; size_t mBufferCount GUARDED_BY(mMutex){0};
// The timestamp for the next fetchGraphicBlock() call.
// Set when the previous fetchGraphicBlock() call timed out.
int64_t mNextFetchTimeUs GUARDED_BY(mMutex){0};
}; };
} // namespace android } // namespace android
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment