Skip to content
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

Make TURN server config optional #829

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class WebRTCTURNConfig(BaseModel):

class InitialiseWebRTCPipelinePayload(InitialisePipelinePayload):
webrtc_offer: WebRTCOffer
webrtc_turn_config: WebRTCTURNConfig
webrtc_turn_config: Optional[WebRTCTURNConfig] = None
stream_output: Optional[List[str]] = Field(default_factory=list)
data_output: Optional[List[str]] = Field(default_factory=list)
webrtc_peer_timeout: float = 1
Expand Down
23 changes: 14 additions & 9 deletions inference/core/interfaces/stream_manager/manager_app/webrtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,20 @@ async def init_rtc_peer_connection(
webcam_fps=webcam_fps,
)

turn_server = RTCIceServer(
urls=[webrtc_turn_config.urls],
username=webrtc_turn_config.username,
credential=webrtc_turn_config.credential,
)
peer_connection = RTCPeerConnectionWithFPS(
video_transform_track=video_transform_track,
configuration=RTCConfiguration(iceServers=[turn_server]),
)
if webrtc_turn_config:
turn_server = RTCIceServer(
urls=[webrtc_turn_config.urls],
username=webrtc_turn_config.username,
credential=webrtc_turn_config.credential,
)
peer_connection = RTCPeerConnectionWithFPS(
video_transform_track=video_transform_track,
configuration=RTCConfiguration(iceServers=[turn_server]),
)
else:
peer_connection = RTCPeerConnectionWithFPS(
video_transform_track=video_transform_track,
)
relay = MediaRelay()

@peer_connection.on("track")
Expand Down