增加图像处理错误代码,确定为内存分配失败才返回内存错误,其它返回SCANNER_ERR_IMAGE_PROC_FATAL错误

This commit is contained in:
gb 2023-12-07 16:18:31 +08:00
parent 43ef322c20
commit ed5f19354b
2 changed files with 10 additions and 4 deletions

View File

@ -1094,7 +1094,7 @@ void hg_scanner::thread_handle_image_process(void)
if (!ImagePrc_pHandle_)
{
VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:Get Image Process is NULL pid is %d.\n", pid_);
stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY;
stop_fatal_ = SCANNER_ERR_IMAGE_PROC_FATAL;
do_stop();
invoke_stop = true;
break;
@ -1109,8 +1109,10 @@ void hg_scanner::thread_handle_image_process(void)
is_dpi_color_check = false;
stop_fatal_ = SCANNER_ERR_DEVICE_DISTORTION;
}
else
else if (strstr(e.what(), "Insufficient "))
stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY;
else
stop_fatal_ = SCANNER_ERR_IMAGE_PROC_FATAL;
VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:is opencv Fatal and stop scanner: %s\n", e.what());
do_stop();
invoke_stop = true;
@ -1120,7 +1122,7 @@ void hg_scanner::thread_handle_image_process(void)
catch (...)
{
VLOG_MINI_1(LOG_LEVEL_FATAL, "[thread_handle_image_process]:stop scanner!!! Insufficient memory when proecss image with %d bytes.\n", tiny_buffer->size());
stop_fatal_ = SCANNER_ERR_INSUFFICIENT_MEMORY;
stop_fatal_ = SCANNER_ERR_IMAGE_PROC_FATAL;
do_stop();
invoke_stop = true;
break;

View File

@ -240,6 +240,8 @@ extern "C"
RETURN_IF(err, SCANNER_ERR_CONFIGURATION_CHANGED);
RETURN_IF(err, SCANNER_ERR_RELOAD_IMAGE_PARAM);
RETURN_IF(err, SCANNER_ERR_RELOAD_OPT_PARAM);
RETURN_IF(err, SCANNER_ERR_IMAGE_PROC_FATAL);
RETURN_IF(err, SCANNER_ERR_NOT_OPEN);
RETURN_IF(err, SCANNER_ERR_NOT_START);
RETURN_IF(err, SCANNER_ERR_NOT_ANY_MORE);
@ -317,6 +319,8 @@ extern "C"
RETURN_DESC_IF(err, SCANNER_ERR_CONFIGURATION_CHANGED);
RETURN_DESC_IF(err, SCANNER_ERR_RELOAD_IMAGE_PARAM);
RETURN_DESC_IF(err, SCANNER_ERR_RELOAD_OPT_PARAM);
RETURN_DESC_IF(err, SCANNER_ERR_IMAGE_PROC_FATAL);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_OPEN);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_START);
RETURN_DESC_IF(err, SCANNER_ERR_NOT_ANY_MORE);