Commit d8dc923
committed
Fix stretched macOS video by syncing aspect ratio to live frames
Derive the display aspect ratio from AVPlayerItem.presentationSize (pixel
aspect ratio and clean aperture applied) and re-sync it per published frame.
The dimensions known at open time can be wrong or stale — HLS reports a
default/early-variant size and anamorphic content has non-square pixels — so
stretching the full bitmap into a Canvas sized from those dimensions distorted
the image. presentationSize is cached from a KVO observer so it can be read off
the main thread.1 parent 64c5c8d commit d8dc923
4 files changed
Lines changed: 107 additions & 5 deletions
File tree
- mediaplayer/src/jvmMain
- kotlin/io/github/kdroidfilter/composemediaplayer/mac
- native/macos
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
Lines changed: 51 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
450 | 489 | | |
451 | 490 | | |
452 | 491 | | |
| |||
459 | 498 | | |
460 | 499 | | |
461 | 500 | | |
462 | | - | |
| 501 | + | |
| 502 | + | |
463 | 503 | | |
464 | 504 | | |
465 | | - | |
| 505 | + | |
466 | 506 | | |
467 | | - | |
468 | | - | |
469 | 507 | | |
470 | 508 | | |
471 | 509 | | |
| |||
488 | 526 | | |
489 | 527 | | |
490 | 528 | | |
491 | | - | |
492 | 529 | | |
493 | 530 | | |
494 | 531 | | |
| |||
621 | 658 | | |
622 | 659 | | |
623 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
624 | 670 | | |
625 | 671 | | |
626 | 672 | | |
| |||
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| |||
886 | 893 | | |
887 | 894 | | |
888 | 895 | | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
889 | 903 | | |
890 | 904 | | |
891 | 905 | | |
| |||
1166 | 1180 | | |
1167 | 1181 | | |
1168 | 1182 | | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1169 | 1206 | | |
1170 | 1207 | | |
1171 | 1208 | | |
| |||
1310 | 1347 | | |
1311 | 1348 | | |
1312 | 1349 | | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
1313 | 1354 | | |
1314 | 1355 | | |
1315 | 1356 | | |
| |||
1420 | 1461 | | |
1421 | 1462 | | |
1422 | 1463 | | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
1423 | 1471 | | |
1424 | 1472 | | |
1425 | 1473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
| |||
196 | 201 | | |
197 | 202 | | |
198 | 203 | | |
| 204 | + | |
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
| |||
0 commit comments