[AVAssetImageGenerator generateCGImagesAsynchronouslyForTimes:completionHandler:] blocks calling thread for multiple seconds, even though it should be async

Originator:steipete
Number:rdar://46689829 Date Originated:13-Dec-2018 09:17 AM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.1.1
Classification:Performance Reproducible:Always
 
Summary:
This is a duplicate of radar #46687884

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.

Version:
12.1.1

Notes:
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!