Pion has recieved an "answer" from the remote Unreal Engine Pixel Streaming (through Cirrus) Pion will now set its remote session description that it got from the answer. Once Pion has its own local session description and the remote session description set then it should begin signalling the ice ca
(message []byte, peerConnection *webrtc.PeerConnection, wsConn *websocket.Conn, pendingCandidates *[]*webrtc.ICECandidate)
| 141 | // This flow is based on: |
| 142 | // https://github.com/pion/webrtc/blob/687d915e05a69441beae1bba0802e28756eecbbc/examples/pion-to-pion/offer/main.go#L90 |
| 143 | func handleRemoteAnswer(message []byte, peerConnection *webrtc.PeerConnection, wsConn *websocket.Conn, pendingCandidates *[]*webrtc.ICECandidate) { |
| 144 | sdp := webrtc.SessionDescription{} |
| 145 | unmarshalError := json.Unmarshal([]byte(message), &sdp) |
| 146 | |
| 147 | if unmarshalError != nil { |
| 148 | log.Printf("Error occured during unmarshaling sdp. Error: %s", unmarshalError.Error()) |
| 149 | return |
| 150 | } |
| 151 | |
| 152 | // Set remote session description we got from UE pixel streaming |
| 153 | if sdpErr := peerConnection.SetRemoteDescription(sdp); sdpErr != nil { |
| 154 | log.Printf("Error occured setting remote session description. Error: %s", sdpErr.Error()) |
| 155 | return |
| 156 | } |
| 157 | fmt.Println("Added session description from UE to Pion.") |
| 158 | |
| 159 | // User websocket to send our local ICE candidates to UE |
| 160 | for _, localIceCandidate := range *pendingCandidates { |
| 161 | sendLocalIceCandidate(wsConn, localIceCandidate) |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | // Pion has received an ice candidate from the remote Unreal Engine Pixel Streaming (through Cirrus). |
| 166 | // We parse this message and add that ice candidate to our peer connection. |
no test coverage detected