Skip to content

Commit

Permalink
Merge pull request #829 from roboflow/feature/make-turn-config-optional
Browse files Browse the repository at this point in the history
Make TURN server config optional
  • Loading branch information
PawelPeczek-Roboflow authored Nov 22, 2024
2 parents 89caeb4 + 5fe9f4c commit 33b17f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
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

0 comments on commit 33b17f2

Please sign in to comment.