diff --git a/inference/core/env.py b/inference/core/env.py index 9a1ca0a07..6eb060216 100644 --- a/inference/core/env.py +++ b/inference/core/env.py @@ -452,7 +452,3 @@ WORKFLOW_BLOCKS_WRITE_DIRECTORY = os.getenv("WORKFLOW_BLOCKS_WRITE_DIRECTORY") DEDICATED_DEPLOYMENT_ID = os.getenv("DEDICATED_DEPLOYMENT_ID") - -WEBRTC_TURN_IP = os.getenv("WEBRTC_TURN_IP") -WEBRTC_TURN_USERNAME = os.getenv("WEBRTC_TURN_USERNAME") -WEBRTC_TURN_SHARED_SECRET = os.getenv("WEBRTC_TURN_SHARED_SECRET") diff --git a/inference/core/interfaces/stream_manager/manager_app/entities.py b/inference/core/interfaces/stream_manager/manager_app/entities.py index bbf4f7270..8b017c0d9 100644 --- a/inference/core/interfaces/stream_manager/manager_app/entities.py +++ b/inference/core/interfaces/stream_manager/manager_app/entities.py @@ -91,8 +91,15 @@ class WebRTCOffer(BaseModel): sdp: str +class WebRTCTURNConfig(BaseModel): + urls: str + username: str + credential: str + + class InitialiseWebRTCPipelinePayload(InitialisePipelinePayload): webrtc_offer: WebRTCOffer + webrtc_turn_config: WebRTCTURNConfig stream_output: Optional[List[str]] = Field(default_factory=list) data_output: Optional[List[str]] = Field(default_factory=list) webrtc_peer_timeout: float = 1 diff --git a/inference/core/interfaces/stream_manager/manager_app/inference_pipeline_manager.py b/inference/core/interfaces/stream_manager/manager_app/inference_pipeline_manager.py index cfb7cb552..e037a0718 100644 --- a/inference/core/interfaces/stream_manager/manager_app/inference_pipeline_manager.py +++ b/inference/core/interfaces/stream_manager/manager_app/inference_pipeline_manager.py @@ -242,6 +242,7 @@ def start_loop(loop: asyncio.AbstractEventLoop): t.start() webrtc_offer = parsed_payload.webrtc_offer + webrtc_turn_config = parsed_payload.webrtc_turn_config webcam_fps = parsed_payload.webcam_fps to_inference_queue = SyncAsyncQueue(loop=loop) from_inference_queue = SyncAsyncQueue(loop=loop) @@ -251,6 +252,7 @@ def start_loop(loop: asyncio.AbstractEventLoop): future = asyncio.run_coroutine_threadsafe( init_rtc_peer_connection( webrtc_offer=webrtc_offer, + webrtc_turn_config=webrtc_turn_config, to_inference_queue=to_inference_queue, from_inference_queue=from_inference_queue, webrtc_peer_timeout=parsed_payload.webrtc_peer_timeout, diff --git a/inference/core/interfaces/stream_manager/manager_app/webrtc.py b/inference/core/interfaces/stream_manager/manager_app/webrtc.py index 3c01edf87..dd5288980 100644 --- a/inference/core/interfaces/stream_manager/manager_app/webrtc.py +++ b/inference/core/interfaces/stream_manager/manager_app/webrtc.py @@ -18,16 +18,14 @@ from av import VideoFrame from inference.core import logger -from inference.core.env import ( - WEBRTC_TURN_IP, - WEBRTC_TURN_SHARED_SECRET, - WEBRTC_TURN_USERNAME, -) from inference.core.interfaces.camera.entities import ( SourceProperties, VideoFrameProducer, ) -from inference.core.interfaces.stream_manager.manager_app.entities import WebRTCOffer +from inference.core.interfaces.stream_manager.manager_app.entities import ( + WebRTCOffer, + WebRTCTURNConfig, +) from inference.core.utils.async_utils import Queue as SyncAsyncQueue from inference.core.utils.function import experimental @@ -214,6 +212,7 @@ def __init__(self, video_transform_track: VideoTransformTrack, *args, **kwargs): async def init_rtc_peer_connection( webrtc_offer: WebRTCOffer, + webrtc_turn_config: WebRTCTURNConfig, to_inference_queue: "SyncAsyncQueue[VideoFrame]", from_inference_queue: "SyncAsyncQueue[np.ndarray]", webrtc_peer_timeout: float, @@ -230,9 +229,9 @@ async def init_rtc_peer_connection( ) turn_server = RTCIceServer( - urls=[f"turn:{WEBRTC_TURN_IP}:3478"], - username=WEBRTC_TURN_USERNAME, - credential=WEBRTC_TURN_SHARED_SECRET, + urls=[webrtc_turn_config.urls], + username=webrtc_turn_config.username, + credential=webrtc_turn_config.credential, ) peer_connection = RTCPeerConnectionWithFPS( video_transform_track=video_transform_track, diff --git a/requirements/_requirements.txt b/requirements/_requirements.txt index 1d65cb8ad..5f5b64f25 100644 --- a/requirements/_requirements.txt +++ b/requirements/_requirements.txt @@ -16,7 +16,7 @@ pybase64<2.0.0 scikit-image>=0.19.0 requests-toolbelt>=1.0.0 wheel>=0.38.1 -setuptools>=70.0.0,<=72.1.0 +setuptools>=70.0.0 pytest-asyncio<=0.21.1 networkx>=3.1 pydantic~=2.6 diff --git a/requirements/requirements.sdk.http.txt b/requirements/requirements.sdk.http.txt index 6d86bb690..ba244d8a1 100644 --- a/requirements/requirements.sdk.http.txt +++ b/requirements/requirements.sdk.http.txt @@ -5,7 +5,7 @@ pillow>=9.0.0 requests>=2.27.0 supervision>=0.20.0,<1.0.0 numpy<=1.26.4 -aiohttp>=3.9.0 +aiohttp>=3.9.0,<=3.10.11 backoff>=2.2.0 aioresponses>=0.7.6 py-cpuinfo>=9.0.0