pion / mediadevices

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

Implement bitrate controller in vpx and h264 codecs and use REMB RTCP messages to set bitrate naively #467

Open KW-M opened 1 year ago

KW-M commented 1 year ago

Description

codecov[bot] commented 1 year ago

Codecov Report

Base: 58.21% // Head: 58.41% // Increases project coverage by +0.19% :tada:

Coverage data is based on head (44a76f5) compared to base (f8f8511). Patch coverage: 64.58% of modified lines in pull request are covered.

:exclamation: Current head 44a76f5 differs from pull request most recent head 5478710. Consider uploading reports for the commit 5478710 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #467 +/- ## ========================================== + Coverage 58.21% 58.41% +0.19% ========================================== Files 62 62 Lines 3683 3715 +32 ========================================== + Hits 2144 2170 +26 - Misses 1412 1415 +3 - Partials 127 130 +3 ``` | [Impacted Files](https://codecov.io/gh/pion/mediadevices/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [track.go](https://codecov.io/gh/pion/mediadevices/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-dHJhY2suZ28=) | `26.38% <44.44%> (+1.06%)` | :arrow_up: | | [pkg/codec/x264/x264.go](https://codecov.io/gh/pion/mediadevices/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-cGtnL2NvZGVjL3gyNjQveDI2NC5nbw==) | `68.75% <50.00%> (+3.63%)` | :arrow_up: | | [pkg/codec/vpx/vpx.go](https://codecov.io/gh/pion/mediadevices/pull/467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-cGtnL2NvZGVjL3ZweC92cHguZ28=) | `83.50% <90.00%> (-0.02%)` | :arrow_down: | 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 at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

EmrysMyrddin commented 1 year ago

Hi, thank you for your PR, it looks awesome !

While automatic bitrate adjustment is a great feature, it should probably be configurable. We should be able to at least disable it by default and chose the percentage of the detected maximum bandwidth.

Perhaps you could split this PR, letting us merge your bitrate controllers and discuss about how to implement the automatic bitrate adjustment in a dedicated PR ?

KW-M commented 1 year ago

Thanks for the suggestions @EmrysMyrddin. I rolled back this PR to just include the bit-rate encoder controllers.

I'm thinking the place to implement the option for auto bit-rate control is in the RTPCodec struct at the beginning of codec.go, and then maybe allow setting the percentage bandwidth used per stream by passing the percentage as a mediaStreamConstraint in getUserMedia(). Does that seem good, or might there be a better way to do it?