Skip to content

Conversation

rromanchuk
Copy link
Collaborator

This is a bit ugly, but PoC test to resolve priority inversion warnings

Thread Performance Checker: Thread running at QOS_CLASS_USER_INITIATED waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions
PID: 22258, TID: 26715793

This is probably more relevant in an async/await context.

Example reproduction where callee uses qos of .userInitiated

Task(priority: .userInitiated) {
   try? await model.process()
}
    @MainActor
    class ViewModel: ObservableObject {
        @Published var proccessedVideo: URL?
        init() {}
        
       func process() async throws {
            let nl = NextLevelSessionExporter(withAsset: mixComposition)
            // nl.videoComposition = videoComposition
            // nl.videoOutputConfiguration = self.videoSettings
            // nl.audioOutputConfiguration = self.audioSettings
            // nl.outputURL = watermarkedFilepath
            
            
            try await withCheckedThrowingContinuation { continuation in
                nl.export(completionHandler:  { result in
                    switch result {
                    case .success:
                        continuation.resume()
                    case let .failure(error):
                        continuation.resume(throwing: error)
                    }
                })
            }
            
            self.proccessedVideo = watermarkedFilepath       

       }
    }

Confirmed warnings went away with let nl = NextLevelSessionExporter(withAsset: mixComposition, qos: .userInitiated),

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

Successfully merging this pull request may close these issues.

2 participants