shiyinghan / UVCAndroid

Apache License 2.0
184 stars 50 forks source link

录像会崩溃 #38

Open NEO-LION opened 1 year ago

NEO-LION commented 1 year ago

点击录像功能会崩溃 image FATAL EXCEPTION: VideoCaptureaudio encoding thread Process: com.herohan.uvcdemo, PID: 14018 java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.MediaMuxer.addTrack(android.media.MediaFormat)' on a null object reference at com.herohan.uvcapp.VideoCapture.audioEncode(VideoCapture.java:903) at com.herohan.uvcapp.VideoCapture.lambda$startRecording$0$com-herohan-uvcapp-VideoCapture(VideoCapture.java:430) at com.herohan.uvcapp.VideoCapture$$ExternalSyntheticLambda0.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.os.HandlerThread.run(HandlerThread.java:65)

shiyinghan commented 1 year ago

应该还有其他的错误日志吧,我看这个截图,录像功能初始化应该没有成功

NEO-LION commented 1 year ago

--------- beginning of main 2023-08-17 17:16:04.711 19295-19327 [Gralloc] com.herohan.uvcdemo I Got handle 3 for fd 63 2023-08-17 17:16:04.711 19295-19327 [Gralloc] com.herohan.uvcdemo I leave, w : 1200, h : 1920, format : 0x1,internal_format : 0x1, usage : 0xb00. size=9216000,pixel_stride=1200,byte_stride=4800 2023-08-17 17:16:04.711 19295-19327 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=63,share_attr_fd=64 --------- beginning of system 2023-08-17 17:16:04.745 504-4479 ActivityManager system_process E getPackageFerformanceMode--ComponentInfo{com.herohan.uvcdemo/com.herohan.uvcdemo.RecordVideoActivity}----com.herohan.uvcdemo 2023-08-17 17:16:04.751 19295-19327 [Gralloc] com.herohan.uvcdemo I Got handle 4 for fd 67 2023-08-17 17:16:04.751 19295-19327 [Gralloc] com.herohan.uvcdemo I leave, w : 1200, h : 1920, format : 0x1,internal_format : 0x1, usage : 0xb00. size=9216000,pixel_stride=1200,byte_stride=4800 2023-08-17 17:16:04.751 19295-19327 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=67,share_attr_fd=68 2023-08-17 17:16:04.764 504-4479 ActivityManager system_process E getPackageFerformanceMode--ComponentInfo{com.herohan.uvcdemo/com.herohan.uvcdemo.RecordVideoActivity}----com.herohan.uvcdemo 2023-08-17 17:16:04.866 19295-19295 BasicPreviewActivity com.herohan.uvcdemo D initCameraHelper: 2023-08-17 17:16:04.867 19295-19295 CameraHelper com.herohan.uvcdemo D Constructor: 2023-08-17 17:16:04.873 19295-19295 USBMonitor com.herohan.uvcdemo V USBMonitor:Constructor 2023-08-17 17:16:04.877 19295-19295 USBMonitor com.herohan.uvcdemo V USBMonitor:mUsbManager=android.hardware.usb.UsbManager@9800342 2023-08-17 17:16:04.877 19295-19295 CameraHelper com.herohan.uvcdemo D registerCallback: 2023-08-17 17:16:04.877 19295-19295 CameraConnectionService com.herohan.uvcdemo D mUSBMonitor#register: 2023-08-17 17:16:04.879 19295-19295 USBMonitor com.herohan.uvcdemo I register: 2023-08-17 17:16:04.953 19295-19327 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , egl_color_buffer_format *, EGLBoolean) returns 0x3000 2023-08-17 17:16:04.974 19295-19295 CameraHelper com.herohan.uvcdemo D addSurface:surface=Surface(name=null)/@0x77fb5cb,isRecordable=false 2023-08-17 17:16:05.023 19295-19327 [Gralloc] com.herohan.uvcdemo I Got handle 5 for fd 78 2023-08-17 17:16:05.023 19295-19327 [Gralloc] com.herohan.uvcdemo I leave, w : 1200, h : 1920, format : 0x1,internal_format : 0x1, usage : 0xb00. size=9216000,pixel_stride=1200,byte_stride=4800 2023-08-17 17:16:05.023 19295-19327 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=78,share_attr_fd=79 2023-08-17 17:16:05.057 19295-19391 USBMonitor com.herohan.uvcdemo D DeviceCheckRunnable onAttach:device=/dev/bus/usb/002/005 2023-08-17 17:16:05.057 19295-19391 CameraConnectionService com.herohan.uvcdemo D OnDeviceConnectListener#onAttach: 2023-08-17 17:16:05.058 19295-19391 CameraHelper com.herohan.uvcdemo D onAttach: 2023-08-17 17:16:05.058 19295-19306 zygote64 com.herohan.uvcdemo I Do partial code cache collection, code=52KB, data=52KB 2023-08-17 17:16:05.058 19295-19391 USBMonitor com.herohan.uvcdemo D DeviceCheckRunnable onAttach:device=/dev/bus/usb/001/003 2023-08-17 17:16:05.058 19295-19391 CameraConnectionService com.herohan.uvcdemo D OnDeviceConnectListener#onAttach: 2023-08-17 17:16:05.059 19295-19391 CameraHelper com.herohan.uvcdemo D onAttach: 2023-08-17 17:16:05.060 19295-19306 zygote64 com.herohan.uvcdemo I After code cache collection, code=52KB, data=52KB 2023-08-17 17:16:05.060 19295-19306 zygote64 com.herohan.uvcdemo I Increasing code cache capacity to 256KB 2023-08-17 17:16:05.063 19295-19306 zygote64 com.herohan.uvcdemo I Compiler allocated 7MB to compile void android.widget.TextView.(android.content.Context, android.util.AttributeSet, int, int) 2023-08-17 17:16:05.082 19295-19327 [Gralloc] com.herohan.uvcdemo I Got handle 6 for fd 81 2023-08-17 17:16:05.082 19295-19327 [Gralloc] com.herohan.uvcdemo I leave, w : 1200, h : 1920, format : 0x1,internal_format : 0x1, usage : 0xb00. size=9216000,pixel_stride=1200,byte_stride=4800 2023-08-17 17:16:05.082 19295-19327 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=81,share_attr_fd=82 2023-08-17 17:16:05.099 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V onAttach: 2023-08-17 17:16:05.099 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V selectDevice:device=/dev/bus/usb/002/005 2023-08-17 17:16:05.100 19295-19295 CameraHelper com.herohan.uvcdemo D selectDevice:device=/dev/bus/usb/002/005 com.herohan.uvcapp.CameraHelper@c671a8 2023-08-17 17:16:05.100 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V onAttach: 2023-08-17 17:16:05.100 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V selectDevice:device=/dev/bus/usb/001/003 2023-08-17 17:16:05.100 19295-19295 CameraHelper com.herohan.uvcdemo D selectDevice:device=/dev/bus/usb/001/003 com.herohan.uvcapp.CameraHelper@c671a8 2023-08-17 17:16:05.100 19295-19390 CameraConnectionService com.herohan.uvcdemo D CameraConnection#selectDevice:device=/dev/bus/usb/002/005 2023-08-17 17:16:05.101 19295-19390 CameraConnectionService com.herohan.uvcdemo I request permission 2023-08-17 17:16:05.101 19295-19390 USBMonitor com.herohan.uvcdemo V requestPermission:device=/dev/bus/usb/002/005 2023-08-17 17:16:05.106 19295-19390 USBMonitor com.herohan.uvcdemo V processOpenDevice:device=/dev/bus/usb/002/005 2023-08-17 17:16:05.108 19295-19390 USBMonitor com.herohan.uvcdemo I UsbControlBlock:constructor 2023-08-17 17:16:05.110 19295-19390 USBMonitor com.herohan.uvcdemo I UsbControlBlock#open: 2023-08-17 17:16:05.133 19295-19390 UsbDeviceConnectionJNI com.herohan.uvcdemo D close 2023-08-17 17:16:05.136 19295-19390 USBMonitor com.herohan.uvcdemo I name=/dev/bus/usb/002/005,desc=50,busnum=2,devnum=5 2023-08-17 17:16:05.139 19295-19390 CameraConnectionService com.herohan.uvcdemo I wait for getting permission 2023-08-17 17:16:05.143 19295-19391 CameraConnectionService com.herohan.uvcdemo D addCamera:device=/dev/bus/usb/002/005 2023-08-17 17:16:05.145 262-888 BufferQueueProducer surfaceflinger E [com.herohan.uvcdemo/com.herohan.uvcdemo.EntryActivity#0] disconnect: not connected (req=1) 2023-08-17 17:16:05.146 19295-19391 CameraInternal com.herohan.uvcdemo D Constructor: 2023-08-17 17:16:05.148 19295-19327 libEGL com.herohan.uvcdemo W EGLNativeWindowType 0x7d16683010 disconnect failed 2023-08-17 17:16:05.148 19295-19327 OpenGLRenderer com.herohan.uvcdemo D endAllActiveAnimators on 0x7d0968bc00 (RippleDrawable) with handle 0x7d0875e1e0 2023-08-17 17:16:05.154 19295-19391 EGLBase14 com.herohan.uvcdemo D EGLContext created, client version 3 2023-08-17 17:16:05.160 19295-19390 CameraConnectionService com.herohan.uvcdemo I check CameraInternal again 2023-08-17 17:16:05.160 19295-19390 CameraConnectionService com.herohan.uvcdemo I success to get service:serviceId=2005 2023-08-17 17:16:05.160 19295-19390 CameraConnectionService com.herohan.uvcdemo D CameraConnection#selectDevice:device=/dev/bus/usb/001/003 2023-08-17 17:16:05.160 19295-19390 CameraConnectionService com.herohan.uvcdemo I request permission 2023-08-17 17:16:05.161 19295-19390 USBMonitor com.herohan.uvcdemo V requestPermission:device=/dev/bus/usb/001/003 2023-08-17 17:16:05.163 19295-19390 USBMonitor com.herohan.uvcdemo V processOpenDevice:device=/dev/bus/usb/001/003 2023-08-17 17:16:05.163 19295-19390 USBMonitor com.herohan.uvcdemo I UsbControlBlock:constructor 2023-08-17 17:16:05.163 19295-19390 USBMonitor com.herohan.uvcdemo I UsbControlBlock#open: 2023-08-17 17:16:05.171 19295-19390 UsbDeviceConnectionJNI com.herohan.uvcdemo D close 2023-08-17 17:16:05.173 19295-19393 EGLBase14 com.herohan.uvcdemo D EGLContext created, client version 3 2023-08-17 17:16:05.174 19295-19390 USBMonitor com.herohan.uvcdemo I name=/dev/bus/usb/001/003,desc=60,busnum=1,devnum=3 2023-08-17 17:16:05.175 19295-19390 CameraConnectionService com.herohan.uvcdemo I wait for getting permission 2023-08-17 17:16:05.175 19295-19391 CameraConnectionService com.herohan.uvcdemo D number of existed camera=1 2023-08-17 17:16:05.176 19295-19391 CameraInternal com.herohan.uvcdemo D registerCallback: 2023-08-17 17:16:05.176 19295-19391 CameraHelper com.herohan.uvcdemo D onDeviceOpen: 2023-08-17 17:16:05.177 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V onDeviceOpen: 2023-08-17 17:16:05.177 19295-19391 CameraConnectionService com.herohan.uvcdemo D OnDeviceConnectListener#onDeviceOpen: 2023-08-17 17:16:05.177 19295-19391 CameraConnectionService com.herohan.uvcdemo D addCamera:device=/dev/bus/usb/001/003 2023-08-17 17:16:05.177 19295-19295 CameraHelper com.herohan.uvcdemo D openCamera: com.herohan.uvcapp.CameraHelper@c671a8 2023-08-17 17:16:05.177 19295-19391 CameraInternal com.herohan.uvcdemo D Constructor: 2023-08-17 17:16:05.182 19295-19391 EGLBase14 com.herohan.uvcdemo D EGLContext created, client version 3 2023-08-17 17:16:05.187 19295-19390 CameraConnectionService com.herohan.uvcdemo I check CameraInternal again 2023-08-17 17:16:05.187 19295-19390 CameraConnectionService com.herohan.uvcdemo I success to get service:serviceId=1003 2023-08-17 17:16:05.188 19295-19390 CameraConnectionService com.herohan.uvcdemo D CameraConnection#openCamera: 2023-08-17 17:16:05.188 19295-19390 CameraInternal com.herohan.uvcdemo D openCamera: 2023-08-17 17:16:05.189 19295-19390 CameraInternal com.herohan.uvcdemo D resetUVCCamera: com.herohan.uvcapp.CameraInternal@1efc466 2023-08-17 17:16:05.189 19295-19390 RendererHolder com.herohan.uvcdemo V removeSlaveSurfaceAll 2023-08-17 17:16:05.189 19295-19391 CameraConnectionService com.herohan.uvcdemo D number of existed camera=2 2023-08-17 17:16:05.189 19295-19391 CameraInternal com.herohan.uvcdemo D registerCallback: 2023-08-17 17:16:05.189 19295-19391 CameraHelper com.herohan.uvcdemo D onDeviceOpen: 2023-08-17 17:16:05.190 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V onDeviceOpen: 2023-08-17 17:16:05.190 19295-19295 CameraHelper com.herohan.uvcdemo D openCamera: com.herohan.uvcapp.CameraHelper@c671a8 2023-08-17 17:16:05.192 19295-19400 RendererHolder com.herohan.uvcdemo V handleRemoveSurfaceAll: 2023-08-17 17:16:05.193 19295-19390 CameraInternal com.herohan.uvcdemo D openUVCCamera: com.herohan.uvcapp.CameraInternal@1efc466 2023-08-17 17:16:05.201 19295-19400 EGLBase14 com.herohan.uvcdemo D EGLContext created, client version 3 2023-08-17 17:16:05.215 19295-19390 USBMonitor com.herohan.uvcdemo I UsbControlBlock:constructor 2023-08-17 17:16:05.215 19295-19390 USBMonitor com.herohan.uvcdemo I UsbControlBlock#open: 2023-08-17 17:16:05.226 19295-19390 UsbDeviceConnectionJNI com.herohan.uvcdemo D close 2023-08-17 17:16:05.228 19295-19390 USBMonitor com.herohan.uvcdemo I name=/dev/bus/usb/001/003,desc=70,busnum=1,devnum=3 2023-08-17 17:16:05.288 19295-19390 UVCCamera com.herohan.uvcdemo D setPreviewSize:0:Size(2592x1944@30,type:7) 2023-08-17 17:16:05.310 19295-19390 CameraInternal com.herohan.uvcdemo I supportedSize:{"formats":[{"index":1,"subType":6,"defaultFrameIndex":1,"frameDescriptors":[{"width":640,"height":480,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":7,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30},{"index":1,"value":400000,"fps":25},{"index":2,"value":500000,"fps":20},{"index":3,"value":666666,"fps":15},{"index":4,"value":1000000,"fps":10},{"index":5,"value":2000000,"fps":5},{"index":6,"value":5000000,"fps":2}]},{"width":2592,"height":1944,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":2592,"height":1520,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":2048,"height":1536,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":1920,"height":1080,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":1600,"height":1200,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":1280,"height":720,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":1024,"height":768,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":800,"height":600,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":320,"height":240,"subType":7,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]}]},{"index":2,"subType":4,"defaultFrameIndex":1,"frameDescriptors":[{"width":2592,"height":1944,"subType":5,"defaultFrameInterval":5000000,"frameIntervalType":1,"defaultFps":2,"intervals":[{"index":0,"value":5000000,"fps":2}]},{"width":2592,"height":1520,"subType":5,"defaultFrameInterval":5000000,"frameIntervalType":1,"defaultFps":2,"intervals":[{"index":0,"value":5000000,"fps":2}]},{"width":2048,"height":1536,"subType":5,"defaultFrameInterval":5000000,"frameIntervalType":1,"defaultFps":2,"intervals":[{"index":0,"value":5000000,"fps":2}]},{"width":1920,"height":1080,"subType":5,"defaultFrameInterval":2000000,"frameIntervalType":1,"defaultFps":5,"intervals":[{"index":0,"value":2000000,"fps":5}]},{"width":1600,"height":1200,"subType":5,"defaultFrameInterval":2000000,"frameIntervalType":1,"defaultFps":5,"intervals":[{"index":0,"value":2000000,"fps":5}]},{"width":1280,"height":720,"subType":5,"defaultFrameInterval":1000000,"frameIntervalType":1,"defaultFps":10,"intervals":[{"index":0,"value":1000000,"fps":10}]},{"width":1024,"height":768,"subType":5,"defaultFrameInterval":666666,"frameIntervalType":1,"defaultFps":15,"intervals":[{"index":0,"value":666666,"fps":15}]},{"width":800,"height":600,"subType":5,"defaultFrameInterval":500000,"frameIntervalType":1,"defaultFps":20,"intervals":[{"index":0,"value":500000,"fps":20}]},{"width":640,"height":480,"subType":5,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]},{"width":320,"height":240,"subType":5,"defaultFrameInterval":333333,"frameIntervalType":1,"defaultFps":30,"intervals":[{"index":0,"value":333333,"fps":30}]}]}]} 2023-08-17 17:16:05.310 19295-19390 CameraInternal com.herohan.uvcdemo D setCameraPreviewConfig: 2023-08-17 17:16:05.311 19295-19390 CameraInternal com.herohan.uvcdemo D rotateTo:0 2023-08-17 17:16:05.311 19295-19390 CameraInternal com.herohan.uvcdemo D setMirrorMode:0 2023-08-17 17:16:05.319 19295-19405 OMXClient com.herohan.uvcdemo I Treble IOmx obtained 2023-08-17 17:16:05.331 19295-19409 OMXClient com.herohan.uvcdemo I Treble IOmx obtained 2023-08-17 17:16:05.339 19295-19405 OMXClient com.herohan.uvcdemo I Treble IOmx obtained 2023-08-17 17:16:05.350 19295-19405 OMXUtils com.herohan.uvcdemo W do not know color format 0x7f000789 = 2130708361 2023-08-17 17:16:05.351 19295-19405 ACodec com.herohan.uvcdemo I setupAVCEncoderParameters with [profile: Baseline] [level: Level31] 2023-08-17 17:16:05.352 19295-19405 ACodec com.herohan.uvcdemo I [OMX.rk.video_encoder.avc] cannot encode HDR static metadata. Ignoring. 2023-08-17 17:16:05.352 19295-19405 ACodec com.herohan.uvcdemo I setupVideoEncoder succeeded 2023-08-17 17:16:05.353 19295-19405 OMXUtils com.herohan.uvcdemo W do not know color format 0x7f000789 = 2130708361 2023-08-17 17:16:05.357 19295-19405 ColorUtils com.herohan.uvcdemo W expected specified color aspects (0:0:0:0) 2023-08-17 17:16:05.366 19295-19409 OMXClient com.herohan.uvcdemo I Treble IOmx obtained 2023-08-17 17:16:05.386 19295-19390 VideoCapture com.herohan.uvcdemo I source: 5 audioSampleRate: 8000 channelConfig: 16 audioFormat: 2 bufferSize: 768 2023-08-17 17:16:05.386 19295-19390 CameraInternal com.herohan.uvcdemo D processOnCameraOpen: 2023-08-17 17:16:05.387 19295-19390 CameraHelper com.herohan.uvcdemo D onCameraOpen: 2023-08-17 17:16:05.387 19295-19295 BasicPreviewActivity com.herohan.uvcdemo V onCameraOpen: 2023-08-17 17:16:05.388 19295-19295 CameraHelper com.herohan.uvcdemo D startPreview: com.herohan.uvcapp.CameraHelper@c671a8 2023-08-17 17:16:05.388 19295-19295 CameraHelper com.herohan.uvcdemo D getPreviewSize: 2023-08-17 17:16:05.388 19295-19295 CameraHelper com.herohan.uvcdemo D addSurface:surface=Surface(name=null)/@0x77fb5cb,isRecordable=false 2023-08-17 17:16:05.389 19295-19390 CameraConnectionService com.herohan.uvcdemo D CameraConnection#startPreview: 2023-08-17 17:16:05.389 19295-19390 CameraInternal com.herohan.uvcdemo D startPreview: com.herohan.uvcapp.CameraInternal@1efc466 2023-08-17 17:16:05.389 19295-19390 CameraInternal com.herohan.uvcdemo D updateRendererSize: 2023-08-17 17:16:05.399 19295-19390 CameraConnectionService com.herohan.uvcdemo D CameraConnection#addSurface:surface=Surface(name=null)/@0x77fb5cb 2023-08-17 17:16:05.399 19295-19390 CameraInternal com.herohan.uvcdemo D addSurface:surface=Surface(name=null)/@0x77fb5cb 2023-08-17 17:16:05.400 19295-19390 RendererHolder com.herohan.uvcdemo V addSlaveSurface:id=125810123,surface=Surface(name=null)/@0x77fb5cb 2023-08-17 17:16:05.400 19295-19419 libUVCCamera com.herohan.uvcdemo I [19419UVCPreview.cpp:531:prepare_preview]:frameSize=(2592,1944)@MJPEG 2023-08-17 17:16:05.403 19295-19400 EGLBase14 com.herohan.uvcdemo D EGLContext created, client version 3 2023-08-17 17:16:05.409 19295-19400 RendererHolder com.herohan.uvcdemo V handleAddSurface:id=125810123 2023-08-17 17:16:05.409 19295-19400 RendererHolder com.herohan.uvcdemo V checkSurface 2023-08-17 17:16:05.411 19295-19400 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void *, EGLSurface, EGLConfig, egl_winsys_surface , egl_color_buffer_format , EGLBoolean) returns 0x3000 2023-08-17 17:16:05.715 19295-19421 libUVCCamera com.herohan.uvcdemo I [19421UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:05.716 19295-19419 libUVCCamera com.herohan.uvcdemo I [19419UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:05.750 19295-19421 libUVCCamera com.herohan.uvcdemo I [19421UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:05.782 19295-19421 chatty com.herohan.uvcdemo I uid=10072(com.herohan.uvcdemo) preview_thread identical 1 line 2023-08-17 17:16:05.816 19295-19421 libUVCCamera com.herohan.uvcdemo I [19421UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:05.849 19295-19421 libUVCCamera com.herohan.uvcdemo I [19421UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:05.875 19295-19419 [Gralloc] com.herohan.uvcdemo I Got handle 1 for fd 95 2023-08-17 17:16:05.875 19295-19419 [Gralloc] com.herohan.uvcdemo I leave, w : 2592, h : 1944, format : 0x1,internal_format : 0x1, usage : 0x133. size=20155392,pixel_stride=2592,byte_stride=10368 2023-08-17 17:16:05.875 19295-19419 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=95,share_attr_fd=96 2023-08-17 17:16:05.916 19295-19400 [Gralloc] com.herohan.uvcdemo I Got handle 2 for fd 101 2023-08-17 17:16:05.916 19295-19400 [Gralloc] com.herohan.uvcdemo I leave, w : 1056, h : 1408, format : 0x1,internal_format : 0x1, usage : 0xb00. size=5947392,pixel_stride=1056,byte_stride=4224 2023-08-17 17:16:05.916 19295-19400 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=101,share_attr_fd=102 2023-08-17 17:16:05.916 19295-19421 libUVCCamera com.herohan.uvcdemo I [19421UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:05.938 19295-19400 [Gralloc] com.herohan.uvcdemo I Got handle 3 for fd 104 2023-08-17 17:16:05.938 19295-19400 [Gralloc] com.herohan.uvcdemo I leave, w : 1056, h : 1408, format : 0x1,internal_format : 0x1, usage : 0xb00. size=5947392,pixel_stride=1056,byte_stride=4224 2023-08-17 17:16:05.938 19295-19400 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=104,share_attr_fd=105 2023-08-17 17:16:06.051 19295-19419 [Gralloc] com.herohan.uvcdemo I Got handle 4 for fd 98 2023-08-17 17:16:06.051 19295-19419 [Gralloc] com.herohan.uvcdemo I leave, w : 2592, h : 1944, format : 0x1,internal_format : 0x1, usage : 0x133. size=20155392,pixel_stride=2592,byte_stride=10368 2023-08-17 17:16:06.051 19295-19419 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=98,share_attr_fd=99 2023-08-17 17:16:06.080 19295-19421 libUVCCamera com.herohan.uvcdemo I [19421UVCPreview.cpp:115:get_frame]:allocate new frame 2023-08-17 17:16:06.115 19295-19400 [Gralloc] com.herohan.uvcdemo I Got handle 7 for fd 111 2023-08-17 17:16:06.115 19295-19400 [Gralloc] com.herohan.uvcdemo I leave, w : 1056, h : 1408, format : 0x1,internal_format : 0x1, usage : 0xb00. size=5947392,pixel_stride=1056,byte_stride=4224 2023-08-17 17:16:06.115 19295-19400 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=111,share_attr_fd=112 2023-08-17 17:16:08.335 19295-19405 AMessage com.herohan.uvcdemo W failed to deliver message as target handler 1 is gone. 2023-08-17 17:16:08.362 19295-19409 AMessage com.herohan.uvcdemo W failed to deliver message as target handler 4 is gone. 2023-08-17 17:16:15.265 19295-19306 zygote64 com.herohan.uvcdemo I Do full code cache collection, code=123KB, data=91KB 2023-08-17 17:16:15.267 19295-19306 zygote64 com.herohan.uvcdemo I After code cache collection, code=90KB, data=54KB 2023-08-17 17:16:21.402 19295-19295 CameraHelper com.herohan.uvcdemo D isRecording: 2023-08-17 17:16:21.410 19295-19295 CameraHelper com.herohan.uvcdemo D startRecording 2023-08-17 17:16:21.410 19295-19390 CameraConnectionService com.herohan.uvcdemo D CameraConnection#startRecording 2023-08-17 17:16:21.411 19295-19390 VideoCapture com.herohan.uvcdemo I startRecording 2023-08-17 17:16:21.466 19295-19390 VideoCapture com.herohan.uvcdemo I videoEncoder start 2023-08-17 17:16:21.484 19295-19405 ACodec com.herohan.uvcdemo E [OMX.rk.video_encoder.avc] ERROR(0x80001000) 2023-08-17 17:16:21.484 19295-19405 ACodec com.herohan.uvcdemo E signalError(omxError 0x80001000, internalError -2147483648) 2023-08-17 17:16:21.485 19295-19404 MediaCodec com.herohan.uvcdemo E Codec reported err 0x80001000, actionCode 0, while in state 6 2023-08-17 17:16:21.487 19295-19390 VideoCapture com.herohan.uvcdemo I audioEncoder start 2023-08-17 17:16:21.509 19295-19390 RendererHolder com.herohan.uvcdemo V addSlaveSurface:id=158336492,surface=Surface(name=null)/@0x97005ec 2023-08-17 17:16:21.509 19295-19400 RendererHolder com.herohan.uvcdemo V handleAddSurface:id=158336492 2023-08-17 17:16:21.509 19295-19400 RendererHolder com.herohan.uvcdemo V checkSurface 2023-08-17 17:16:21.510 19295-19400 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , egl_color_buffer_format , EGLBoolean) returns 0x3000 2023-08-17 17:16:21.515 19295-19402 VideoCapture com.herohan.uvcdemo I videoEncoder stop 2023-08-17 17:16:21.516 19295-19402 VideoCapture com.herohan.uvcdemo I check Recording Result First Video Key Frame Write: false 2023-08-17 17:16:21.516 19295-19402 VideoCapture com.herohan.uvcdemo I The recording result has no key frame. 2023-08-17 17:16:21.516 19295-19402 VideoCapture com.herohan.uvcdemo I Delete file. 2023-08-17 17:16:21.517 19295-19402 VideoCapture com.herohan.uvcdemo I Video encode thread end. 2023-08-17 17:16:21.519 19295-19466 RendererHolder com.herohan.uvcdemo V removeSlaveSurface:id=158336492 2023-08-17 17:16:21.527 19295-19400 RendererHolder com.herohan.uvcdemo V handleRemoveSurface:id=158336492 2023-08-17 17:16:21.574 19295-19400 [Gralloc] com.herohan.uvcdemo I Got handle 8 for fd 127 2023-08-17 17:16:21.575 19295-19400 [Gralloc] com.herohan.uvcdemo I leave, w : 2592, h : 1944, format : 0x1,internal_format : 0x1, usage : 0x10200. size=20155392,pixel_stride=2592,byte_stride=10368 2023-08-17 17:16:21.575 19295-19400 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=127,share_attr_fd=128 2023-08-17 17:16:21.597 19295-19400 libEGL com.herohan.uvcdemo W EGLNativeWindowType 0x7d08713010 disconnect failed 2023-08-17 17:16:21.598 19295-19400 RendererHolder com.herohan.uvcdemo V checkSurface 2023-08-17 17:16:21.625 19295-19327 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void *, EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000 2023-08-17 17:16:21.660 19295-19327 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , egl_color_buffer_format , EGLBoolean) returns 0x3000 --------- beginning of crash 2023-08-17 17:16:21.674 19295-19403 AndroidRuntime com.herohan.uvcdemo E FATAL EXCEPTION: VideoCaptureaudio encoding thread Process: com.herohan.uvcdemo, PID: 19295 java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.MediaMuxer.addTrack(android.media.MediaFormat)' on a null object reference at com.herohan.uvcapp.VideoCapture.audioEncode(VideoCapture.java:903) at com.herohan.uvcapp.VideoCapture.lambda$startRecording$0$com-herohan-uvcapp-VideoCapture(VideoCapture.java:430) at com.herohan.uvcapp.VideoCapture$$ExternalSyntheticLambda0.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.os.HandlerThread.run(HandlerThread.java:65) 2023-08-17 17:16:21.695 19295-19327 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void *, EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000 2023-08-17 17:16:21.700 19295-19403 Process com.herohan.uvcdemo I Sending signal. PID: 19295 SIG: 9 2023-08-17 17:16:21.889 504-581 InputDispatcher system_process E channel 'fbf627d com.herohan.uvcdemo/com.herohan.uvcdemo.RecordVideoActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 2023-08-17 17:16:21.889 504-581 InputDispatcher system_process E channel '313137 com.herohan.uvcdemo/com.herohan.uvcdemo.EntryActivity (server)' ~ Channel is unrecoverably broken and will be disposed! ---------------------------- PROCESS ENDED (19295) for package com.herohan.uvcdemo ---------------------------- 2023-08-17 17:16:21.949 262-283 SurfaceFlinger surfaceflinger E Failed to find layer (SurfaceView - com.herohan.uvcdemo/com.herohan.uvcdemo.RecordVideoActivity#0) in layer parent (no-parent). 2023-08-17 17:16:21.961 262-282 SurfaceFlinger surfaceflinger E Failed to find layer (Background for - SurfaceView - com.herohan.uvcdemo/com.herohan.uvcdemo.RecordVideoActivity#0) in layer parent (no-parent). 2023-08-17 17:16:21.981 504-4479 ActivityManager system_process E getPackageFerformanceMode--ComponentInfo{com.herohan.uvcdemo/com.herohan.uvcdemo.EntryActivity}----com.herohan.uvcdemo ---------------------------- PROCESS STARTED (19475) for package com.herohan.uvcdemo ---------------------------- 2023-08-17 17:16:22.432 19475-19501 OpenGLRenderer com.herohan.uvcdemo D HWUI GL Pipeline 2023-08-17 17:16:22.518 19475-19501 mali_so com.herohan.uvcdemo I [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 947; [Func] : base_context_deal_with_version_affairs_rk_ext; arm_release_ver of this mali_so is 'r18p0-01rel0', rk_so_ver is '11@0'. 2023-08-17 17:16:22.518 19475-19501 mali_so com.herohan.uvcdemo I [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 914; [Func] : determine_policy_against_patch_for_sf_memory_leak; cmdline : com.herohan.uvcdemo, we should GO THROUGH patch_for_sf_memory_leak. 2023-08-17 17:16:22.518 19475-19501 mali_so com.herohan.uvcdemo D [File] : hardware/arm/maliT760/driver/product/base/src/mali_base_kbase.c; [Line] : 955; [Func] : base_context_deal_with_version_affairs_rk_ext; current process is NOT sf, to bail out. 2023-08-17 17:16:22.539 19475-19480 zygote64 com.herohan.uvcdemo I Do partial code cache collection, code=25KB, data=23KB 2023-08-17 17:16:22.539 19475-19480 zygote64 com.herohan.uvcdemo I After code cache collection, code=25KB, data=23KB 2023-08-17 17:16:22.539 19475-19480 zygote64 com.herohan.uvcdemo I Increasing code cache capacity to 128KB 2023-08-17 17:16:22.540 19475-19480 zygote64 com.herohan.uvcdemo I Do partial code cache collection, code=25KB, data=43KB 2023-08-17 17:16:22.540 19475-19480 zygote64 com.herohan.uvcdemo I After code cache collection, code=25KB, data=43KB 2023-08-17 17:16:22.540 19475-19480 zygote64 com.herohan.uvcdemo I Increasing code cache capacity to 256KB 2023-08-17 17:16:22.540 19475-19501 com.herohan.uvcdemo com.herohan.uvcdemo I android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 2023-08-17 17:16:22.540 19475-19480 zygote64 com.herohan.uvcdemo I Compiler allocated 7MB to compile void android.widget.TextView.(android.content.Context, android.util.AttributeSet, int, int) 2023-08-17 17:16:22.541 19475-19501 OpenGLRenderer com.herohan.uvcdemo I Initialized EGL, version 1.4 2023-08-17 17:16:22.541 19475-19501 OpenGLRenderer com.herohan.uvcdemo D Swap behavior 2 2023-08-17 17:16:22.590 19475-19501 mali_winsys com.herohan.uvcdemo D EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface *, egl_color_buffer_format , EGLBoolean) returns 0x3000 2023-08-17 17:16:22.718 19475-19501 [Gralloc] com.herohan.uvcdemo I Got handle 1 for fd 55 2023-08-17 17:16:22.718 19475-19501 [Gralloc] com.herohan.uvcdemo I leave, w : 1200, h : 1920, format : 0x1,internal_format : 0x1, usage : 0xb00. size=9216000,pixel_stride=1200,byte_stride=4800 2023-08-17 17:16:22.718 19475-19501 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=55,share_attr_fd=56 2023-08-17 17:16:22.774 19475-19501 [Gralloc] com.herohan.uvcdemo I Got handle 2 for fd 60 2023-08-17 17:16:22.774 19475-19501 [Gralloc] com.herohan.uvcdemo I leave, w : 1200, h : 1920, format : 0x1,internal_format : 0x1, usage : 0xb00. size=9216000,pixel_stride=1200,byte_stride=4800 2023-08-17 17:16:22.774 19475-19501 [Gralloc] com.herohan.uvcdemo I leave: prime_fd=60,share_attr_fd=61 以上就是全部日志了

shiyinghan commented 1 year ago

我看错误日志,是MediaCodec的底层驱动(OMX.rk.video_encoder.avc)报错了,你把分辨率参数设置低一点,再录像试试,现在分辨率(2592,1944)@Mjpeg有点高,有可能底层驱动不支持编码这么高的图像数据

NEO-LION commented 1 year ago

谢谢