-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSDK 889 - Restart web service on media change #1793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This will be nice for people using RDK completely locally on their machine :)
One thing you will want to do is add a test in config/diff_test.go called TestDiffMedia(t *testing.T)
that checks to see if camera/audio_input components being added/removed are picked up. You can use the diff tests in that file as templates.
for idx := 0; idx < len(added.Components); idx++ { | ||
if added.Components[idx].Type == "camera" || added.Components[idx].Type == "audio_input" { | ||
return true | ||
} | ||
} | ||
for idx := 0; idx < len(removed.Components); idx++ { | ||
if removed.Components[idx].Type == "camera" || removed.Components[idx].Type == "audio_input" { | ||
return true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than using the strings "camera" and "audio_input", use the defined variables from the packages, i.e. camera.SubtypeName
and audioinput.SubtypeName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I am not able to pull the camera and audioinput components into the config package due to a circular dependency (components also use config package).
I investigated passing those components into the DiffConfigs function directly but did not like how this turned out as it is used robotimpl which does not currently have access to the components.
I am thinking that is best to leave this hardcoded for now. Another option is to put a one-off config checker directly in the entrypoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edaniels what do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id file a ticket to address that and move on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bhaney added test for diffMedia
if !diff.NetworkEqual { | ||
|
||
if !diff.NetworkEqual || !diff.MediaEqual { | ||
if err := myRobot.StopWeb(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let someone else comment about changing the order in which StopWeb() is called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after bijan change but including cheuk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also LGTM after bijan change
Note: merge base coverage results not available, comparing against closest aa1914d~2=(9e2f63d) instead
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, LGTM!
Be sure to make a JIRA ticket for the reason why you have to hardcode the camera and auto_input strings, and can't use their SubType names |
Description
This PR fixes a problem with the local
rc page
not being able to switch fromgrpc
towebrtc
when a media component is added.Added a method to
diff.go
calleddiffMedia
and an attribute to theDiff
struct calledMediaEqual
.WARNING
I had to slightly rearrange the reconfiguring process to first
StopWeb
beforecreateWebOptions
andmyRobot.Reconfigure
to avoid race conditions with thewebService
close out.Test
To recreate, start with an empty config and run the server.
Notice how the rc page on
localhost:8080
is using GRPC.Then, edit the config by adding a camera component:
Refresh the webpage - now loading with WebRTC!