AVPlayerLayer pixelates on iPhone X when positioned at 0.5 point due to pixel rounding

Originator:sterling.li
Number:rdar://47155494 Date Originated:1/9/2019
Status:Open Resolved:
Product:iOS Product Version:12.1
Classification:SDK Reproducible:Always
 
Summary:
The rasterization on a video layer and a plain view seem to be differently handled by the OS. This can be observed on an iPhone X when we position both an AVPlayerLayer and a plain UIView at a 0.5 point. Because the device scale is 3:1, it will need to either round up the 0.5 pts to 0.6667 or round it down to 0.3333 so the layer can fall on a full pixel. But this rounding seems to be inconsistent across all layers, as for AVPlayerLayer and a regular CALayer the result looks different. We noticed this issue when a square video is played in the fullscreen mode (where it scales to fit screen). You may follow the following steps to observe this issue.

Steps to Reproduce:
1. Load a square video (with any format) using AVPlayer, and scale to fit, and center the player layer on the iPhone X screen so that its origins is at (0, 218.5). 
2. Create a UIView or CALayer with the exact same size with the AVPlayerLayer you have in step 1. Place this view or layer right underneath the AVPlayerLayer.
3. Set the background color of the underneath view or layer to be red.
4. Start playing the video. 
5. Notice that you can see the top most pixel line of the video in red.

Expected Results:
You should not see any part of the view or layer we inserted right below the player layer because they are supposed to be in the same size.

Actual Results:
The top most pixel line of the underneath layer can be observed while the video is playing.

Note that this bug can ONLY be reproduced on actual device, not on simulators.

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!