Refine libmix video encode to fix screen record messy issue.
BZ: 188859
Change GFX buffer info usage logic.
Refine 64bits variable type.
Change-Id: I55e50e49c0323d6fb91fc48a48314a326d7ca3b5
Signed-off-by: bolunliu <bolun.liu@intel.com>
diff --git a/videoencoder/VideoEncoderBase.cpp b/videoencoder/VideoEncoderBase.cpp
index 9ab50e4..d9e92bd 100644
--- a/videoencoder/VideoEncoderBase.cpp
+++ b/videoencoder/VideoEncoderBase.cpp
@@ -1642,14 +1642,14 @@
if (map) {
//has mapped, get surfaceID directly and do all necessary actions
- LOG_I("direct find surface %d from value %x\n", map->getVASurface(), value);
+ LOG_I("direct find surface %d from value %p\n", map->getVASurface(), value);
*sid = map->getVASurface();
map->doMapping();
return ret;
}
//if no found from list, then try to map value with parameters
- LOG_I("not find surface from cache with value %x, start mapping if enough information\n", value);
+ LOG_I("not find surface from cache with value %p, start mapping if enough information\n", value);
if (mStoreMetaDataInBuffers.isEnabled) {
@@ -1696,7 +1696,7 @@
ret = map->doMapping();
if (ret == ENCODE_SUCCESS) {
- LOG_I("surface mapping success, map value %x into surface %d\n", value, map->getVASurface());
+ LOG_I("surface mapping success, map value %p into surface %d\n", value, map->getVASurface());
mSrcSurfaceMapList.push_back(map);
} else {
delete map;
@@ -1721,12 +1721,12 @@
ret = map->doMapping();
if (ret == ENCODE_SUCCESS) {
- LOG_I("surface mapping extravalue success, map value %x into surface %d\n", extravalues[i], map->getVASurface());
+ LOG_I("surface mapping extravalue success, map value %p into surface %d\n", extravalues[i], map->getVASurface());
mSrcSurfaceMapList.push_back(map);
} else {
delete map;
map = NULL;
- LOG_E( "surface mapping extravalue failed, extravalue is %x\n", extravalues[i]);
+ LOG_E( "surface mapping extravalue failed, extravalue is %p\n", extravalues[i]);
}
}
}
@@ -1868,7 +1868,7 @@
return ENCODE_SUCCESS;
}
-VASurfaceMap *VideoEncoderBase::findSurfaceMapByValue(int32_t value) {
+VASurfaceMap *VideoEncoderBase::findSurfaceMapByValue(intptr_t value) {
android::List<VASurfaceMap *>::iterator node;
for(node = mSrcSurfaceMapList.begin(); node != mSrcSurfaceMapList.end(); node++)
diff --git a/videoencoder/VideoEncoderBase.h b/videoencoder/VideoEncoderBase.h
index 5bd7711..80f6849 100644
--- a/videoencoder/VideoEncoderBase.h
+++ b/videoencoder/VideoEncoderBase.h
@@ -85,7 +85,7 @@
Encode_Status setUpstreamBuffer(VideoParamsUpstreamBuffer *upStreamBuffer);
Encode_Status getNewUsrptrFromSurface(uint32_t width, uint32_t height, uint32_t format,
uint32_t expectedSize, uint32_t *outsize, uint32_t *stride, uint8_t **usrptr);
- VASurfaceMap* findSurfaceMapByValue(int32_t value);
+ VASurfaceMap* findSurfaceMapByValue(intptr_t value);
Encode_Status manageSrcSurface(VideoEncRawBuffer *inBuffer, VASurfaceID *sid);
void PrepareFrameInfo(EncodeTask* task);
diff --git a/videoencoder/VideoEncoderDef.h b/videoencoder/VideoEncoderDef.h
index b5b7ae8..c8695dc 100644
--- a/videoencoder/VideoEncoderDef.h
+++ b/videoencoder/VideoEncoderDef.h
@@ -470,7 +470,7 @@
}
VideoBufferSharingMode bufferMode;
- uint32_t *bufList;
+ intptr_t *bufList;
uint32_t bufCnt;
ExternalBufferAttrib *bufAttrib;
void *display;
diff --git a/videoencoder/VideoEncoderUtils.cpp b/videoencoder/VideoEncoderUtils.cpp
index 97045bb..53aafbd 100644
--- a/videoencoder/VideoEncoderUtils.cpp
+++ b/videoencoder/VideoEncoderUtils.cpp
@@ -177,7 +177,7 @@
if (h->iFormat == HAL_PIXEL_FORMAT_NV12) {
#ifdef MRFLD_GFX
- if((h->usage | GRALLOC_USAGE_HW_CAMERA_READ) || (h->usage | GRALLOC_USAGE_HW_CAMERA_WRITE) )
+ if((h->usage & GRALLOC_USAGE_HW_CAMERA_READ) || (h->usage & GRALLOC_USAGE_HW_CAMERA_WRITE) )
vinfo.lumaStride = (h->iWidth + 63) & ~63; //64 aligned
else
vinfo.lumaStride = (h->iWidth + 31) & ~31; //32 aligned