CapSoftware / Cap

Open source Loom alternative. Effortless, instant screen sharing.
https://cap.so
GNU Affero General Public License v3.0
3.63k stars 169 forks source link

Prevent frame data corruption on certain Mac configurations #18

Closed filleduchaos closed 5 months ago

filleduchaos commented 5 months ago

This addresses the bug raised in #17 which is caused by a performance optimisation in macOS's Core Graphics that can insert padding into pixel buffers to keep them optimally aligned for the hardware in use.

I've added comments further explaining the problem and its solution, but as some additional info I'm fairly certain that this is only affecting 14-inch and not 16-inch MBPs because they have native screen widths of 3024 and 3456 pixels respectively. While the exact hardware alignment isn't public info AFAIK, the 16-inch Pro's width is cleanly divisible by powers of 2 up to 128 while the 14-inch Pro's width runs into fractions from 32 up. I don't have a 14 inch Pro on hand so I tried to find a similarly odd external monitor to confirm my suspicions with, but Apple has apparently truly outdone themselves with this resolution 😅

I did also clean up the video capturing code a bit because it was a little difficult to follow, but I didn't change much there.

/claim #17

vercel[bot] commented 5 months ago

@filleduchaos is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

algora-pbc[bot] commented 5 months ago

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe/Alipay.

richiemcilroy commented 5 months ago

Amazing work!