pion / mediadevices

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

change buffer size to 2 #482

Closed bazile-clyde closed 1 year ago

bazile-clyde commented 1 year ago

Description

From the Linux kernel documentation here

As a practical rule, a minimum of two buffers are needed for proper streaming, and there is usually a maximum (which cannot exceed 32) which makes sense for each device.

This code updates the buffer size from 1 to 2 along with the frame skip logic. The side effect is much higher fps on all 3 of the cameras I've tested, presumably because the buffer is no longer a bottleneck, and there shouldn't be a risk of slowing down any streams.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 57.14% and project coverage change: +0.49 :tada:

Comparison is base (11bf55f) 58.33% compared to head (2882872) 58.83%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #482 +/- ## ========================================== + Coverage 58.33% 58.83% +0.49% ========================================== Files 62 62 Lines 3737 3741 +4 ========================================== + Hits 2180 2201 +21 + Misses 1430 1413 -17 Partials 127 127 ``` | [Impacted Files](https://codecov.io/gh/pion/mediadevices/pull/482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [pkg/driver/camera/camera\_linux.go](https://codecov.io/gh/pion/mediadevices/pull/482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-cGtnL2RyaXZlci9jYW1lcmEvY2FtZXJhX2xpbnV4Lmdv) | `28.93% <0.00%> (ø)` | | | [pkg/driver/manager.go](https://codecov.io/gh/pion/mediadevices/pull/482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-cGtnL2RyaXZlci9tYW5hZ2VyLmdv) | `60.86% <100.00%> (+34.67%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://codecov.io/gh/pion/mediadevices/pull/482/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) 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.