pion / mediadevices

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

handle race conditions + add test for Manager.Register #485

Closed bazile-clyde closed 1 year ago

bazile-clyde commented 1 year ago

Description

I've run into race conditions accessing Manager concurrently. This PR adds tests and fixes for race conditions.

codecov[bot] commented 1 year ago

Codecov Report

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

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #485 +/- ## ========================================== + 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/485?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [pkg/driver/manager.go](https://codecov.io/gh/pion/mediadevices/pull/485?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/485/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.