AVAssetImageGenerator blocks calling thread

Originator:aditya
Number:rdar://46687884 Date Originated:December 13 2018 11:58 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.1.1
Classification:Performance Reproducible:Always
 
Area:
AVFoundation

Summary:
When calling -[AVAssetImageGenerator generateCGImagesAsynchronouslyForTimes:completionHandler:], the calling thread is blocked for a long time, even though the method is supposed to be asynchronous.
This is reproducible when the asset is created using a network URL.

Steps to Reproduce:
Run the attached sample project. 

Expected Results:
The message
"Time for generate method to return: ..." is logged with a small value (ideally less than 0.1s).

Actual Results:
The message 
"Time for generate method to return: 2.083s" is logged. This is a very long time for a method to be blocking something when its name says it should be asynchronous.

Version/Build:
iPhone 7 Plus, iOS 12.1.1.

Configuration:
Xcode Version 10.1 (10B61), using the iOS 12.1 SDK

Sample project: https://github.com/PSPDFKit-labs/radar.apple.com/tree/master/46687884%20-%20AVAssetImageGenerator%20blocks%20calling%20thread

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!