aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2022-08-15 22:03:03 -0700
committerXin Li <delphij@google.com>2022-08-15 22:03:03 -0700
commit282b06666db160b5b53ef9e736913cbc1e06b6eb (patch)
treeea8b101fa7800092fc1595b4b051bedb29e21427
parentd708af3f948e2397f2d19f1ccbfc00a85c080dad (diff)
parent1425bf6c3e514ab8de917127b43a77e2376d3765 (diff)
downloadv4l2_codec2-282b06666db160b5b53ef9e736913cbc1e06b6eb.tar.gz
DO NOT MERGE - Merge Android 13main-16k
Bug: 242648940 Merged-In: I3ceefaad9b420f86e4f0b524e6f0b5649af9997b Change-Id: I04b3505c478d96f4676ec6bc3268dba24f2123fa
-rw-r--r--components/V4L2EncodeComponent.cpp4
-rw-r--r--plugin_store/C2VdaBqBlockPool.cpp5
-rw-r--r--tests/c2_comp_intf/Android.bp8
3 files changed, 10 insertions, 7 deletions
diff --git a/components/V4L2EncodeComponent.cpp b/components/V4L2EncodeComponent.cpp
index a1b46ab..4ce4404 100644
--- a/components/V4L2EncodeComponent.cpp
+++ b/components/V4L2EncodeComponent.cpp
@@ -756,8 +756,8 @@ bool V4L2EncodeComponent::encode(C2ConstGraphicBlock block, uint64_t index, int6
// Dynamically adjust framerate based on the frame's timestamp if required.
constexpr int64_t kMaxFramerateDiff = 5;
if (mLastFrameTime && (timestamp > *mLastFrameTime)) {
- int64_t newFramerate =
- static_cast<int64_t>(std::round(1000000.0 / (timestamp - *mLastFrameTime)));
+ int64_t newFramerate = std::max(
+ static_cast<int64_t>(std::round(1000000.0 / (timestamp - *mLastFrameTime))), 1LL);
if (abs(mFramerate - newFramerate) > kMaxFramerateDiff) {
ALOGV("Adjusting framerate to %" PRId64 " based on frame timestamps", newFramerate);
mInterface->setFramerate(static_cast<uint32_t>(newFramerate));
diff --git a/plugin_store/C2VdaBqBlockPool.cpp b/plugin_store/C2VdaBqBlockPool.cpp
index 8271d81..d53f4a0 100644
--- a/plugin_store/C2VdaBqBlockPool.cpp
+++ b/plugin_store/C2VdaBqBlockPool.cpp
@@ -562,11 +562,12 @@ c2_status_t C2VdaBqBlockPool::Impl::fetchGraphicBlock(
}
std::shared_ptr<C2SurfaceSyncMemory> syncMem;
+ // TODO: the |owner| argument should be set correctly.
std::shared_ptr<C2GraphicAllocation> allocation =
mTrackedGraphicBuffers.getRegisteredAllocation(uniqueId);
auto poolData = std::make_shared<C2BufferQueueBlockPoolData>(
- slotBuffer->getGenerationNumber(), mProducerId, slot,
- mProducer->getBase(), syncMem, 0);
+ slotBuffer->getGenerationNumber(), mProducerId, slot, std::make_shared<int>(0),
+ mProducer->getBase(), syncMem);
mTrackedGraphicBuffers.updatePoolData(slot, poolData);
*block = _C2BlockFactory::CreateGraphicBlock(std::move(allocation), std::move(poolData));
if (*block == nullptr) {
diff --git a/tests/c2_comp_intf/Android.bp b/tests/c2_comp_intf/Android.bp
index 6937dee..5c91ef4 100644
--- a/tests/c2_comp_intf/Android.bp
+++ b/tests/c2_comp_intf/Android.bp
@@ -29,9 +29,11 @@ cc_test {
include_dirs: [
"external/v4l2_codec2/common/include",
"external/v4l2_codec2/components/include",
- "frameworks/av/media/codec2/components/base/include",
- "frameworks/av/media/codec2/core/include",
- "frameworks/av/media/codec2/vndk/include",
+ ],
+ header_libs: [
+ "libcodec2_soft_common_headers",
+ "libcodec2_headers",
+ "libcodec2_vndk_headers",
],
cflags: [