v821从uvc摄像头长时间取流(20分钟)uvcInput_WaiteBuffer UVC select timeout!
-
芯片:V821,kernel linux-5.4-ansc。摄像头是罗技 c930e
流程是uvc获取mjpeg,通过vdec解码,传递给venc编码。uvc和vdec bind, vdec和venc bind。
简化流程如下:// 绑定流程 MPP_CHN_S UvcChn = {MOD_ID_UVC, mDevName[0], uvc_channel_} MPP_CHN_S VdecChn = {MOD_ID_VDEC, 0, decode_channel_}; MPP_CHN_S VencChn = {MOD_ID_VENC, 0, encode_channel_}; AW_MPI_SYS_Bind(&UvcChn, &VdecChn); AW_MPI_SYS_Bind(&VdecChn, &VencChn); while (1) { eRet = AW_MPI_VENC_GetStream(encode_channel_, &stVencStream, 500); // 长时间运行后会报错,错误码是-5ff67ff2 // 业务逻辑代码:处理h.264流 // 释放 AW_MPI_VENC_ReleaseStream(encode_channel_, &stVencStream); }错误日志重复输出如下:
W0101 04:25:30.063163 292 VideoDec_Component.c:4619] <ComponentThread> fatal error! wait vbs data timeout! E0101 04:25:30.072333 299 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout! [1970-01-01 04:25:30.104] [error] [Uvc2Dec2Enc.cpp:194] fatal error! why not get stream from venc for too long? ret=-5ff67ff2 W0101 04:25:30.259138 294 VideoEnc_Component.c:10888] <ComponentThread> Be careful! vencChn[0] timeout for waiting outputStream. input frames stat:ready[0]+using[0]+used[0]=total[0] E0101 04:25:30.273074 299 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout! E0101 04:25:30.473610 299 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout!dmesg没有任何错误日志。当出错后,程序一直运行直到Segmentation fault。能稳定复现,运行20~40分钟后就会出现。当出现段错误后,重新启动程序,从UVC无法获取任何帧!!!。以下是重新启动程序直接报错:
I0101 05:24:50.466994 333 mpi_sys.c:893] <AW_MPI_SYS_SetConf> kfctmpdir is [/tmp] I0101 05:24:50.471314 333 mpi_sys.c:1560] <AW_MPI_SYS_Init> ISP init I0101 05:24:50.473061 333 isp_version.h:32] <isp_version_info> [ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<< IPCORE: ISP603 branch: libisp-dev commit: 17ff2691536c2703ffcaf9f77a536289b475960b date : Tue Nov 25 19:56:58 2025 +0800 author: <mayifei@allwinnertech.com> -------------------------------------------------------- I0101 05:24:50.480214 333 mpi_sys.c:1562] <AW_MPI_SYS_Init> ISP init done I0101 05:24:50.482474 333 hwdisplay.c:84] <hw_display_init> I0101 05:24:50.483505 333 hwdisplay.c:1008] <hwd_init> (hwd_init 1008) E0101 05:24:50.986184 333 hwdisplay.c:1001] <tryOpenDev> fatal error! open dev[/dev/disp] fail. error[2-No such file or directory]! E0101 05:24:50.987246 333 hwdisplay.c:1018] <hwd_init> fatal error! Failed to open disp device E0101 05:24:50.988217 333 mpi_vo.c:382] <VO_Construct> fatal error! hw display init fail! E0101 05:24:50.989272 333 mpi_sys.c:1617] <AW_MPI_SYS_Init> VO Construct error! I0101 05:24:51.018701 333 audio_hw.c:199] <MakeAllMixerElemsAvailable> pcm open and close, all MixerElems maybe exist. I0101 05:24:51.019752 333 alsa_interface.c:736] <alsaOpenMixer> open mixer:hw:0 I0101 05:24:51.022494 333 alsa_interface.c:792] <alsaOpenMixer> set playback vol_val to value: 27, mppValue:385 I0101 05:24:51.023880 333 alsa_interface.c:805] <alsaOpenMixer> set playback soft_vol val to value: 130, mppValue:0 I0101 05:24:51.025372 333 alsa_interface.c:736] <alsaOpenMixer> open mixer:hw:1 I0101 05:24:51.028675 336 mpi_sys.c:1124] <MonitorEnvVarThread> detect user environment: I0101 05:24:51.029684 336 mpi_sys.c:1125] <MonitorEnvVarThread> /tmp/mpp_log_level I0101 05:24:51.030663 336 mpi_sys.c:1126] <MonitorEnvVarThread> /tmp/mpp_venc_sei_config_param I0101 05:24:51.092973 333 uvcInput.c:586] <uvcInput_SetDevAttr> the /dev/video0 UVC support video capture! I0101 05:24:51.093275 333 uvcInput.c:596] <uvcInput_SetDevAttr> the /dev/video0 UVC driver is uvcvideo I0101 05:24:51.093476 333 uvcInput.c:597] <uvcInput_SetDevAttr> the /dev/video0 UVC card is Logitech Webcam C930e I0101 05:24:51.093676 333 uvcInput.c:598] <uvcInput_SetDevAttr> the /dev/video0 UVC bus info is usb-sunxi-ehci-1 I0101 05:24:51.093847 333 uvcInput.c:599] <uvcInput_SetDevAttr> the version is 328924 I0101 05:24:51.094026 333 uvcInput.c:611] <uvcInput_SetDevAttr> the /dev/video0 UVC device can support YUYV 4:2:2 capture pixelformat[0x56595559] I0101 05:24:51.094204 333 uvcInput.c:611] <uvcInput_SetDevAttr> the /dev/video0 UVC device can support Motion-JPEG capture pixelformat[0x47504a4d] I0101 05:24:51.094358 333 uvcInput.c:614] <uvcInput_SetDevAttr> Congratulation: the /dev/video0 UVC support Motion-JPEG capture pixelformat I0101 05:24:51.112049 333 uvcInput.c:849] <uvcInput_SetDevAttr> the /dev/video0 UVC capture fixformat is 0x47504a4d I0101 05:24:51.113174 333 uvcInput.c:850] <uvcInput_SetDevAttr> the /dev/video0 UVC capture width is 1280 I0101 05:24:51.114170 333 uvcInput.c:851] <uvcInput_SetDevAttr> the /dev/video0 UVC capture height is 720 I0101 05:24:51.115135 333 uvcInput.c:852] <uvcInput_SetDevAttr> the /dev/video0 UVC capture fps is 30 I0101 05:24:51.116118 333 uvcInput.c:853] <uvcInput_SetDevAttr> the /dev/video0 UVC capture bufCount is 3 I0101 05:24:51.117175 333 uvcInput.c:854] <uvcInput_SetDevAttr> the /dev/video0 UVC capture bufLength is 1843200 W0101 05:24:51.118140 333 uvcInput.c:857] <uvcInput_SetDevAttr> the /dev/video0 UVC had init! W0101 05:24:51.119700 333 UvcVirVi_Component.c:1026] <UvcComponentInit> UvcVirvi_Component had Init!!! I0101 05:24:51.120848 337 UvcVirVi_Component.c:1038] <Uvc_ComponentThread> UVC ComponentThread start run! E0101 05:24:51.123030 339 VideoDec_InputThread.c:70] <InputThread> VideoDecoder InputThread start run... [1970-01-01 05:24:51.124] [info] [Uvc2Dec2Enc.cpp:374] Decode init wh: 1280x720 [1970-01-01 05:24:51.132] [info] [Uvc2Dec2Enc.cpp:451] venc set Rcmode= 2 INFO : cedarc <cdc_log_set_level:78>: Set log level to 5 from /etc/cedarc.conf I0101 05:24:51.154759 340 VideoEnc_Component.c:1353] <CedarvEncInit> VencChn[0] set VbrOptEn 0 I0101 05:24:51.155822 340 VideoEnc_Component.c:1375] <CedarvEncInit> VencChn[0] set ProductCase mode: 0 WARNING: cedarc <CheckSetParamInt:778>: Notice: sVbrParam.nQuality is 10, but its suggested value is 1 ! I0101 05:24:51.157090 333 VideoEnc_Component.c:990] <setVbvBufferConfig> bitrate: 1953 Kbps, set encode vbv size [1442816]bytes, frame length threshold [942080]bytes I0101 05:24:51.157400 333 VideoEnc_Component.c:2537] <CedarvVideoEncInit> VencChn[0] Online Mode=1,Chn=0,BufNum=0,OnlineEnFlag=0,sensorID=0,bkID=0,VcuOn=1,MultiSensorOnlineEn=0 WARNING: cedarc <resetEncoderVcu:887>: reset vcu and encoder [1970-01-01 05:24:51.231] [info] [RtspServerImpl.cpp:166] rtsp server start! url: rtsp://192.168.31.191:8554/ch0 W0101 05:24:51.233866 333 VideoDec_Component.c:2539] <VideoDecComponentTunnelRequest> Low probability! input portIndex[0] buffer supplier[1] is not same as output portIndex[1] buffer supplier[2], respect output port decision! I0101 05:24:51.235034 333 VideoEnc_Component.c:8055] <VideoEncComponentTunnelRequest> set inputPortTunnelFlag = TRUE W0101 05:24:51.650037 333 uvcInput.c:460] <uvcInput_SetDevEnable> Be careful! uvcDev[/dev/video0] streamon cost:413ms I0101 05:24:51.651608 338 VideoDec_Component.c:676] <CedarvCodecInit> video_format: 0x101 W0101 05:24:51.653470 345 uvcInput.c:1222] <uvcInput_CapThread> loop uvcInput_CapThread the UVC name is /dev/video0 , fd = 8 I0101 05:24:51.665980 338 VideoDec_Component.c:781] <CedarvCodecInit> vdec output format set to [0x6] I0101 05:24:51.666434 338 VideoDec_Component.c:799] <CedarvCodecInit> config vbvBufferSize[0]KB WARNING: cedarc <InitializeVideoDecoder:470>: warning: the nDecodeSmoothFrameBufferNum is 0 WARNING: cedarc <InitializeVideoDecoder:476>: warning: the nDeInterlaceHoldingFrameBufferNum is 0 I0101 05:24:51.696103 338 VideoDec_Component.c:876] <CedarvCodecInit> vdecChn[0] video stream info:codecType[0x101], size[1280x720], frameRate[30000], isFramePackage[1] I0101 05:24:51.697782 339 VideoDec_InputThread.c:303] <InputThread> tunnel_BufferSupplyOutput is not processed here. E0101 05:24:51.854970 345 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout! E0101 05:24:52.055609 345 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout! W0101 05:24:52.199092 338 VideoDec_Component.c:4619] <ComponentThread> fatal error! wait vbs data timeout! [1970-01-01 05:24:52.197] [error] [Uvc2Dec2Enc.cpp:194] fatal error! why not get stream from venc for too long? ret=0x-5ff67ff2 W0101 05:24:52.237116 340 VideoEnc_Component.c:10888] <ComponentThread> Be careful! vencChn[0] timeout for waiting outputStream. input frames stat:ready[0]+using[0]+used[0]=total[0] E0101 05:24:52.256233 345 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout! E0101 05:24:52.456973 345 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout! E0101 05:24:52.657617 345 uvcInput.c:884] <uvcInput_WaiteBuffer> the /dev/video0 UVC select timeout!用v4l2-ctl获取mjpeg流,能正确运行。
v4l2-ctl -d /dev/video0 --set-fmt-video=width=640,height=480,pixelformat=MJPG --stream-mmap --stream-to=test.mjpg 输出: < 64.45 fps, dropped buffers: 71 < 64.83 fps, dropped buffers: 66 < 64.72 fps, dropped buffers: 52 << 65.22 fps, dropped buffers: 132 <<< 65.38 fps, dropped buffers: 64 <<< 66.11 fps, dropped buffers: 172 < 65.66 fps, dropped buffers: 43 <<< 65.75 fps, dropped buffers: 53 << 65.32 fps, dropped buffers: 50 << 64.37 fps, dropped buffers: 203 << 64.51 fps, dropped buffers: 61 < 64.06 fps, dropped buffers: 207 < 64.09 fps, dropped buffers: 121以下是uvc插入时的日志:
[ 5.186790] usb 1-1: New USB device found, idVendor=046d, idProduct=0843, bcdDevice= 0.13 [ 5.187704] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=1 [ 5.188525] usb 1-1: Product: Logitech Webcam C930e [ 5.189064] usb 1-1: SerialNumber: A597F8EE [ 5.190900] uvcvideo: Found UVC 1.00 device Logitech Webcam C930e (046d:0843) [ 5.196754] input: Logitech Webcam C930e as /devices/platform/soc@2002000/44101000.ehci0-controller/usb1/1-12请问如何修复此问题?
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号