Closed bazile-clyde closed 1 year ago
Patch coverage: 36.36
% and project coverage change: -0.29
:warning:
Comparison is base (
f0f6be7
) 59.11% compared to head (d82c93b
) 58.83%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@at-wat could you take a second set of eyes on this?
@edaniels @at-wat Thanks for the reviews. After seeing all of the comments and speaking with @edaniels I updated this PR to make this functionality optional. It's far less changes now and will not break the API.
Description
This PR allows for adapters (video and audio drivers) to handle their own state. This allows us to fix a few issues
Initialize
functions resets the state of an adapter toStateClosed
even if it's in use.StateClosed
orStateRunning
.StateClosed
.Ideally, all drivers would return the actual state of the driver on queries. This PR returns real states for
camera_linux.go
fixing the above issues. All other drivers keep their current behavior.Testing
This was manually tested on a Linux device and works as expected. It should not break any tests or change the current behavior for any drivers other than those on Linux.
Advice for Reviewers
The easiest way to review this code is to start with the changes in
driver.go
andwrapper.go
. Afterwards, ensure none of the logic in any of the files besidescamera_linux.go
has changed. Lastly, review/test the changes incamera_linux.go
and the new states instate.go
. Simply running a background goroutine that continuously calls and prints theStatus()
of a Linux camera and observing what happens when the camera is disconnected and reconnected should be enough.