-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverity fixes for ExternalCamera and RemoteCamera #170
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -798,6 +798,7 @@ Status ExternalCameraDeviceSession::switchToOffline( | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = buffer.acquireFence; | ||
outputBuffer.releaseFence = android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
} else { | ||
offlineBuffers.push_back(buffer); | ||
|
@@ -1781,6 +1782,7 @@ Status ExternalCameraDeviceSession::processCaptureRequestError( | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
tdivy20 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
|
@@ -1827,6 +1829,7 @@ Status ExternalCameraDeviceSession::processCaptureResult(std::shared_ptr<HalRequ | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct indentation |
||
notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER); | ||
} else { | ||
|
@@ -1836,6 +1839,7 @@ Status ExternalCameraDeviceSession::processCaptureResult(std::shared_ptr<HalRequ | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,7 @@ Status ExternalCameraOfflineSession::processCaptureResult(std::shared_ptr<HalReq | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct indentation |
||
notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER); | ||
} else { | ||
|
@@ -120,6 +121,7 @@ Status ExternalCameraOfflineSession::processCaptureResult(std::shared_ptr<HalReq | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
outputBuffer.releaseFence = android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
} | ||
} | ||
|
@@ -248,6 +250,7 @@ Status ExternalCameraOfflineSession::processCaptureRequestError( | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
outputBuffer.releaseFence = makeToAidl(handle); | ||
native_handle_delete(handle); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct indentation |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,7 @@ void *RemoteDataRecvThreadFun(void *argv) | |
ALOGI(LOG_TAG " %s: Thread is running", __FUNCTION__); | ||
struct pollfd fd; | ||
int event; | ||
uint8_t *fBuffer = nullptr; | ||
uint8_t *fBuffer = nullptr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra space |
||
RemoteCameraDeviceSession *parentHandle = (RemoteCameraDeviceSession*)argv; | ||
fd.fd = parentHandle->mFd; | ||
fd.events = POLLIN | POLLHUP; | ||
|
@@ -163,10 +163,15 @@ void *RemoteDataRecvThreadFun(void *argv) | |
size_header = recv(parentHandle->mFd, (char *)&buffer_header, sizeof(camera_header_t), 0); | ||
if(buffer_header.type == CAMERA_DATA){ | ||
size_pending = (size_t)buffer_header.size; | ||
if(fBuffer != nullptr) { | ||
free(fBuffer); | ||
} | ||
fBuffer = (uint8_t *)malloc(size_pending); | ||
if (fBuffer == NULL) { | ||
ALOGE(LOG_TAG "%s: buffer allocation failed: %d ", __FUNCTION__, __LINE__); | ||
continue; | ||
} | ||
|
||
while(true) { | ||
if(mEnqList.size() == 0) { | ||
if (parentHandle->mStopRequest == true) { | ||
|
@@ -216,7 +221,6 @@ void *RemoteDataRecvThreadFun(void *argv) | |
ALOGE("updated fail to convert MJPG to I420 ret %d", res); | ||
} | ||
mDeqList.push_back(frame); | ||
free(fBuffer); | ||
break; | ||
} | ||
} | ||
|
@@ -228,7 +232,10 @@ void *RemoteDataRecvThreadFun(void *argv) | |
} | ||
} | ||
} | ||
|
||
if (fBuffer != nullptr) { | ||
free(fBuffer); | ||
fBuffer = nullptr; | ||
} | ||
return argv; | ||
} | ||
RemoteCameraDeviceSession::RemoteCameraDeviceSession( | ||
|
@@ -851,6 +858,7 @@ Status RemoteCameraDeviceSession::switchToOffline( | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = buffer.acquireFence; | ||
outputBuffer.releaseFence = android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
} else { | ||
offlineBuffers.push_back(buffer); | ||
|
@@ -1683,6 +1691,7 @@ Status RemoteCameraDeviceSession::processCaptureRequestError( | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
} | ||
|
||
|
@@ -1728,6 +1737,7 @@ Status RemoteCameraDeviceSession::processCaptureResult(std::shared_ptr<HalReques | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER); | ||
} else { | ||
|
@@ -1737,6 +1747,7 @@ Status RemoteCameraDeviceSession::processCaptureResult(std::shared_ptr<HalReques | |
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); | ||
handle->data[0] = req->buffers[i].acquireFence; | ||
result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); | ||
native_handle_delete(handle); | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct indentation