pion / mediadevices

Go implementation of the MediaDevices API.
https://pion.ly/
MIT License
520 stars 119 forks source link

Add fix that strips unexpected padding for NV12 frames #556

Closed hexbabe closed 4 months ago

hexbabe commented 4 months ago

On macOS Sonoma, using the Logitech C922 Pro webcam, NV12 frames seem to come with a default min amount of padding for smaller resolutions e.g. 160x90. This would result in smaller resolution NV12 images outputting like this:

videoframe_16623 my upside down forehead

This change crops the data—making sure it is packed tightly—so that the decodeNV12 precondition can be preserved.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 58.63%. Comparing base (68df5b3) to head (7bc72ac). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #556 +/- ## ======================================= Coverage 58.63% 58.63% ======================================= Files 63 63 Lines 3885 3885 ======================================= Hits 2278 2278 Misses 1473 1473 Partials 134 134 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.