1.同步连拍漏图问题

This commit is contained in:
payton 2023-10-24 18:06:42 +08:00
parent e82393a5d6
commit 44f25bb757
2 changed files with 65 additions and 11 deletions

View File

@ -1376,6 +1376,33 @@ extern void setet_preset_param(void);
extern INT32 PhotoFast_SliceEncode_Dump_Frame(const HD_VIDEO_FRAME video_frame, UINT8 format); extern INT32 PhotoFast_SliceEncode_Dump_Frame(const HD_VIDEO_FRAME video_frame, UINT8 format);
HD_RESULT PhotoFast_VideoCap_Pull_Out_Buf(HD_PATH_ID path_id, HD_VIDEO_FRAME *p_video_frame, INT32 wait_ms)
{
HD_RESULT ret;
UINT32 cnt = 0;
UINT32 delay_ms = 1;
UINT32 timeout = 30;
do {
ret = hd_videocap_pull_out_buf(path_id, p_video_frame, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS);
if(ret != HD_OK && ret != HD_ERR_UNDERRUN){
DBG_ERR("failed to hd_videocap_pull_out_buf, er=%d\n", (int)ret);
return ret;
}
else if(ret == HD_ERR_UNDERRUN){
DBG_ERR("failed to hd_videocap_pull_out_buf, er=%d, retrying(cnt = %lu) ... \n", (int)ret, cnt);
vos_util_delay_ms(delay_ms);
continue;
}
else{
break;
}
} while(cnt++ < timeout);
return ret;
}
THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg) THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg)
{ {
HD_RESULT hd_ret = HD_OK; HD_RESULT hd_ret = HD_OK;
@ -1530,7 +1557,7 @@ THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg)
} }
#endif #endif
if((hd_ret = hd_videocap_pull_out_buf(vcap_path, &video_cap_frame, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS)) != HD_OK){ if((hd_ret = PhotoFast_VideoCap_Pull_Out_Buf(vcap_path, &video_cap_frame, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS)) != HD_OK){
DBG_ERR("failed to hd_videocap_pull_out_buf, er=%d\n", (int)hd_ret); DBG_ERR("failed to hd_videocap_pull_out_buf, er=%d\n", (int)hd_ret);
goto exit; goto exit;
} }
@ -1575,7 +1602,7 @@ THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg)
} }
else{ else{
if((hd_ret = hd_videocap_pull_out_buf(vcap_path, &video_cap_frame, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS)) != HD_OK){ if((hd_ret = PhotoFast_VideoCap_Pull_Out_Buf(vcap_path, &video_cap_frame, PHOTOFAST_HD_PUSH_PULL_TIMEOUT_MS)) != HD_OK){
DBG_ERR("failed to hd_videocap_pull_out_buf, er=%d\n", (int)hd_ret); DBG_ERR("failed to hd_videocap_pull_out_buf, er=%d\n", (int)hd_ret);
goto exit; goto exit;
} }

View File

@ -40,6 +40,9 @@
#define PHOTOFAST_SLICE_ENC_DBG_SCREENNAIL_JPG 0 #define PHOTOFAST_SLICE_ENC_DBG_SCREENNAIL_JPG 0
#define PHOTOFAST_SLICE_ENC_DBG_THUMBNAIL_JPG 0 #define PHOTOFAST_SLICE_ENC_DBG_THUMBNAIL_JPG 0
#define PHOTOFAST_SLICE_ENC_QUEUE12_MAX_SIZE 2
#define PHOTOFAST_SLICE_ENC_QUEUE23_MAX_SIZE 1
#if PHOTOFAST_SLICE_ENC_DBG_PRIMARY_JPG || PHOTOFAST_SLICE_ENC_DBG_SCREENNAIL_JPG || PHOTOFAST_SLICE_ENC_DBG_THUMBNAIL_JPG #if PHOTOFAST_SLICE_ENC_DBG_PRIMARY_JPG || PHOTOFAST_SLICE_ENC_DBG_SCREENNAIL_JPG || PHOTOFAST_SLICE_ENC_DBG_THUMBNAIL_JPG
#define PHOTOFAST_SLICE_ENC_DBG_JPG 1 #define PHOTOFAST_SLICE_ENC_DBG_JPG 1
#else #else
@ -1902,11 +1905,23 @@ INT32 PhotoFast_Sliceencode2_Enq_Frame(const HD_VIDEO_FRAME* video_frame)
memset(queue_ele_out, 0, sizeof(PhotoFast_SliceEncode_Queue12_Param)); memset(queue_ele_out, 0, sizeof(PhotoFast_SliceEncode_Queue12_Param));
queue_ele_out->frame = *video_frame; queue_ele_out->frame = *video_frame;
while (lfqueue_enq(&queue12, (void*) queue_ele_out) == -1) while(1)
{ {
vos_util_delay_ms(1); if(lfqueue_size(&queue12) >= PHOTOFAST_SLICE_ENC_QUEUE12_MAX_SIZE)
DBG_ERR("ENQ Full ?\r\n"); {
} vos_util_delay_ms(1);
continue;
}
else
{
while(lfqueue_enq(&queue12, (void*)queue_ele_out) == -1)
{
vos_util_delay_ms(1);
DBG_ERR("ENQ Full ?\r\n");
}
break;
}
}
return E_OK; return E_OK;
} }
@ -2184,10 +2199,22 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data)
DBG_DUMP("%s added to DCF\r\n", queue_ele_out->file_path); DBG_DUMP("%s added to DCF\r\n", queue_ele_out->file_path);
#endif #endif
while (lfqueue_enq(param->queue23, (void*) queue_ele_out) == -1) while(1)
{ {
DBG_ERR("ENQ Full ?\r\n"); if(lfqueue_size(param->queue23) >= PHOTOFAST_SLICE_ENC_QUEUE23_MAX_SIZE)
} {
vos_util_delay_ms(1);
continue;
}
else
{
while(lfqueue_enq(param->queue23, (void*)queue_ele_out) == -1)
{
DBG_ERR("ENQ Full ?\r\n");
}
break;
}
}
/* check is vproc frame released */ /* check is vproc frame released */
if(queue_ele_in->frame.phy_addr[0]){ if(queue_ele_in->frame.phy_addr[0]){