shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Garbage collection crash in IOAudioMonitor

mkrn opened this issue · comments

Describe the bug

EXC_BAD_ACCESS: Exception 1, Code 2047862832, Subcode 8 >
Attempted to dereference garbage pointer 0xa32f64f17a0fe830.
?, in swift::RefCounts::incrementSlow
?, in swift_retain
?, in swift_retain
File "IOAudioMonitor.swift", line 32, in IOAudioMonitor.callback
File "", in IOAudioMonitor.callback
image
image

To Reproduce

Not sure.. caught in the wild.

Expected behavior

Expected not to crash

Version

Latest, main

Smartphone info.

Iphone 12
iOS 16.1.1

Additional context

No response

Screenshots

No response

Relevant log output

No response

Are you using the recently added IOAudioMonitor feature? Does this crash occur when the stream.loopback=false?

yes it's using loopback, however not sure if it's true or false when the crash occurs. Feature implemented as in example app.
Can it be fixed or is it better to remove the feature?

Thank you for using the feature I recently implemented so promptly.
I suspect that the crash is occurring when the RTMPStream instance is being disposed of with loopback = true. I believe the crash could be avoided by setting loopback = false before rtmpStream setting null.

I will try to implement the fix.