AVSampleBufferDisplayLayer 360p visual output corruption on iPad Pro 9.7"

Number:rdar://29810344 Date Originated:2016-12-26
Status:Closed Resolved:2017-06-22
Product:iOS + SDK Product Version:10.2 (14C92)
Classification:Other bug Reproducible:Always

When outputting uncompressed 360p video frames via AVSampleBufferDisplayLayer, display reliably becomes corrupted on iPad Pro 9.7": the frame is offset about 16 horizontal pixels, with some corruption visible in the upper-left corner (usually appearing green or purple). This happens whether I obtain CMSampleBuffers from AVAssetReader with an MP4 file or through manual creation of biplanar YCbCr io-backed CVPixelBuffers. After changing frame sizes, or if reading a file at a different resolution, the problem goes away for the duration of the app's run, then returns when relaunching.

Steps to Reproduce:
See attached minimal test case app:
1. obtain uncompressed CMSampleBuffers from a 640x360 video (for instance via AVAssetReader)
2. Create an AVSampleBufferDisplayLayer
3. on a main-thread timer, enqueue buffers one at a time to the layer with the immediate-show attachment

Expected Results:
Video frames should play back reliably and be displayed accurately.

Actual Results:
After about 4 frames, display becomes corrupted and remains corrupted as long as playback continues at this resolution. Other resolutions (480p, 1080p etc) don't seem to trigger the problem. Can reproduce reliably with 360p video on iPad Pro 9.7" w/ iOS 10.2 (14C92) but not with exact same app on iPad Air with iOS 10.2 (14C5077b).

iOS 10.2 (14C92)

Reproduction is very reliable on the iPad Pro 9.7", but I haven't been able to reproduce on iPad Air or iPhone 5C also running iOS 10.2.

iPad Pro 9.7"

'LayerTest.zip' was successfully uploaded.

Update 2017-06-22: Fixed in iOS 11; confirmed on beta 2 & closing out.


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!