Skip to content
Snippets Groups Projects
Commit 282b0666 authored by Xin Li's avatar Xin Li
Browse files

DO NOT MERGE - Merge Android 13

Bug: 242648940
Merged-In: I3ceefaad9b420f86e4f0b524e6f0b5649af9997b
Change-Id: I04b3505c478d96f4676ec6bc3268dba24f2123fa
parents d708af3f 1425bf6c
No related branches found
No related tags found
No related merge requests found
......@@ -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));
......
......@@ -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) {
......
......@@ -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: [
......
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