本文整理汇总了C++中sp::getBufSize方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::getBufSize方法的具体用法?C++ sp::getBufSize怎么用?C++ sp::getBufSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::getBufSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderImgBuf
void renderImgBuf(sp<IImgBuf>const& pImgBuf)
{
char const aColor[] = {0, 128, 255};
static int idxColor = 0;
MY_LOGD("[TestThread::renderImgBuf]");
::memset(pImgBuf->getVirAddr(), aColor[idxColor], pImgBuf->getBufSize());
idxColor = (idxColor+1) % (sizeof(aColor)/sizeof(aColor[0]));
}
示例2: _lock
bool
RecordClient::
performRecordCallback(int32_t bufIdx, sp<ICameraImgBuf>const& pCameraImgBuf, int32_t const msgType)
{
nsecs_t timeDiff;
//
if ( pCameraImgBuf != 0 )
{
// [1] Dump image if wanted.
if ( 0 < mi4DumpImgBufCount )
{
MY_LOGD("<dump image> mi4DumpImgBufCount(%d) > 0", mi4DumpImgBufCount);
Mutex::Autolock _lock(mDumpMtx);
saveBufToFile(
String8::format(
"%s_%s-(%d)%dx%d_%03d.yuv",
ms8DumpImgBufPath.string(),
pCameraImgBuf->getImgFormat().string(),
pCameraImgBuf->getImgWidthStride(),
pCameraImgBuf->getImgWidth(),
pCameraImgBuf->getImgHeight(),
mi4DumpImgBufIndex
),
(uint8_t*)pCameraImgBuf->getVirAddr(),
pCameraImgBuf->getBufSize()
);
::android_atomic_dec(&mi4DumpImgBufCount);
::android_atomic_inc(&mi4DumpImgBufIndex);
}
if(!isMsgEnabled())
{
MY_LOGW_IF(ENABLE_LOG_PER_FRAME, "No REC CB: isEnabledState(%d), isMsgEnabled(%d)", isEnabledState(), isMsgEnabled());
return false;
}
//
if(mLastTimeStamp >= pCameraImgBuf->getTimestamp())
{
MY_LOGW("TimeStamp:Last(%d.%06d) >= Cur(%d.%06d)",
(uint32_t)((mLastTimeStamp/1000)/1000000),
(uint32_t)((mLastTimeStamp/1000)%1000000),
(uint32_t)((pCameraImgBuf->getTimestamp()/1000)/1000000),
(uint32_t)((pCameraImgBuf->getTimestamp()/1000)%1000000));
return false;
}
mLastTimeStamp = pCameraImgBuf->getTimestamp();
// [2] Callback
CamProfile profile(__FUNCTION__, "RecordClient");
::android_atomic_inc(&mi4CallbackRefCount);
mi8CallbackTimeInMs = MtkCamUtils::getTimeInMs();
//
mFrameCount++;
mTimeEnd = systemTime();
timeDiff = mTimeEnd - mTimeStart;
if(timeDiff > FPS_CNT_TIME)
{
MY_LOGD("FPS(%d)",mFrameCount);
mFrameCount = 0;
mTimeStart = mTimeEnd;
}
//
{
Mutex::Autolock _l(mModuleMtx);
//
mvRecBufInfo.editItemAt(bufIdx).Sta = REC_BUF_STA_CB;
}
//
mpCamMsgCbInfo->mDataCbTimestamp(
(nsecs_t)pCameraImgBuf->getTimestamp(),
(int32_t)CAMERA_MSG_VIDEO_FRAME,
pCameraImgBuf->get_camera_memory(),
pCameraImgBuf->getBufIndex(),
mpCamMsgCbInfo->mCbCookie
);
MY_LOGD("CB:FC(%d),VA(0x%08X)",mFrameCount,pCameraImgBuf->getVirAddr());
//
::android_atomic_dec(&mi4CallbackRefCount);
//profile.print_overtime(10, "mDataCb(%x) - index(%d)", msgType, pCameraImgBuf->getBufIndex());
return true;
}
return false;
}