Hi,
Unfortunately, I still got some crash reports after upgrading to version 5.0.1
I may have to add, that I am playing two files at the same time.
To me, this looks like a multi threading problem. As far as I can see this
cordova plugin is **not thread safe**, is this correct?
Investigation:
1. In my crash dump / stacktrace, I got multiple threads that are currently in
`[CDVSound prepareToPlay]`
2. [CDVSound prepareToPlay] starts with a `[self.commandDelegate
runInBackground:^{`
3. `runInBackground` is just a
`dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
block);`
4. The `dispatch_get_global_queue` is a **concurrent** queue, so it does not
help for thread safety / thread sync of the executed tasks, see:
https://developer.apple.com/documentation/dispatch/1452927-dispatch_get_global_queue
Please let me know, if I am missing something 😳
Full Log:
[full_crash_log_5.0.1.txt](https://github.com/apache/cordova-plugin-media/files/2368056/full_crash_log_5.0.1.txt)
```
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x41534e57171614cb
VM Region Info: 0x41534e57171614cb is not in any region. Bytes after previous
region: 4707192163435680972
REGION TYPE START - END [ VSIZE] PRT/MAX
SHRMOD REGION DETAIL
MALLOC_NANO (reserved) 00000001d8000000-00000001e0000000 [128.0M] rw-/rwx
SM=NUL ...(unallocated)
--->
UNUSED SPACE AT END
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
Triggered by Thread: 14
Thread 14 name:
Thread 14 Crashed:
0 AVFAudio 0x000000018a9a880c
AVAudioPlayerCpp::AQOutputCallbackCore(OpaqueAudioQueue*, AudioQueueBuffer*) +
180 (AVAudioPlayerCpp.mm:1250)
1 AVFAudio 0x000000018a9a7e84
AVAudioPlayerCpp::prepareToPlayQueue() + 224 (AVAudioPlayerCpp.mm:883)
2 AVFAudio 0x000000018a9a7e84
AVAudioPlayerCpp::prepareToPlayQueue() + 224 (AVAudioPlayerCpp.mm:883)
3 AVFAudio 0x000000018a9a7fe0
AVAudioPlayerCpp::playQueue(AudioTimeStamp const*) + 112
(AVAudioPlayerCpp.mm:956)
4 AVFAudio 0x000000018a9a6760
AVAudioPlayerCpp::play() + 80 (AVAudioPlayerCpp.mm:667)
5 AVFAudio 0x000000018a968414 -[AVAudioPlayer
play] + 52 (AVAudioPlayer.mm:455)
6 MYAPP 0x0000000102b53484 __30-[CDVSound
startPlayingAudio:]_block_invoke + 1648 (CDVSound.m:418)
7 libdispatch.dylib 0x0000000184904aa0
_dispatch_call_block_and_release + 24 (init.c:994)
8 libdispatch.dylib 0x0000000184904a60
_dispatch_client_callout + 16 (object.m:507)
9 libdispatch.dylib 0x0000000184940548
_dispatch_queue_override_invoke$VARIANT$armv81 + 700 (inline_internal.h:2500)
10 libdispatch.dylib 0x00000001849463c4
_dispatch_root_queue_drain + 592 (inline_internal.h:2539)
11 libdispatch.dylib 0x0000000184946110
_dispatch_worker_thread3 + 112 (queue.c:6092)
12 libsystem_pthread.dylib 0x0000000184c37fac _pthread_wqthread +
1176 (pthread.c:2297)
13 libsystem_pthread.dylib 0x0000000184c37b08 start_wqthread + 4
```
[ Full content available at:
https://github.com/apache/cordova-plugin-media/issues/174 ]
This message was relayed via gitbox.apache.org for [email protected]