Closed Sollimann closed 1 year ago
Also, a few observations that I have made visiting chrome://webrtc-internals/ while streaming:
@rainliu @regexident any suggestions? :)
(SOLVED) It turns out the code was correct, however, our corporate network firewall was blocking webrtc traffic.
SHORT VERSION!. I have a similiar implementation in Go using Pion that works. However, it doesn't work in Rust using the
webrtc
crate. What am I doing wrong?Context: Hey, Rust/video enthusiasts! I'm currently porting our robots' WebRTC video streaming from Go to Rust to improve the maintainability of our codebase. Essentially, we want to avoid maintaining too many languages at once, so we're trying to stick to Rust as it makes up the majority of our codebase.
Current Flow (See system drawing below):
Note: media only flows from left to right, i.e from the robots to the frontend UI
Title: Spot robot from Boston Dynamics
Title: InRobot UI / Frontend app
The goal of our video streaming setup is to relay the WebRTC video stream from the cameras on Spot (image above) through a software component that we're running on the Spot edge computer called the 'webrtc-controller'. The webrtc-controller sets up a WebRTC peer connection with a third-party video infrastructure provider called Twilio, and basically forwards the RTP packets from Spot to the webrtc-controller, then from the webrtc-controller to Twilio. We can then connect to Twilio from the browser and consume the video stream from there.
Problem + Questions: The problem now is that I have kind of hit a wall right now with our migration to Rust and could use some help in resolving the issue.
The current issue is that while we're able to successfully do signaling with Spot and signaling with Twilio, and we're successfully able to connect the two peers and start sending packets to Twilio, we are not able to see the video stream in the browser.
What I've tried:
Hypothesis: My hypothesis is that there is somehow a mismatch between the codecs being used. While we're receiving RTP packets encoded with H.264 from the Spot robot, there is somehow a mismatch between what is received by Spot and what the peer connection with Twilio is expected to receive. I have printed out the codecs of each track and compared the configuration and codecs, and they both seem to match.
About Spot:
Spot uses a http 1.1 server for signaling and we’re interacting with the server on the local network on Spot Spot supports H264 video codec and OPUS audio codec. See Spot webrtc docs
About Twilio:
PS! I’m including some links to our code base in the comment section if you want to have a look for yourself Thank you!!
structure
main.rs
types.rs
cloud/client.rs
relay.rs
spot/client.rs