-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error handling in case of preview, host disconnect
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
.../external/project-celadon/camera-vhal/0005-Error-handling-if-disconnects-in-preview.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From 545e451cbf1a457bdf721cf6fff6d5b1543b2f72 Mon Sep 17 00:00:00 2001 | ||
From: gkdeepa <[email protected]> | ||
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 <log/log.h> | ||
@@ -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 | ||
|