pion / mediadevices

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

Add default Huffman table if huffman table uninitialized #493

Closed kim-mishra closed 1 year ago

kim-mishra commented 1 year ago

Description

Certain MJPEG frames do not include Huffman tables, this causes an uninitialized Huffman table error during jpeg.Decode(). These changes add a default Huffman Table in the case that one was not provide, so that the jpeg can be processed and transformed into an image. I tested these changes locally with cameras that provide and do not provide Huffman tables to ensure that the error is avoided, and for frames with initialized Huffman tables there is no change in behavior.

Reference issue

Fixes an uninitialized Huffman error that is returned from jpeg.Decode() when a jpeg Frame omits the Huffman Table

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 83.87% and project coverage change: +0.25 :tada:

Comparison is base (bf290b0) 58.85% compared to head (c8312f9) 59.11%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #493 +/- ## ========================================== + Coverage 58.85% 59.11% +0.25% ========================================== Files 62 62 Lines 3753 3784 +31 ========================================== + Hits 2209 2237 +28 Misses 1416 1416 - Partials 128 131 +3 ``` | [Impacted Files](https://codecov.io/gh/pion/mediadevices/pull/493?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [pkg/frame/compressed.go](https://codecov.io/gh/pion/mediadevices/pull/493?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-cGtnL2ZyYW1lL2NvbXByZXNzZWQuZ28=) | `82.35% <83.87%> (+82.35%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.