Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Adroid app crashes when using QSound::play



  • Hello everybody,

    My app crashes when playing a wave file, using QSound on most devices.

    QSound::play(":/sounds/click.wav");
    

    Even though, the app crashes, the sound is played anyway or at least a part of it.
    Updating JDK and NDK did not help.
    On my old System I was using Qt 5.12 and it worked fine. But since Goole wants to get apps uploaded in aab, instead of apk format, I cannot use 5.12 any more, because Qt Creator does only offer this for later versions, so I’m using Qt 5.15.2 now. I have tried also Qt 5.14.2 with the same problem.

    On a device with Android 5.0 it works, while on Android 6.0 it does not. Both with ABI:armeabi-v7a

    The output of the app has a lot of differences between the working on and the not working one. I have them posted bellow (From the moment, the sound should be played, till the end or crash). I had to short them, because otherwise the thraed would be to long.

    Does anybody have an idea?
    Thanks
    Jens

    Working:

    V/AudioTrack(23638): set(): streamType 3, sampleRate 44100, format 0x1, channelMask 0x1, frameCount 0, flags #4, notificationFrames 0, sessionId 133, transferType 0
    V/AudioTrack(23638): set() streamType 3 frameCount 0 flags 0004
    D/AudioTrack(23638): audiotrack 0x9c3f8080 set Type 3, rate 44100, fmt 1, chn 1, fcnt 0, flags 0004
    D/AudioTrack(23638): mChannelMask 0x1
    V/AudioTrack(23638): createTrack_l() output 2 afLatency 92
    V/AudioTrack(23638): AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 4096
    D/AudioTrackCenter(23638): addTrack, trackId:0x968cd000, frameCount:4096, sampleRate:44100, trackPtr:0x9c3f8080
    D/AudioTrackCenter(23638): mAfSampleRate 44100, sampleRate 44100, AfFrameCount 1024 , mAfSampleRate 44100, frameCount 4096
    V/AudioTrack(23638): getMinFrameCount=4096: afFrameCount=1024, minBufCount=4, afSampleRate=44100, afLatency=92
    V/AudioTrack(23638): timeout 1.010
    V/AudioTrackShared(23638): requested 1.010 elapsed 0.000
    V/AudioTrack(23638): obtainBuffer(2048) returned 4096 = 2048 + 2048 err 0
    V/AudioTrack(23638): timeout 1.010
    V/AudioTrackShared(23638): requested 1.010 elapsed 0.000
    V/AudioTrack(23638): obtainBuffer(2048) returned 2048 = 2048 + 0 err 0
    [...]
    V/AudioTrackShared(23638): requested 1.010 elapsed 0.000
    V/AudioTrack(23638): obtainBuffer(2048) returned 1024 = 1024 + 0 err 0
    V/AudioTrack(23638): obtainBuffer(1024) returned 0 = 0 + 0 err -11
    V/AudioTrack(23638): timeout 1.010
    V/AudioTrackShared(23638): requested 1.010 elapsed 0.018
    V/AudioTrack(23638): obtainBuffer(1024) returned 2048 = 1024 + 1024 err 0
    V/AudioTrack(23638): obtainBuffer(656) returned 1680 = 656 + 1024 err 0
    D/AudioTrack(23638): audiotrack 0x9c3f8080 stop done
    D/AudioTrack(23638): ~audioTrack 0x9c3f8080
    D/AudioTrackCenter(23638): removeTrack, trackPtr:0x9c3f8080
    V/AudioTrack(23638): ~AudioTrack, releasing session id from 23638 on behalf of 23638
    

    Not working

    D AudioSystem: getIoDescriptor: ioHandle = 2, index = -2, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: ioConfigChanged: [Update mIoDescriptors] add ioHandle = 2 -> descriptor = 0x9e99b778
    V AudioSystem: ioConfigChanged() new output opened 2 samplingRate 48000, format 0x1 channel mask 0x3 frameCount 960 deviceId 2
    D AudioSystem: getIoDescriptor: ioHandle = 4, index = -2, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: ioConfigChanged: [Update mIoDescriptors] add ioHandle = 4 -> descriptor = 0x9e99b778
    V AudioSystem: ioConfigChanged() new output opened 4 samplingRate 48000, format 0x5 channel mask 0x3 frameCount 960 deviceId 2
    D AudioTrack: set(): streamType 3, sampleRate 44100, format 0x1, channelMask 0x1, frameCount 0, flags #104, notificationFrames 0, sessionId 131, transferType 0, uid -1, pid -1
    D AudioTrack: set() streamType 3 frameCount 0 flags 0104
    D AudioTrack: set: Create AudioTrackThread
    D AudioTrack: createTrack_l()... isAudioHookOn = 0, mStreamType = 3
    D AudioSystem: getIoDescriptor: ioHandle = 4, index = 1, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: getLatency() output 4, latency 50
    V AudioTrack: createTrack_l() output 4 afLatency 50
    D AudioSystem: getIoDescriptor: ioHandle = 4, index = 1, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: getFrameCount() output 4, frameCount 960
    D AudioSystem: getIoDescriptor: ioHandle = 4, index = 1, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: getSamplingRate() output 4, sampling rate 48000
    W AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 44100 Hz, output 48000 Hz
    V AudioTrack: calculateMinFrameCount afLatency 50  afFrameCount 960  afSampleRate 48000  sampleRate 44100  speed 1.000000  minBufCount: 2
    V AudioTrack: +setMarkerPosition, marker 0
    V AudioTrack: AudioTrackThread::wake
    V AudioTrack: -setMarkerPosition, marker 0
    V AudioTrack: setPositionUpdatePeriod updatePeriod 44100
    V AudioTrack: AudioTrackThread::wake
    I AudioManagerEx: AudioManagerEx created
    D AudioSystem: getIoDescriptor: ioHandle = 2, index = 0, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: getSamplingRate() output 2, sampling rate 48000
    D AudioSystem: getIoDescriptor: ioHandle = 2, index = 0, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: getFrameCount() output 2, frameCount 960
    D AudioSystem: getIoDescriptor: ioHandle = 2, index = 0, mIoDescriptors = 0xb8c6ea60
    V AudioSystem: getLatency() output 2, latency 80
    V AudioTrack: calculateMinFrameCount afLatency 80  afFrameCount 960  afSampleRate 48000  sampleRate 44100  speed 1.000000  minBufCount: 4
    V AudioTrack: getMinFrameCount=3544: afFrameCount=960, afSampleRate=48000, afLatency=80
    D AudioTrack: start(): 0xb8c6ebf8
    F art     : art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.SecurityException: ConnectivityService: Neither user 10101 nor current process has android.permission.ACCESS_NETWORK_STATE.
    F art     : art/runtime/java_vm_ext.cc:410]   at void android.os.Parcel.readException(int, java.lang.String) (Parcel.java:1620)
    F art     : art/runtime/java_vm_ext.cc:410]   at void android.os.Parcel.readException() (Parcel.java:1573)
    F art     : art/runtime/java_vm_ext.cc:410]   at android.net.NetworkInfo[] android.net.IConnectivityManager$Stub$Proxy.getAllNetworkInfo() (IConnectivityManager.java:1635)
    F art     : art/runtime/java_vm_ext.cc:410]   at android.net.NetworkInfo[] android.net.ConnectivityManager.getAllNetworkInfo() (ConnectivityManager.java:1055)
    F art     : art/runtime/java_vm_ext.cc:410]
    F art     : art/runtime/java_vm_ext.cc:410]     in call to GetMethodID
    F art     : art/runtime/java_vm_ext.cc:410] "QtThread" prio=5 tid=15 Runnable
    F art     : art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x12e240a0 self=0xb8bf6ff0
    F art     : art/runtime/java_vm_ext.cc:410]   | sysTid=18334 nice=0 cgrp=default sched=0/0 handle=0x9cd47930
    F art     : art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 21983124 5308385 9 ) utm=1 stm=1 core=0 HZ=100
    F art     : art/runtime/java_vm_ext.cc:410]   | stack=0x9cc4b000-0x9cc4d000 stackSize=1014KB
    F art     : art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #00 pc 0035acff  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+126)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #01 pc 0033b883  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+138)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #02 pc 0024e01b  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+750)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #03 pc 0024e6bf  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+54)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #04 pc 000fbe0d  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+28)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #05 pc 00100c13  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+4894)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #06 pc 00110a31  /system/lib/libart.so (_ZN3art8CheckJNI11GetMethodIDEP7_JNIEnvP7_jclassPKcS6_+380)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #07 pc 00199641  /data/app/org.qtproject.example.QDmi-2/lib/arm/libQt5Core_armeabi-v7a.so (???)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #08 pc 00199283  /data/app/org.qtproject.example.QDmi-2/lib/arm/libQt5Core_armeabi-v7a.so (???)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #09 pc 0019af61  /data/app/org.qtproject.example.QDmi-2/lib/arm/libQt5Core_armeabi-v7a.so (_ZNK17QJNIObjectPrivate17callObjectMethodVEPKcS1_St9__va_list+52)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #10 pc 0019afe3  /data/app/org.qtproject.example.QDmi-2/lib/arm/libQt5Core_armeabi-v7a.so (_ZNK17QJNIObjectPrivate16callObjectMethodEPKcS1_z+22)
    F art     : art/runtime/java_vm_ext.cc:410]   native: #11 pc 00006bb9  /data/app/org.qtproject.example.QDmi-2/lib/arm/libplugins_bearer_qandroidbearer_armeabi-v7a.so (???)
    F art     : art/runtime/java_vm_ext.cc:410]   (no managed stack frames)
    F art     : art/runtime/java_vm_ext.cc:410]
    V AudioTrack: timeout 1.009
    [...]
    V AudioTrack: timeout 0.689
    F art     : art/runtime/runtime.cc:366] Runtime aborting...
    F art     : art/runtime/runtime.cc:366] Aborting thread:
    F art     : art/runtime/runtime.cc:366] "QtThread" prio=5 tid=15 Native
    F art     : art/runtime/runtime.cc:366]   | group="" sCount=0 dsCount=0 obj=0x12e240a0 self=0xb8bf6ff0
    F art     : art/runtime/runtime.cc:366]   | sysTid=18334 nice=0 cgrp=default sched=0/0 handle=0x9cd47930
    F art     : art/runtime/runtime.cc:366]   | state=R schedstat=( 64090728 8846357 66 ) utm=4 stm=2 core=2 HZ=100
    F art     : art/runtime/runtime.cc:366]   | stack=0x9cc4b000-0x9cc4d000 stackSize=1014KB
    F art     : art/runtime/runtime.cc:366]   | held mutexes= "abort lock"
    [...]
    F art     : art/runtime/runtime.cc:366]
    F art     : art/runtime/runtime.cc:366]
    F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 18334 (QtThread)
    V AudioTrack: timeout 0.649
    V AudioTrack: timeout 0.609
    V AudioTrack: timeout 0.609
    V AudioTrack: timeout 0.609
    V AudioTrack: timeout 0.609
    V AudioTrack: timeout 0.569
    V AudioTrack: timeout 0.569
    V AudioTrack: timeout 0.569
    V AudioTrack: timeout 0.569
    18:18:55: 
    
    "org.qtproject.example.QDmi" beendet.
    

    Sometimes and the end there ist also this output:

    W AudioTrack: releaseBuffer() track 0xb8c64258 disabled due to previous underrun, restarting
    


  • Isn't any body else having trouble playing simple sounds on Android? QSoundEffect brings the same problem.
    As workaround I found out, that using QMediaPlayer works.


Log in to reply