diff options
author | Chih-Yu Huang <akahuang@google.com> | 2020-08-21 14:29:28 +0900 |
---|---|---|
committer | Chih-Yu Huang <akahuang@google.com> | 2020-08-24 17:04:49 +0900 |
commit | 817872ef36643c5d5504074678582450be574cb2 (patch) | |
tree | 112831e562ef6fb251efb343acc41c2301cab4a7 /components | |
parent | cd9bd5d87e952316d640828b8c919b52eacc7e45 (diff) | |
download | v4l2_codec2-817872ef36643c5d5504074678582450be574cb2.tar.gz |
V4L2Decoder: Skip fetching VideoFrame when no free V4L2 output slot
We should only fetch buffers when there are free V4L2 output slots.
This CL adds the check to avoid unnecessary buffer fetching.
Bug: 160110407
Test: Run e2e test and confirm that buffer fetching is skipped
when no free V4L2 slot
Change-Id: If50752964155ba65d8cc7ec0805507c053716294
Diffstat (limited to 'components')
-rw-r--r-- | components/V4L2Decoder.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/components/V4L2Decoder.cpp b/components/V4L2Decoder.cpp index 3ec799f..f066fd4 100644 --- a/components/V4L2Decoder.cpp +++ b/components/V4L2Decoder.cpp @@ -505,6 +505,11 @@ void V4L2Decoder::tryFetchVideoFrame() { return; } + if (mOutputQueue->FreeBuffersCount() == 0) { + ALOGD("No free V4L2 output buffers, ignore."); + return; + } + mVideoFramePool->getVideoFrame(::base::BindOnce(&V4L2Decoder::onVideoFrameReady, mWeakThis)); } |