Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115935

REG: FFMPEG backend causes Android 13 crash on Launch

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.3, 6.6.1, 6.7.0 FF
    • 6.5.2, 6.6.0 Beta1, 6.6.0 Beta2, 6.6.0 Beta3, 6.6.0 Beta4
    • Multimedia
    • None
    • Ubuntu 22.043LTS and QtCreator 11.01
      Android 13 on LG v60 with arm64_v8a architecture.
    • Android
    • 4d7654292 (dev), 78d1f7327 (6.6), 82a3624ac (6.5)
    • 2023wk36FOQtforAndroid

    Description

      With any app using QtMultimedia Video or Audio playback on Android 13, I'm seeing a crash on launch. This problem appears to be due to the new FFMPEG backend becoming default for Qt 6.5.2 and 6.6.0 and can be eliminated by setting environment variable 

      QT_MEDIA_BACKEND=android

      Qt6.5.1 and 6.6.0 prior to beta-1 did not suffer from such crashes, therefore this is a regression.

      The following outputs and enclosed log files are all from:

      Examples/Qt-6.6.0/multimedia/video/mediaplayer

      however, this error can be seen with any QML MediaPlayer and VideoOutput app.

      The crashes all look like this:

      F ple.mediaplayer: runtime.cc:682]   at org.qtproject.qt.android.QtNative.startQtApplication(Native method)
      F ple.mediaplayer: runtime.cc:682]   at org.qtproject.qt.android.QtNative$7.run(QtNative.java:465)
      F ple.mediaplayer: runtime.cc:682]   at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25)
      F ple.mediaplayer: runtime.cc:682]   at java.lang.Thread.run(Thread.java:1012)
      F ple.mediaplayer: runtime.cc:682]
      F ple.mediaplayer: runtime.cc:690] JNI DETECTED ERROR IN APPLICATION: java_array == null
      F ple.mediaplayer: runtime.cc:690]     in call to GetArrayLength
      F ple.mediaplayer: runtime.cc:690]     from void org.qtproject.qt.android.QtNative.startQtApplication()
      F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 27701 (qtMainLoopThrea), pid 27678 (ple.mediaplayer)
      23:54:38: 
      "org.qtproject.example.mediaplayer" died.
      

      With the following backtrace sequence showing ffmpeg as the culprit:

      F ple.mediaplayer: runtime.cc:682]   native: #08 pc 0000000000649bac  /apex/com.android.art/lib64/libart.so (art::JNI<false>::GetArrayLength(_JNIEnv*, _jarray*)+568) (BuildId: 4bf4747707ca903605931dd6b3d0480c)
      F ple.mediaplayer: runtime.cc:682]   native: #09 pc 0000000000449e8c  /data/app/~~20EobCfRoyjyv37MZ2dChA==/org.qtproject.example.mediaplayer-0QUDuPLvlW1aTWex5ar0mw==/lib/arm64/libplugins_multimedia_ffmpegmediaplugin_arm64-v8a.so (???) (BuildId: 2118961c26a30b1f77e9d62862d0350965e841a8)
      F ple.mediaplayer: runtime.cc:682]   native: #10 pc 0000000000421a18  /data/app/~~20EobCfRoyjyv37MZ2dChA==/org.qtproject.example.mediaplayer-0QUDuPLvlW1aTWex5ar0mw==/lib/arm64/libplugins_multimedia_ffmpegmediaplugin_arm64-v8a.so (???) (BuildId: 2118961c26a30b1f77e9d62862d0350965e841a8)
      F ple.mediaplayer: runtime.cc:682]   native: #11 pc 0000000000421270  /data/app/~~20EobCfRoyjyv37MZ2dChA==/org.qtproject.example.mediaplayer-0QUDuPLvlW1aTWex5ar0mw==/lib/arm64/libplugins_multimedia_ffmpegmediaplugin_arm64-v8a.so (???) (BuildId: 2118961c26a30b1f77e9d62862d0350965e841a8)
      F ple.mediaplayer: runtime.cc:682]   native: #12 pc 0000000000421150  /data/app/~~20EobCfRoyjyv37MZ2dChA==/org.qtproject.example.mediaplayer-0QUDuPLvlW1aTWex5ar0mw==/lib/arm64/libplugins_multimedia_ffmpegmediaplugin_arm64-v8a.so (???) (BuildId: 2118961c26a30b1f77e9d62862d0350965e841a8)
      F ple.mediaplayer: runtime.cc:682]   native: #13 pc 00000000004218c0  /data/app/~~20EobCfRoyjyv37MZ2dChA==/org.qtproject.example.mediaplayer-0QUDuPLvlW1aTWex5ar0mw==/lib/arm64/libplugins_multimedia_ffmpegmediaplugin_arm64-v8a.so (???) (BuildId: 2118961c26a30b1f77e9d62862d0350965e841a8)
      F ple.mediaplayer: runtime.cc:682]   native: #14 pc 000000000009a8f0  /data/app/~~20EobCfRoyjyv37MZ2dChA==/org.qtproject.example.mediaplayer-0QUDuPLvlW1aTWex5ar0mw==/lib/arm64/libQt6Multimedia_arm64-v8a.so (???) (BuildId: 426f4b2603ec779c9ae15308d68b177557ebaeb1)

      The problem is avoided by adding the following preamble to main.cpp main():

      #if  (defined(Q_OS_ANDROID) && (QT_VERSION >= QT_VERSION_CHECK(6, 5, 2)))
        //revert to old native backend on Android for Qt6.5.2 and beyond (when ffmpeg backend was
        //made the default QtMultimedia backend per https://www.qt.io/blog/ffmpeg-android ).
        // Problems eliminated by using old android backend:
        // (1) choppy playback caused by constant stream of errors output to the console during media playback;
        // (2) Failing to launch when the new default ffmpeg backend is invoked on Android 13 LG V60:
        //     "runtime.cc:689] JNI DETECTED ERROR IN APPLICATION: java_array == null"
        //     See https://bugreports.qt.io/browse/QTBUG-115935 for details.
        qputenv("QT_MEDIA_BACKEND", "android");
      #endif /* (defined(Q_OS_ANDROID) && (QT_VERSION >= QT_VERSION_CHECK(6, 5, 2))) */
      

      This crash is occurring specifically on my AT&T LGv60 running the latest Android 13 update (July 2023 patchlevel).

      On an older LG G8X running Android 12, I do not see this crash and the FFMPEG backend allows the app to launch successfully, modulo numerous other problems caused by the FFMPEG backend (alluded to in the comments above). 

      Likewise, on latest update Android 11 on NVIDIA Shield (Patchlevel April 5 2022), I am also not seeing this crash, and the FFMPEG backend at least launches, but also has other problems (see comments in code above) that will be addressed in future bug reports, once I publish my test-app that demonstrates the myriad problems caused by the new FFMPEG backend, on multiple platforms.

      I'm uploading qtcreator output logs from various runs of the example 6.6.0 multimedia/video/mediaplayer app, both successful and unsuccessful:

      • mediaplayer-on-651-success.txt : runs successfully on Qt6.5.1 (last working version before regression)
      • mediaplayer-on-652-fail.txt, 6 mediaplayer-on-660-fail.txt : crash on launch caused by FFMPEG backend.
      • mediaplayer-on-652-with-android-backend.txt, mediaplayer-on-660-with-android-backend.txt : successful run with QT_MEDIA_BACKEND=android forcing the old legacy backend for 6.5.2 and 6.6.0, which avoids the crash.

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              bartlomiejmoskal Bartlomiej Moskal
              nielsmayer Niels Mayer
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes