From 1fc7b96164c7083ba097209e11c7dc01fe8a9c2c Mon Sep 17 00:00:00 2001 From: gkdeepa Date: Thu, 2 Dec 2021 14:39:24 +0530 Subject: [PATCH] Error handling in case of preview, host disconnect --- ...r-handling-if-disconnects-in-preview.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 bsp_diff/caas_cfc/vendor/intel/external/project-celadon/camera-vhal/0005-Error-handling-if-disconnects-in-preview.patch diff --git a/bsp_diff/caas_cfc/vendor/intel/external/project-celadon/camera-vhal/0005-Error-handling-if-disconnects-in-preview.patch b/bsp_diff/caas_cfc/vendor/intel/external/project-celadon/camera-vhal/0005-Error-handling-if-disconnects-in-preview.patch new file mode 100644 index 0000000000..a6e07b907f --- /dev/null +++ b/bsp_diff/caas_cfc/vendor/intel/external/project-celadon/camera-vhal/0005-Error-handling-if-disconnects-in-preview.patch @@ -0,0 +1,47 @@ +From 545e451cbf1a457bdf721cf6fff6d5b1543b2f72 Mon Sep 17 00:00:00 2001 +From: gkdeepa +Date: Thu, 2 Dec 2021 13:16:21 +0530 +Subject: [PATCH] Error handling if disconnects in preview + +Tracked-On: +--- + src/CameraSocketServerThread.cpp | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/CameraSocketServerThread.cpp b/src/CameraSocketServerThread.cpp +index c06fb22..15cdd1c 100644 +--- a/src/CameraSocketServerThread.cpp ++++ b/src/CameraSocketServerThread.cpp +@@ -13,7 +13,7 @@ + * See the License for the specific language governing permissions and + * limitations under the License. + */ +-//#define LOG_NDEBUG 0 ++#define LOG_NDEBUG 0 + //#define LOG_NNDEBUG 0 + #define LOG_TAG "CameraSocketServerThread: " + #include +@@ -320,7 +320,7 @@ bool CameraSocketServerThread::threadLoop() { + mClientFd = -1; + clearBuffer(fbuffer, 640, 480); + break; +- } else if ((event & POLLIN) || (trans_mode == VSOCK) || (trans_mode == TCP) ) { // preview / record ++ } else if ((event & POLLIN) ) { // preview / record + // data is available in socket => read data + if (gIsInFrameI420) { + ssize_t size = 0; +@@ -330,6 +330,11 @@ bool CameraSocketServerThread::threadLoop() { + { + while(size_update != 460800){ + size = recv(mClientFd, (char *)fbuffer+size_update, 460800, 0); ++ if(size < 0){ ++ //error handling while in preview ++ ALOGE(LOG_TAG "entered into recv error, break to recover"); ++ break; ++ } + size_update += size; + if (size_update == 460800){ + handle->clientRevCount++; +-- +2.17.1 +