Commit 902ec1c
committed
fix(frame): validate plane_count + add Debug for ffmpeg Frame
Audit issue #4 findings:
1. (LOW, accepted) `VideoFrame::new` / `AudioFrame::new` accept
`plane_count: u8` but the `planes` arrays are fixed at 4 / 8
slots. A caller passing `plane_count > 4` (or `> 8`) would
later trip the slice indexing inside `.planes()` far from the
construction site. Add explicit `assert!` at construction so
the failure mode names `plane_count` directly. Both
constructors gain `# Panics` docs and dedicated
`should_panic` tests.
2. (LOW, accepted) `mediadecode_ffmpeg::Frame` lacked a `Debug`
impl because the inner `ffmpeg_next::frame::Video` doesn't
derive one. Add a manual impl that reports width, height,
pixel format, plane count, and PTS via the public
accessors — useful for debug-print sites without surfacing
raw FFI internals.
Other audit recommendations (INFO `Dimensions` overflow,
`#[must_use]` sweep on builder methods, native webcodecs
tests) intentionally not applied — informational or
stylistic, low value relative to churn.1 parent 6f3ff58 commit 902ec1c
2 files changed
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
78 | 95 | | |
79 | 96 | | |
80 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| |||
297 | 305 | | |
298 | 306 | | |
299 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
300 | 312 | | |
301 | 313 | | |
302 | 314 | | |
| |||
459 | 471 | | |
460 | 472 | | |
461 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
462 | 481 | | |
463 | 482 | | |
464 | 483 | | |
| |||
471 | 490 | | |
472 | 491 | | |
473 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
474 | 497 | | |
475 | 498 | | |
476 | 499 | | |
| |||
780 | 803 | | |
781 | 804 | | |
782 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
783 | 828 | | |
784 | 829 | | |
785 | 830 | | |
| |||
0 commit comments