wseemann / FFmpegMediaMetadataRetriever

FFmpegMediaMetadataRetriever provides a unified interface for retrieving frame and meta data from an input media file.
1.72k stars 387 forks source link

Android FFmpegMediaMetadataRetriever get Frame from RTSP stream App Crash with A/libc: Fatal signal 6 (SIGABRT) #274

Closed engrtaipu closed 1 year ago

engrtaipu commented 1 year ago

Hi, I am using FFmpegMediaMetadataRetriever to grab frame from an RTSP Stream from a PTZ Camera, but it leads to app crash.

    ExecutorService executor = Executors.newSingleThreadExecutor();
    Handler handler = new Handler(Looper.getMainLooper());
    executor.execute(()->{
        fFmpegMediaMetadataRetriever.setDataSource(url);
        Bitmap bitmap = fFmpegMediaMetadataRetriever.getFrameAtTime(2000,FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
        fFmpegMediaMetadataRetriever.release();

        handler.post(()->{
            imageView.setImageBitmap(bitmap);
        });
    });

The app crashes with below error. FFmpegMediaMetadataRetriever version.version 1.0.16. D/apitrace: apitrace: warning: caught signal 6 D/apitrace: call flush from exceptionCallback --------- beginning of crash A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 18623 (pool-3-thread-1), pid 18498

   I/BufferQueueProducer: [SurfaceTexture-0-18498-0](this:0xc3495000,id:0,api:3,p:18498,c:18498) queueBuffer:     fps=32.63 dur=1011.34 max=70.30 min=10.52
  I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 24, oppidx_max 24, oppidx_min 0
  I/MediaMetadataRetrieverJNI: native_setup
engrtaipu commented 1 year ago

@wseemann any help is much appreciated.

wseemann commented 1 year ago

@engrtaipu The current release is 1.0.19. Can you please try that version first and confirm the crash still exists?

engrtaipu commented 1 year ago

@wseemann I have updated to latest version, but still the App crashed with same issue.

wseemann commented 1 year ago

Can you post the full stacktrace? It should be longer than just one line:

A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 18623 (pool-3-thread-1), pid 18498

engrtaipu commented 1 year ago

@wseemann Okay let me share the full stack trace. D/apitrace: apitrace: warning: caught signal 6 D/apitrace: call flush from exceptionCallback --------- beginning of crash A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 31548 (pool-4-thread-1), pid 31416

wseemann commented 1 year ago

@engrtaipu This is the same information you posted above. Typically there is code inside a native library that calls libc which results in the crash. This code is listed in the stacktrace. I need that information. Without that information I can't debug the issue. If possible, the full output from adb logcat would be helpful.

engrtaipu commented 1 year ago

@wseemann Let me share it. There may be some irrelevant logs from vlc.

2023-01-25 21:49:42.350 2754-2885/com.edistec.camera I/MediaMetadataRetrieverJNI: native_init 2023-01-25 21:49:42.350 2754-2885/com.edistec.camera I/MediaMetadataRetrieverJNI: native_setup

2023-01-25 21:49:43.334 2754-2890/com.edistec.camera I/BufferQueue: unnamed-2754-0 BufferQueue core=(2754:com.edistec.camera) 2023-01-25 21:49:43.333 2754-2754/com.edistec.camera W/Thread-3: type=1400 audit(0.0:1913437): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=15022 scontext=u:r:untrusted_app:s0:c204,c258,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera E/libc: Access denied finding property "vendor.debug.bq.dump" 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera I/BufferQueueConsumer: unnamed-2754-0 connect(C): consumer=(2754:com.edistec.camera) controlledByApp=true 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera E/libc: Access denied finding property "vendor.debug.bq.dump" 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera I/BufferQueueConsumer: unnamed-2754-0 setConsumerName: unnamed-2754-0 2023-01-25 21:49:43.333 2754-2754/com.edistec.camera W/Thread-3: type=1400 audit(0.0:1913438): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=15022 scontext=u:r:untrusted_app:s0:c204,c258,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera E/libc: Access denied finding property "vendor.debug.bq.dump" 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera I/BufferQueueConsumer: SurfaceTexture-0-2754-0 setConsumerName:

2023-01-25 21:49:43.357 2754-2892/com.edistec.camera I/OMXClient: IOmx service obtained 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/SurfaceUtils: connecting to surface 0xc3237808, reason connectToSurface 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/Surface: Surface::connect(this=0xc3237800,api=3) 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 connect(P): api=3 producer=(2754:com.edistec.camera) producerControlledByApp=true 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera I/MediaCodec: [OMX.MTK.VIDEO.DECODER.AVC] setting surface generation to 2820097 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/SurfaceUtils: disconnecting from surface 0xc3237808, reason connectToSurface(reconnect) 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/Surface: Surface::disconnect(this=0xc3237800,api=3) 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 disconnect(P): api 3 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/SurfaceUtils: connecting to surface 0xc3237808, reason connectToSurface(reconnect) 2023-01-25 21:49:43.364 2754-2891/com.edistec.camera D/Surface: Surface::connect(this=0xc3237800,api=3) 2023-01-25 21:49:43.364 2754-2891/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 connect(P): api=3 producer=(2754:com.edistec.camera) producerControlledByApp=true 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera I/MtkACodec: setMTKParameters, width: 640 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera I/MtkACodec: setMTKParameters, height: 368 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera I/MtkACodec: set rotation-degrees 0 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera E/MtkACodec: setConfig(OMX_CONFIG_ROTATIONTYPE) returned error 0xfffffc0e 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera E/ACodec: [OMX.MTK.VIDEO.DECODER.AVC] failed to setViLTEParameters 1

2023-01-25 21:49:43.481 2754-2886/com.edistec.camera I/GPUAUX: [AUX]GPUAUXContext:69: create: 0xc33a7e08 2023-01-25 21:49:43.483 2754-2886/com.edistec.camera D/gralloc: Failed to allocate page for shared attribute region, will try again with memfd 2023-01-25 21:49:43.477 2754-2754/com.edistec.camera W/AWindowHandler: type=1400 audit(0.0:1913442): avc: denied { open } for path="/dev/ashmem" dev="tmpfs" ino=16429 scontext=u:r:untrusted_app:s0:c204,c258,c512,c768 tcontext=u:object_r:ashmem_device:s0 tclass=chr_file permissive=0 2023-01-25 21:49:43.573 2754-2886/com.edistec.camera E/VLC: [c188e730/b46] libvlc window: request 1 not implemented 2023-01-25 21:49:43.654 2754-2878/com.edistec.camera W/VLC: [ea67a0b0/b3e] libvlc audio output: playback too early (-64162): down-sampling 2023-01-25 21:49:43.684 2754-2886/com.edistec.camera W/VLC: [c3749b30/b46] libvlc video output: picture is too late to be displayed (missing 18 ms) 2023-01-25 21:49:43.690 2754-2886/com.edistec.camera D/gralloc: Failed to allocate page for shared attribute region, will try again with memfd 2023-01-25 21:49:43.711 2754-2886/com.edistec.camera D/gralloc: Failed to allocate page for shared attribute region, will try again with memfd

2023-01-25 21:49:45.277 2754-2892/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 queueBuffer: fps=4.44 dur=1799.94 max=1399.77 min=22.27

2023-01-25 21:49:45.895 2754-2878/com.edistec.camera D/AudioTrack: pause(18201): 0xc1537d80, prior state:STATE_ACTIVE 2023-01-25 21:49:45.896 2754-2898/com.edistec.camera E/NdkMediaCodec: sf error code: -38

2023-01-25 21:49:45.897 2754-2878/com.edistec.camera D/AudioTrack: start(18201): 0xc1537d80, prior state:STATE_FLUSHED

2023-01-25 21:49:47.415 2754-2850/com.edistec.camera E/VLC: [c3436d30/b22] libvlc decoder: buffer deadlock prevented 2023-01-25 21:49:47.415 2754-2850/com.edistec.camera D/VLC: [f1b36030/b22] libvlc input: Decoder wait done in 0 ms 2023-01-25 21:49:47.416 2754-2881/com.edistec.camera W/AudioTrack: restartIfDisabled(18201): releaseBuffer() track 0xc1537d80 disabled due to previous underrun, restarting

2023-01-25 21:49:49.210 2754-2878/com.edistec.camera D/AudioTrack: pause(18201): 0xc1537d80, prior state:STATE_ACTIVE 2023-01-25 21:49:49.213 2754-2898/com.edistec.camera E/NdkMediaCodec: sf error code: -38

2023-01-25 21:49:49.222 2754-2878/com.edistec.camera D/AudioTrack: start(18201): 0xc1537d80, prior state:STATE_FLUSHED

2023-01-25 21:49:55.516 2754-2885/com.edistec.camera D/apitrace: apitrace: warning: caught signal 6 2023-01-25 21:49:55.516 2754-2885/com.edistec.camera D/apitrace: call flush from exceptionCallback

--------- beginning of crash

2023-01-25 21:49:55.518 2754-2885/com.edistec.camera A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 2885 (pool-5-thread-1), pid 2754 (.edistec.camera)

engrtaipu commented 1 year ago

@wseemann have you find any solution?

wseemann commented 1 year ago

@wseemann Let me share it. There may be some irrelevant logs from vlc.

2023-01-25 21:49:42.350 2754-2885/com.edistec.camera I/MediaMetadataRetrieverJNI: native_init 2023-01-25 21:49:42.350 2754-2885/com.edistec.camera I/MediaMetadataRetrieverJNI: native_setup

2023-01-25 21:49:43.334 2754-2890/com.edistec.camera I/BufferQueue: unnamed-2754-0 BufferQueue core=(2754:com.edistec.camera) 2023-01-25 21:49:43.333 2754-2754/com.edistec.camera W/Thread-3: type=1400 audit(0.0:1913437): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=15022 scontext=u:r:untrusted_app:s0:c204,c258,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera E/libc: Access denied finding property "vendor.debug.bq.dump" 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera I/BufferQueueConsumer: unnamed-2754-0 connect(C): consumer=(2754:com.edistec.camera) controlledByApp=true 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera E/libc: Access denied finding property "vendor.debug.bq.dump" 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera I/BufferQueueConsumer: unnamed-2754-0 setConsumerName: unnamed-2754-0 2023-01-25 21:49:43.333 2754-2754/com.edistec.camera W/Thread-3: type=1400 audit(0.0:1913438): avc: denied { read } for name="u:object_r:debug_bq_dump_prop:s0" dev="tmpfs" ino=15022 scontext=u:r:untrusted_app:s0:c204,c258,c512,c768 tcontext=u:object_r:debug_bq_dump_prop:s0 tclass=file permissive=0 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera E/libc: Access denied finding property "vendor.debug.bq.dump" 2023-01-25 21:49:43.338 2754-2890/com.edistec.camera I/BufferQueueConsumer: SurfaceTexture-0-2754-0 setConsumerName:

2023-01-25 21:49:43.357 2754-2892/com.edistec.camera I/OMXClient: IOmx service obtained 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/SurfaceUtils: connecting to surface 0xc3237808, reason connectToSurface 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/Surface: Surface::connect(this=0xc3237800,api=3) 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 connect(P): api=3 producer=(2754:com.edistec.camera) producerControlledByApp=true 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera I/MediaCodec: [OMX.MTK.VIDEO.DECODER.AVC] setting surface generation to 2820097 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/SurfaceUtils: disconnecting from surface 0xc3237808, reason connectToSurface(reconnect) 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/Surface: Surface::disconnect(this=0xc3237800,api=3) 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 disconnect(P): api 3 2023-01-25 21:49:43.363 2754-2891/com.edistec.camera D/SurfaceUtils: connecting to surface 0xc3237808, reason connectToSurface(reconnect) 2023-01-25 21:49:43.364 2754-2891/com.edistec.camera D/Surface: Surface::connect(this=0xc3237800,api=3) 2023-01-25 21:49:43.364 2754-2891/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 connect(P): api=3 producer=(2754:com.edistec.camera) producerControlledByApp=true 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera I/MtkACodec: setMTKParameters, width: 640 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera I/MtkACodec: setMTKParameters, height: 368 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera I/MtkACodec: set rotation-degrees 0 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera E/MtkACodec: setConfig(OMX_CONFIG_ROTATIONTYPE) returned error 0xfffffc0e 2023-01-25 21:49:43.366 2754-2892/com.edistec.camera E/ACodec: [OMX.MTK.VIDEO.DECODER.AVC] failed to setViLTEParameters 1

2023-01-25 21:49:43.481 2754-2886/com.edistec.camera I/GPUAUX: [AUX]GPUAUXContext:69: create: 0xc33a7e08 2023-01-25 21:49:43.483 2754-2886/com.edistec.camera D/gralloc: Failed to allocate page for shared attribute region, will try again with memfd 2023-01-25 21:49:43.477 2754-2754/com.edistec.camera W/AWindowHandler: type=1400 audit(0.0:1913442): avc: denied { open } for path="/dev/ashmem" dev="tmpfs" ino=16429 scontext=u:r:untrusted_app:s0:c204,c258,c512,c768 tcontext=u:object_r:ashmem_device:s0 tclass=chr_file permissive=0 2023-01-25 21:49:43.573 2754-2886/com.edistec.camera E/VLC: [c188e730/b46] libvlc window: request 1 not implemented 2023-01-25 21:49:43.654 2754-2878/com.edistec.camera W/VLC: [ea67a0b0/b3e] libvlc audio output: playback too early (-64162): down-sampling 2023-01-25 21:49:43.684 2754-2886/com.edistec.camera W/VLC: [c3749b30/b46] libvlc video output: picture is too late to be displayed (missing 18 ms) 2023-01-25 21:49:43.690 2754-2886/com.edistec.camera D/gralloc: Failed to allocate page for shared attribute region, will try again with memfd 2023-01-25 21:49:43.711 2754-2886/com.edistec.camera D/gralloc: Failed to allocate page for shared attribute region, will try again with memfd

2023-01-25 21:49:45.277 2754-2892/com.edistec.camera I/BufferQueueProducer: SurfaceTexture-0-2754-0 queueBuffer: fps=4.44 dur=1799.94 max=1399.77 min=22.27

2023-01-25 21:49:45.895 2754-2878/com.edistec.camera D/AudioTrack: pause(18201): 0xc1537d80, prior state:STATE_ACTIVE 2023-01-25 21:49:45.896 2754-2898/com.edistec.camera E/NdkMediaCodec: sf error code: -38

2023-01-25 21:49:45.897 2754-2878/com.edistec.camera D/AudioTrack: start(18201): 0xc1537d80, prior state:STATE_FLUSHED

2023-01-25 21:49:47.415 2754-2850/com.edistec.camera E/VLC: [c3436d30/b22] libvlc decoder: buffer deadlock prevented 2023-01-25 21:49:47.415 2754-2850/com.edistec.camera D/VLC: [f1b36030/b22] libvlc input: Decoder wait done in 0 ms 2023-01-25 21:49:47.416 2754-2881/com.edistec.camera W/AudioTrack: restartIfDisabled(18201): releaseBuffer() track 0xc1537d80 disabled due to previous underrun, restarting

2023-01-25 21:49:49.210 2754-2878/com.edistec.camera D/AudioTrack: pause(18201): 0xc1537d80, prior state:STATE_ACTIVE 2023-01-25 21:49:49.213 2754-2898/com.edistec.camera E/NdkMediaCodec: sf error code: -38

2023-01-25 21:49:49.222 2754-2878/com.edistec.camera D/AudioTrack: start(18201): 0xc1537d80, prior state:STATE_FLUSHED

2023-01-25 21:49:55.516 2754-2885/com.edistec.camera D/apitrace: apitrace: warning: caught signal 6 2023-01-25 21:49:55.516 2754-2885/com.edistec.camera D/apitrace: call flush from exceptionCallback

--------- beginning of crash

2023-01-25 21:49:55.518 2754-2885/com.edistec.camera A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 2885 (pool-5-thread-1), pid 2754 (.edistec.camera)

Sorry, this still isn't enough information for me to debug the source of the crash. I see there is a fatal error in libc, but don't see the code leading up to that in the stacktrace.

wseemann commented 1 year ago

Closed due to inactivity.