DO NOT MERGE - Merge Android 13

Bug: 242648940
Merged-In: I3ceefaad9b420f86e4f0b524e6f0b5649af9997b
Change-Id: I04b3505c478d96f4676ec6bc3268dba24f2123fa
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 @@
     // 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 @@
     }
 
     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 @@
     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: [