codec2的使用

创建block pool

使用CreateCodec2BlockPool创建codec2的block pool会报错,这段代码在CCodecBufferChannel中可以找到:

std::shared_ptr<C2AllocatorStore> store = GetCodec2PlatformAllocatorStore();
int poolMask = GetCodec2PoolMask();
C2PlatformAllocatorStore::id_t preferredLinearId = GetPreferredLinearAllocatorId(poolMask);

std::shared_ptr<C2BlockPool> pool;
if ((poolMask >> preferredLinearId) & 1) {
    err = CreateCodec2BlockPool(preferredLinearId, nullptr, &pool);
} else {
    err = C2_NOT_FOUND;
}

报错LOG:

05-16 06:03:01.600 +0000 14826 14826 F DEBUG   : backtrace:
05-16 06:03:01.600 +0000 14826 14826 F DEBUG   :     NOTE: Function names and BuildId information is missing for some frames due
05-16 06:03:01.600 +0000 14826 14826 F DEBUG   :     NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
05-16 06:03:01.600 +0000 14826 14826 F DEBUG   :     NOTE: found under the lib/ directory are readable.
05-16 06:03:01.600 +0000 14826 14826 F DEBUG   :       #00 pc 000000000006d0b8  /system/lib64/libcodec2_vndk.so (android::(anonymous namespace)::_C2BlockPoolCache::_createBlockPool(unsigned int, std::__1::shared_ptr<C2Component const>, unsigned long, std::__1::shared_ptr<C2BlockPool>*)+828) (BuildId: cbfb54bd2fbd0f7588c8bbd79c9a8288)
05-16 06:03:01.600 +0000 14826 14826 F DEBUG   :       #01 pc 000000000006ed34  /system/lib64/libcodec2_vndk.so (android::CreateCodec2BlockPool(unsigned int, std::__1::shared_ptr<C2Component const>, std::__1::shared_ptr<C2BlockPool>*) (.cfi)+212) (BuildId: cbfb54bd2fbd0f7588c8bbd79c9a8288)

效仿codec2play中的用法也报错:

这段代码在std::make_shared<C2PooledBlockPool>的时候也是报错,和前面的log是一样的。

std::shared_ptr<C2AllocatorStore> store = GetCodec2PlatformAllocatorStore();
if (!store) {
    GST_ERROR("Get codec2 allocator store failed.\n");
}
store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &allocator);
if (!allocator) {
    GST_ERROR("fetch allocator failed.\n");
}
linearPoolId = allocator->getId();
linearPool = std::make_shared<C2PooledBlockPool>(allocator, linearPoolId);
if (!linearPool) {
    GST_DEBUG("create linear pool failed.\n");
}

成功的用法:

直接使用GetCodec2BlockPool获取block pool,都不用通过AllocatorStore

c2_status_t err = C2_NO_INIT;
C2BlockPool::local_id_t inputPoolId = C2BlockPool::BASIC_LINEAR;
err = GetCodec2BlockPool(inputPoolId, nullptr, &linearPool);

未完待续

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值