Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in Playing #10

Closed
harryworld opened this issue May 30, 2017 · 5 comments
Closed

Crash in Playing #10

harryworld opened this issue May 30, 2017 · 5 comments

Comments

@harryworld
Copy link

Any idea on what's happening?

For some reasons, we implement our code like this.

            DispatchQueue(label: "com.staysorted.soundfx").async {
                Sound.play(file: sound.filename)
            }
Crashed: com.staysorted.soundfx
0  AVFAudio                       0x19d7497b8 AVAudioPlayerCpp::AQOutputCallbackCore(OpaqueAudioQueue*, AudioQueueBuffer*) + 432
1  AVFAudio                       0x19d748d8c AVAudioPlayerCpp::prepareToPlayQueue() + 224
2  AVFAudio                       0x19d748ee4 AVAudioPlayerCpp::playQueue(AudioTimeStamp const*) + 112
3  AVFAudio                       0x19d7477c0 AVAudioPlayerCpp::play() + 84
4  AVFAudio                       0x19d7108e0 -[AVAudioPlayer play] + 52
5  SwiftySound                    0x101602f4c protocol witness for Player.play() -> Bool in conformance AVAudioPlayer (Sound.swift)
6  SwiftySound                    0x1016023f8 Sound.play(numberOfLoops : Int) -> Bool (Sound.swift:153)
7  SwiftySound                    0x101605124 specialized static Sound.play(url : URL, numberOfLoops : Int) -> Bool (Sound.swift:195)
8  SwiftySound                    0x101602640 static Sound.play(file : String, fileExtension : String?, numberOfLoops : Int) -> Bool (Sound.swift)
9  OneReminder                    0x1002a08a0 ORSoundFxManager.(playSound(ORSoundFx) -> ()).(closure #1) (ORSoundFxManager.swift:198)
10 libdispatch.dylib              0x1824069e0 _dispatch_call_block_and_release + 24
11 libdispatch.dylib              0x1824069a0 _dispatch_client_callout + 16
12 libdispatch.dylib              0x182414ad4 _dispatch_queue_serial_drain + 928
13 libdispatch.dylib              0x18240a2cc _dispatch_queue_invoke + 884
14 libdispatch.dylib              0x182414fa8 _dispatch_queue_override_invoke + 344
15 libdispatch.dylib              0x182416a50 _dispatch_root_queue_drain + 540
16 libdispatch.dylib              0x1824167d0 _dispatch_worker_thread3 + 124
17 libsystem_pthread.dylib        0x18260f100 _pthread_wqthread + 1096
18 libsystem_pthread.dylib        0x18260ecac start_wqthread + 4
@adamcichy
Copy link
Owner

Hi Harry,

Thanks for raising the issue.

Unfortunately, I am not able to reproduce it.

The only thing that I can think of is the following.

Try to create the dispatch queue and store a reference somewhere:

let queue = DispatchQueue(label: "com.staysorted.soundfx")

And then use the queue to play sounds:

queue.async {
    Sound.play(file: sound.filename)
}

Please let me know if you are able to give some tips on how to reproduce the issue and if my proposed solution works.

@harryworld
Copy link
Author

Thanks for response @adamcichy
We don't have a clue either, it's just quite random and frequent in our use case.
We just removed the async wrapper, and going to test out in new release.
Will come back on this.

@adamcichy
Copy link
Owner

@harryworld Have you experienced the crash since your last post? Have you got more details that could help identify the issue?

@harryworld
Copy link
Author

It's working fine so far. We have followed your suggestion above.
Thanks.

@adamcichy
Copy link
Owner

That's great. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants