Skip to content

Commit

Permalink
Improve webrtc stability (#1014)
Browse files Browse the repository at this point in the history
debugging webrtc failed connections
  • Loading branch information
tancik authored Nov 23, 2022
1 parent e4b5dea commit 27ec772
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function WebRtcWindow() {
const getRTCPeerConnection = () => {
const pc = new RTCPeerConnection({
iceServers: [
{ urls: 'stun:stun.l.google.com:19302' },
{
urls: 'stun:openrelay.metered.ca:80',
},
Expand Down
27 changes: 25 additions & 2 deletions nerfstudio/viewer/server/viewer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@

import numpy as np
import torch
from aiortc import RTCPeerConnection, RTCSessionDescription
from aiortc import (
RTCConfiguration,
RTCIceServer,
RTCPeerConnection,
RTCSessionDescription,
)
from cryptography.utils import CryptographyDeprecationWarning
from rich.console import Console

Expand Down Expand Up @@ -503,7 +508,25 @@ async def send_webrtc_answer(self, data):
# returns the description to for WebRTC to the specific websocket connection
offer = RTCSessionDescription(data["sdp"], data["type"])

pc = RTCPeerConnection()
pc = RTCPeerConnection(
configuration=RTCConfiguration(
iceServers=[
RTCIceServer(urls="stun:stun.l.google.com:19302"),
RTCIceServer(urls="stun:openrelay.metered.ca:80"),
RTCIceServer(
urls="turn:openrelay.metered.ca:80", username="openrelayproject", credential="openrelayproject"
),
RTCIceServer(
urls="turn:openrelay.metered.ca:443", username="openrelayproject", credential="openrelayproject"
),
RTCIceServer(
urls="turn:openrelay.metered.ca:443?transport=tcp",
username="openrelayproject",
credential="openrelayproject",
),
]
)
)
self.pcs.add(pc)

video = SingleFrameStreamTrack()
Expand Down

0 comments on commit 27ec772

Please sign in to comment.