In case someone is still looking for this error: in my case it was happening on iOS 13.5 (but not under Catalyst) because I had two competing remote audio units initialized and running: RemoteIO and VoiceProcessingIO.
Interestingly, echo cancellation worked fine even when I sent my audio via RemoteIO and got mic input via VoiceProcessingIO. However this is the situation when you see repeated exception messages on iOS:
AUBuffer.h:61:GetBufferList: EXCEPTION (-1) [mPtrState == kPtrsInvalid is false]: ""
The fix is to use the same instance of VoiceProcessingIO unit for both input and output. In this case though you will get lower quality mono sound on output regardless of what format specification was set on output bus (0).
This doesn't happen on Catalyst though, so may be a bug in iOS CoreAudio. Hope this helps someone.
Post
Replies
Boosts
Views
Activity
There is nothing wrong with the singleton pattern except you have to be careful with concurrency: you should probably mark your singleton class as @MainActor. This pattern is useful if you want to trigger something in the views in the code that doesn't have access to the view hierarchy. If it's not the case then this pattern is not required, just use plain environment values.
I use this pattern for the global isLoggedIn flag to trigger re-rendering of the root view when it changes.
So this is also possible:
@MainActor
class Singleton: ObservableObject {
@Published var flag: Bool = true
static var shared = Singleton()
}
struct SomeView: View {
@StateObject var singleton = Singleton.shared
var body: some View {
Text("Hello, Singleton\(singleton.flag ? "!" : "?")")
.environmentObject(singleton)
}
}
struct SomeOtherView: View {
@EnvironmentObject var singleton: Singleton
var body: some View {
Text("Hello again, Singleton\(singleton.flag ? "!" : "?")")
}
}
// Somewhere else in the code outside of Views:
Singleton.shared.flag = false
Same issue here after upgrading Xcode to 14.3. HLS and mp4 files aren't showing the video, only playing audio. Strangely in some situations it does play fine, but I couldn't figure out exactly how.