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

Can not catch exception for corrupted video file. #256

Open pgpathan22 opened 2 years ago

pgpathan22 commented 2 years ago
try {
            retriever.setDataSource(Uri.fromFile(path.toFile()).path)
        } catch (e: IllegalArgumentException) {
            e.printStackTrace()
        }

This code could not catch the exception from lib and app is getting crashed. this issue comes for this corrupted video file (https://user-images.githubusercontent.com/581023/171505003-ec270115-2bc5-45eb-969e-16317cded9e5.mp4).

Logcat: 06-02 00:26:48.011 5320 5984 I MediaMetadataRetrieverJNI: native_setup 06-02 00:26:48.011 5320 5984 V MediaMetadataRetrieverJNI: setDataSource --------- beginning of crash 06-02 00:26:48.033 5320 5984 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5984 (DefaultDispatch), pid 5320 06-02 00:26:48.951 5320 5320 D main : pausing MainActivity 06-02 00:26:48.975 5320 5320 I ViewRootImpl@4149347[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1

For reference, https://github.com/andyfuturex/FFmpegMediaMetadataRetriever. Please check this lib. it is already working for this lib.