pion / mediadevices

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

Add manager clearing mechanism for linux cams #532

Closed seanavery closed 8 months ago

seanavery commented 8 months ago

Description

Currently, there is a bug in the Initialize() fn in camera_linux.go where the full driver list is appended causing the manager to fill up with duplicates. This is due to generating a new uuid on the fly for each driver record.

!!! The problem only occurs if calling Initialize after initial init run.

This issue does not occur id camera_darwin.go because the id is taken from avfoundation and is deterministic/unique for each driver.

Solution

Clear all video drivers during the Initialize call to prevent duplicates.

seanavery commented 8 months ago

Looks like I am having CI issues with pion/ice dependency. Not sure if this is related to the recent golang and dependency updates over the last couple of weeks.

Run make test
go: github.com/pion/ice/v2@v2.3.10: missing go.sum entry for go.mod file; to add it:
    go mod download github.com/pion/ice/v2
go: github.com/pion/ice/v2@v2.3.10: missing go.sum entry for go.mod file; to add it:
    go mod download github.com/pion/ice/v2
go vet 
go: github.com/pion/ice/v2@v2.3.10: missing go.sum entry for go.mod file; to add it:
    go mod download github.com/pion/ice/v2
make: *** [Makefile:7[6](https://github.com/pion/mediadevices/actions/runs/6537347218/job/17750984775?pr=532#step:5:7): test] Error 1
Error: Process completed with exit code 2.

It looks like CI failed for the last commit Bump minimum supported Go version to 1.19 .

bazile-clyde commented 8 months ago

Looks like I am having CI issues with pion/ice dependency. Not sure if this is related to the recent golang and dependency updates over the last couple of weeks.

Run make test
go: github.com/pion/ice/v2@v2.3.10: missing go.sum entry for go.mod file; to add it:
  go mod download github.com/pion/ice/v2
go: github.com/pion/ice/v2@v2.3.10: missing go.sum entry for go.mod file; to add it:
  go mod download github.com/pion/ice/v2
go vet 
go: github.com/pion/ice/v2@v2.3.10: missing go.sum entry for go.mod file; to add it:
  go mod download github.com/pion/ice/v2
make: *** [Makefile:7[6](https://github.com/pion/mediadevices/actions/runs/6537347218/job/17750984775?pr=532#step:5:7): test] Error 1
Error: Process completed with exit code 2.

It looks like CI failed for the last commit Bump minimum supported Go version to 1.19 .

Ah, I see. I added a fix for this issue https://github.com/pion/mediadevices/pull/533. You can rebase this on top of that commit after it's pushed. Looks good so far.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Files Coverage Δ
pkg/driver/camera/camera_linux.go 25.00% <50.00%> (+0.52%) :arrow_up:
pkg/driver/manager.go 56.00% <0.00%> (-4.87%) :arrow_down:

:loudspeaker: Thoughts on this report? Let us know!.

bazile-clyde commented 8 months ago

@seanavery the master branch is passing, so feel free to rebase and force push.