-
Notifications
You must be signed in to change notification settings - Fork 113
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-7403 - add remote rtp_passthrough support #3957
Conversation
Warning your change may break code samples. If your change modifies any of the following functions please contact @viamrobotics/fleet-management. Thanks!
|
@@ -452,7 +456,8 @@ func (ss *StreamState) streamH264Passthrough(ctx context.Context) error { | |||
} | |||
|
|||
func (ss *StreamState) unsubscribeH264Passthrough(ctx context.Context, id rtppassthrough.SubscriptionID) error { | |||
cam, err := camera.FromRobot(ss.robot, ss.Stream.Name()) |
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.
We need to turn the SDPTrackName back into a short name for the FromRobot
lookup to work if the camera is in a remote part
robot/web/web_c.go
Outdated
@@ -292,13 +292,13 @@ func (svc *webService) refreshVideoSources() { | |||
if err != nil { | |||
continue | |||
} | |||
existing, ok := svc.videoSources[validSDPTrackName(name)] | |||
existing, ok := svc.videoSources[cam.Name().SDPTrackName()] |
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.
Changed from using private function to new public method on resource.Name
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.
no behavior change, other than requiring injected cameras actually have names in test setup
resource/name_test.go
Outdated
@@ -0,0 +1,148 @@ | |||
package resource |
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 added 2 new functions to this package so I added some tests add added tests for the most common ways resource.Name s are created
Changes:
rdk:component:camera/remote:cam-1
the SDP encoded short name isremote+cam-1
)rdk:component:camera/remote:cam-1
name used iscam-1
asremote
doesn't know that it's name isremote
from the perspective of the main part)Tracker
interface support toReconfigurableClientConn
so that peer connections from viam-server main & remote parts can stream WebRTC tracks to / from each otherTracker
interface to take strings rather thanresource.Name
s as keys for the track names as that is the lowest common denominator for how both module.Add|RemoveStream and stream.Add|RemoveStream endpoints workrobot/web/stream/state/state.go
to support looking up cameras in remote parts by decoding the SDP encoded short name back into a short nameFollow up ticket:
https://viam.atlassian.net/browse/RSDK-7668
Manual Test Plan:
Note:
I tested this manually with the following topology:
At every hop, the frequency of video pauses would increase. I believe this is due to the fact that there is variable latency on the office wifi network, where I see ping times swing between 5 ms and 200 ms per hop when there are a lot of people on the network. When the congestion is bad, the topology above does have noticeable pauses / starts. Future work could mitigate this by adding RTP packet buffering to help prevent pauses / starts at the cost of showing a video feed that is a few seconds stale.
Details:
This diagram shows the inputs to AddStream and the name of the track used in AddTrack & the name format convention used in the case of:
The fact that modules use the fully qualified component name as the input to AddStream and RemoveStream is a mistake I made in an earlier implementation. This change keeps that status quo to not break backward compatibility with existing modules.