tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

On Android FFmpeg.Execute() locks app on Visual Studio debugger and seems cause a crash after reopening a page #677

Closed j2bmw closed 3 years ago

j2bmw commented 3 years ago

Description Our app is to convert video files in a Xamarin forms project. On Android, FFmpeg.Execute() locks app on Visual Studio debugger and seems cause a crash after reopening a page. Note that:

I use the wrapper of mobile ffmpeg: https://nugetmusthaves.com/Package/Laerdal.Xamarin.FFmpeg.Video No lock up if running the command line outside the debugger. The crash occurs inside and outside the debugger. Expected behavior There should be no lockup or crash inside or outside the debugger.

Current behavior

FFmpeg.Execute() locks app inside Visual Studio debugger on Android. The app crashes after running the command line, exiting a page and opening another page. It occurs inside and outside the debugger. Screenshots No

Logs crash after converting to mp4.txt

Environment

Visual Studio 2019 16.8.4 Platform: Xamarin Forms 5 Architecture: [Android pixel 3 Q] Other Our app is to convert video files in a Xamarin forms project. On Android app, running ffmpeg command line locks the app on Visual Studio debugger. However, the conversion seems completed (at least a significant portion is done and can be played back) outside the debugger without locking the app. The bigger problem: after the conversion, the app crashes not long after. Please see the device log "crash after converting to mp4.txt" crash after converting to mp4.txt. It seems the conversion didn't complete and it triggered the following exception: 02-12 19:04:18.635 Google Pixel 3 Error 23366 libc Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 23470 (x.tecommobilev2), pid 23366 (x.tecommobilev2) 02-12 19:04:18.624 Google Pixel 3 Error 23366 libc FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x77f6994c30)

It seems this crash is related to int rc = FFmpeg.Execute($"-i "{filename}" "{mp4File}"");

If I comment out this line, there is no crash. I haven't figured out the cause.

I tried the alternative using long rc = Laerdal.Xamarin.FFmpeg.Android.FFmpeg.ExecuteAsync($"-i "{_recordedVideoFileName}" "{mp4File}"", executeCallback);

The issue remains.

j2bmw commented 3 years ago

The issue has been resolved. See details in https://github.com/Laerdal/Laerdal.Xamarin.FFmpeg/issues/2