pedroSG94 / RootEncoder

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin
Apache License 2.0
2.55k stars 773 forks source link

GLES20 error: 0x505 on GPU Mali T760 #481

Closed OleksandrAndro closed 4 years ago

OleksandrAndro commented 4 years ago

I have issue when stopping record on tablet with GPU MaliT760. Appearing in Surface mode RTMP activity (from demo project). This is my LogCat: 01-11 13:46:53.894 16174-16174/com.pedro.rtpstreamer I/CameraManagerGlobal: getCameraService: Reconnecting to camera service 01-11 13:46:53.901 16174-16191/com.pedro.rtpstreamer D/mmk: onStatusChangedLocked.+++++++ 01-11 13:46:53.901 16174-16191/com.pedro.rtpstreamer E/CameraManagerGlobal: Camera id 0 has status changed to 0x1 01-11 13:46:53.922 16174-16174/com.pedro.rtpstreamer I/CameraManager: Using legacy camera HAL. 01-11 13:46:53.960 16174-16190/com.pedro.rtpstreamer D/mmk: onStatusChangedLocked.+++++++ 01-11 13:46:53.961 16174-16190/com.pedro.rtpstreamer E/CameraManagerGlobal: Camera id 0 has status changed to 0x80000000 01-11 13:46:53.961 31341-31357/? D/CameraHal: Calling process is: com.pedro.rtpstreamer 01-11 13:46:54.040 31341-31357/? W/CameraService: CameraService::connect X (id 0, this pid is 31341, name com.pedro.rtpstreamer) 01-11 13:46:54.060 16174-16253/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state CONFIGURING 01-11 13:46:54.060 16174-16273/com.pedro.rtpstreamer I/RequestThread-0: Configure outputs: 1 surfaces configured. 01-11 13:46:54.060 16174-16273/com.pedro.rtpstreamer D/Camera: app passed NULL surface 01-11 13:46:54.070 16174-16174/com.pedro.rtpstreamer D/ViewRootImpl: 1024<<<<<< BACK FROM relayoutWM.LayoutParams{(0,0)(fillxfill)mPosX=0mPosY=0mHScale=1.0mVScale=1.0 align=UNDEFINE taskId=779 sim=#120 ty=1 fl=#81810180 fmt=-3 wanim=0x1030469 surfaceInsets=Rect(0, 0 - 0, 0) needsMenuKey=2packageName=com.pedro.rtpstreamertoken=android.os.BinderProxy@3945e2f5} 01-11 13:46:54.082 16174-16253/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state IDLE 01-11 13:46:54.090 16174-16253/com.pedro.rtpstreamer I/Camera2ApiManager: Camera opened 01-11 13:46:54.095 16174-16253/com.pedro.rtpstreamer I/RequestQueue: Repeating capture request set. 01-11 13:46:54.095 16174-16253/com.pedro.rtpstreamer I/Camera2ApiManager: Camera configured 01-11 13:46:54.099 16174-16273/com.pedro.rtpstreamer W/LegacyRequestMapper: convertRequestMetadata - control.awbRegions setting is not supported, ignoring value 01-11 13:46:54.100 16174-16273/com.pedro.rtpstreamer W/LegacyRequestMapper: convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported 01-11 13:46:54.119 464-492/system_process I/ActivityManagerService: Displayed com.pedro.rtpstreamer/.surfacemodeexample.SurfaceModeRtmpActivity: +384ms 01-11 13:46:54.167 16174-16174/com.pedro.rtpstreamer D/ViewRootImpl: 1024<<<<<< BACK FROM relayoutnull 01-11 13:46:54.273 16174-16174/com.pedro.rtpstreamer D/ViewRootImpl: 1024<<<<<< BACK FROM relayoutWM.LayoutParams{(0,0)(fillxfill)mPosX=0mPosY=0mHScale=1.0mVScale=1.0 align=UNDEFINE taskId=779 sim=#20 ty=1 fl=#81810100 wanim=0x1030469 surfaceInsets=Rect(0, 0 - 0, 0) needsMenuKey=2packageName=com.pedro.rtpstreamertoken=android.os.BinderProxy@34fb9d59} 01-11 13:46:54.650 16174-16274/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state CAPTURING 01-11 13:46:58.335 16174-16174/com.pedro.rtpstreamer I/MicrophoneManager: Microphone created, 32000hz, Stereo 01-11 13:46:58.362 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/mpeg2 01-11 13:46:58.373 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/flv 01-11 13:46:58.375 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/mjpeg 01-11 13:46:58.385 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/flv 01-11 13:46:58.389 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/mpeg2 01-11 13:46:58.392 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/vc1 01-11 13:46:58.399 16174-16174/com.pedro.rtpstreamer W/VideoCapabilities: Unsupported mime video/mjpeg 01-11 13:46:58.405 16174-16174/com.pedro.rtpstreamer W/AudioCapabilities: Unsupported mime audio/wav 01-11 13:46:58.417 16174-16174/com.pedro.rtpstreamer I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es 01-11 13:46:58.423 16174-16290/com.pedro.rtpstreamer I/OMXClient: Using client-side OMX mux. 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.avc 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.m4v 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.h263 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.flv1 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.m2v 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.rv 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.vp8 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.vc1 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.wmv3 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.vp6 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.hevc 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.mjpeg 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.avc.secure 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_decoder.vp9 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_encoder.avc 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: declares component OMX.rk.video_encoder.vp8 01-11 13:46:58.430 16174-16290/com.pedro.rtpstreamer I/libstagefrighthw: OMX IL core libOMX_Core.so: contains 16 components 01-11 13:46:58.435 16174-16290/com.pedro.rtpstreamer D/ACodec: MEDIA_MIMETYPE_AUDIO_AAC sampleRate 32000 wifidisplay_flag 0 info b820e068 01-11 13:46:58.437 16174-16174/com.pedro.rtpstreamer I/AudioEncoder: prepared 01-11 13:46:58.438 16174-16174/com.pedro.rtpstreamer D/DisplayManager: getDisplayInfo: displayId=0, info=DisplayInfo{"Встроенный экран", uniqueId "local:0", app 1024 x 552, real 1024 x 600, largest app 1024 x 951, smallest app 600 x 527, 60.932003 fps, supportedRefreshRates [60.932003], rotation 0, density 160 (159.5681 x 160.42105) dpi, layerStack 0, appVsyncOff 0, presDeadline 17411737, type BUILT_IN, state ON, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS} 01-11 13:46:58.438 16174-16174/com.pedro.rtpstreamer I/RequestQueue: Repeating capture request cancelled. 01-11 13:46:58.457 16174-16190/com.pedro.rtpstreamer E/BufferQueueProducer: [unnamed-16174-0] cancelBuffer: BufferQueue has been abandoned 01-11 13:46:58.458 16174-16191/com.pedro.rtpstreamer E/BufferQueueProducer: [unnamed-16174-0] cancelBuffer: BufferQueue has been abandoned 01-11 13:46:58.474 31341-32396/? W/CameraService: removeClient: clear camera 0, package name com.pedro.rtpstreamer 01-11 13:46:58.476 16174-16206/com.pedro.rtpstreamer D/mmk: onStatusChangedLocked.+++++++ 01-11 13:46:58.476 16174-16206/com.pedro.rtpstreamer E/CameraManagerGlobal: Camera id 0 has status changed to 0x1 01-11 13:46:58.480 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: VideoEncoder OMX.rk.video_encoder.avc 01-11 13:46:58.482 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: Color supported: 2135033992 01-11 13:46:58.482 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: Color supported: 19 01-11 13:46:58.482 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: Color supported: 21 01-11 13:46:58.482 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: Color supported: 2130708361 01-11 13:46:58.485 16174-16294/com.pedro.rtpstreamer I/OMXClient: Using client-side OMX mux. 01-11 13:46:58.488 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: Prepare video info: SURFACE, 640x480 01-11 13:46:58.491 16174-16294/com.pedro.rtpstreamer W/ACodec: do not know color format 0x7f000789 = 2130708361 01-11 13:46:58.493 16174-16294/com.pedro.rtpstreamer I/ACodec: setupVideoEncoder succeeded 01-11 13:46:58.494 16174-16294/com.pedro.rtpstreamer W/ACodec: do not know color format 0x7f000789 = 2130708361 01-11 13:46:58.496 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: prepared 01-11 13:46:58.510 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: started 01-11 13:46:58.511 16174-16174/com.pedro.rtpstreamer I/AudioEncoder: started 01-11 13:46:58.514 16174-16174/com.pedro.rtpstreamer I/MicrophoneManager: Microphone started 01-11 13:46:58.521 16174-16174/com.pedro.rtpstreamer I/CameraManager: Using legacy camera HAL. 01-11 13:46:58.557 16174-16206/com.pedro.rtpstreamer D/mmk: onStatusChangedLocked.+++++++ 01-11 13:46:58.557 16174-16206/com.pedro.rtpstreamer E/CameraManagerGlobal: Camera id 0 has status changed to 0x80000000 01-11 13:46:58.557 31341-32098/? D/CameraHal: Calling process is: com.pedro.rtpstreamer 01-11 13:46:58.636 31341-32098/? W/CameraService: CameraService::connect X (id 0, this pid is 31341, name com.pedro.rtpstreamer) 01-11 13:46:58.648 16174-16301/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state CONFIGURING 01-11 13:46:58.648 16174-16321/com.pedro.rtpstreamer I/RequestThread-0: Configure outputs: 2 surfaces configured. 01-11 13:46:58.648 16174-16321/com.pedro.rtpstreamer D/Camera: app passed NULL surface 01-11 13:46:58.670 16174-16301/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state IDLE 01-11 13:46:58.670 16174-16301/com.pedro.rtpstreamer I/Camera2ApiManager: Camera opened 01-11 13:46:58.672 16174-16301/com.pedro.rtpstreamer I/RequestQueue: Repeating capture request set. 01-11 13:46:58.672 16174-16301/com.pedro.rtpstreamer I/Camera2ApiManager: Camera configured 01-11 13:46:58.679 16174-16321/com.pedro.rtpstreamer W/LegacyRequestMapper: convertRequestMetadata - control.awbRegions setting is not supported, ignoring value 01-11 13:46:58.683 16174-16174/com.pedro.rtpstreamer D/DisplayManager: getDisplayInfo: displayId=0, info=DisplayInfo{"Встроенный экран", uniqueId "local:0", app 1024 x 552, real 1024 x 600, largest app 1024 x 951, smallest app 600 x 527, 60.932003 fps, supportedRefreshRates [60.932003], rotation 0, density 160 (159.5681 x 160.42105) dpi, layerStack 0, appVsyncOff 0, presDeadline 17411737, type BUILT_IN, state ON, FLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS} 01-11 13:46:58.683 16174-16321/com.pedro.rtpstreamer W/LegacyRequestMapper: convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported 01-11 13:46:58.689 16174-16174/com.pedro.rtpstreamer D/ViewRootImpl: onAttachToWindow register content observer attrs=WM.LayoutParams{(0,64)(wrapxwrap)mPosX=0mPosY=0mHScale=1.0mVScale=1.0 align=UNDEFINE taskId=-1 gr=#51 ty=2005 fl=#1000098 fmt=-3 wanim=0x1030004 surfaceInsets=Rect(0, 0 - 0, 0)packageName=com.pedro.rtpstreamertoken=null} 01-11 13:46:58.707 16174-16174/com.pedro.rtpstreamer D/ViewRootImpl: 131<<<<<< BACK FROM relayoutWM.LayoutParams{(0,64)(wrapxwrap)mPosX=0mPosY=0mHScale=1.0mVScale=1.0 align=UNDEFINE taskId=-1 gr=#51 sim=#20 ty=2005 fl=#1000098 fmt=-3 wanim=0x1030004 surfaceInsets=Rect(0, 0 - 0, 0)packageName=com.pedro.rtpstreamertoken=null} 01-11 13:46:59.276 16174-16322/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state CAPTURING 01-11 13:46:59.294 16174-16297/com.pedro.rtpstreamer I/MPEG4Writer: limits: 4294967295/0 bytes/us, bit rate: -1 bps and the estimated moov size 3072 bytes 01-11 13:46:59.295 16174-16326/com.pedro.rtpstreamer I/MPEG4Writer: setStartTimestampUs: 789182 01-11 13:46:59.295 16174-16326/com.pedro.rtpstreamer I/MPEG4Writer: Earliest track starting time: 789182 01-11 13:46:59.301 16174-16327/com.pedro.rtpstreamer I/MPEG4Writer: setStartTimestampUs: 759791 01-11 13:46:59.301 16174-16327/com.pedro.rtpstreamer I/MPEG4Writer: Earliest track starting time: 759791 01-11 13:47:00.661 16174-16174/com.pedro.rtpstreamer D/ViewRootImpl: onDetachedFromWindow ungister contentObserver 01-11 13:47:10.870 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Video track stopping 01-11 13:47:10.870 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Video track source stopping 01-11 13:47:10.870 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Video track source stopped 01-11 13:47:10.870 16174-16326/com.pedro.rtpstreamer I/MPEG4Writer: Received total/0-length (174/0) buffers and encoded 174 frames. - Video 01-11 13:47:10.871 16174-16327/com.pedro.rtpstreamer I/MPEG4Writer: Received total/0-length (362/0) buffers and encoded 362 frames. - Audio 01-11 13:47:10.871 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Video track stopped 01-11 13:47:10.871 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Audio track stopping 01-11 13:47:10.871 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Audio track source stopping 01-11 13:47:10.871 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Audio track source stopped 01-11 13:47:10.883 16174-16327/com.pedro.rtpstreamer I/MPEG4Writer: Audio track drift time: 0 us 01-11 13:47:10.883 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Audio track stopped 01-11 13:47:10.883 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Duration from tracks range is [11580176, 11588916] us 01-11 13:47:10.883 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Stopping writer thread 01-11 13:47:10.883 16174-16325/com.pedro.rtpstreamer D/MPEG4Writer: 0 chunks are written in the last batch 01-11 13:47:10.883 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Writer thread stopped 01-11 13:47:10.888 16174-16174/com.pedro.rtpstreamer I/MPEG4Writer: The mp4 file will not be streamable. 01-11 13:47:10.888 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Video track stopping 01-11 13:47:10.888 16174-16174/com.pedro.rtpstreamer D/MPEG4Writer: Audio track stopping 01-11 13:47:10.897 16174-16174/com.pedro.rtpstreamer I/MicrophoneManager: Microphone stopped 01-11 13:47:10.897 16174-16174/com.pedro.rtpstreamer I/RequestQueue: Repeating capture request cancelled. 01-11 13:47:10.898 16174-16174/com.pedro.rtpstreamer I/RequestQueue: Repeating capture request set. 01-11 13:47:10.898 16174-16174/com.pedro.rtpstreamer I/VideoEncoder: stopped 01-11 13:47:10.909 16174-16174/com.pedro.rtpstreamer I/AudioEncoder: stopped 01-11 13:47:10.941 16174-16322/com.pedro.rtpstreamer E/mali_so: encounter the first mali_error : 0x0002 : failed to allocate CPU memory (gles_fb_first_drawcall_cb at hardware/arm/maliT760/driver/product/gles/src/fb/mali_gles_fb_module_api.c:1224) 01-11 13:47:10.941 16174-16322/com.pedro.rtpstreamer E/mali_so: to dump the call_stack of the first error : 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #00 pc 0042f6dc /system/vendor/lib/egl/rk3288w/libGLES_mali.so 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #01 pc 003facec /system/vendor/lib/egl/rk3288w/libGLES_mali.so 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #02 pc 003fada4 /system/vendor/lib/egl/rk3288w/libGLES_mali.so 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #03 pc 003faf40 /system/vendor/lib/egl/rk3288w/libGLES_mali.so 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #04 pc 003f21e4 /system/vendor/lib/egl/rk3288w/libGLES_mali.so 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #05 pc 003f149c /system/vendor/lib/egl/rk3288w/libGLES_mali.so 01-11 13:47:10.961 16174-16322/com.pedro.rtpstreamer D/mali_so: #06 pc 00bfb8eb /data/dalvik-cache/arm/system@framework@boot.oat 01-11 13:47:10.962 16174-16322/com.pedro.rtpstreamer E/CameraDeviceGLThread-0: Received exception on GL render thread: java.lang.IllegalStateException: glDrawArrays: GLES20 error: 0x505 at android.hardware.camera2.legacy.SurfaceTextureRenderer.checkGlError(SurfaceTextureRenderer.java:537) at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawFrame(SurfaceTextureRenderer.java:346) at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawIntoSurfaces(SurfaceTextureRenderer.java:726) at android.hardware.camera2.legacy.GLThreadManager$1.handleMessage(GLThreadManager.java:105) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61) 01-11 13:47:10.962 16174-16322/com.pedro.rtpstreamer I/CameraDeviceState: Legacy camera service transitioning to state ERROR

pedroSG94 commented 4 years ago

Did you get this error if you change in OpenGl demo to camera2?

OleksandrAndro commented 4 years ago

In OpenGl demo with camera2 work without error. Ok, thank you, I will try such way in my project.

OleksandrAndro commented 4 years ago

Hmm...I have trouble with it..... I can't use constructor with OpenGl, because I creating RtmpCamera2 object in service and passing parameters to it throught AIDL, I might pass throught AIDL only Surface not SurfaceView or OpenGLView. Maybe you have some thoughts for this case?

pedroSG94 commented 4 years ago

You can use opengl without view with this constructor if you set boolean to true: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java#L92 Or with camera1: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera1Base.java#L98

OleksandrAndro commented 4 years ago

Thank you, I tried to use the BackgroundExample, and the problem is not appearing now.