Allow extra tracks (#231) (#249)

* Allow extra tracks (#231)

* Add allow_extra_tracks to WebRTC component

---------

Co-authored-by: Marcus Valtonen Örnhag <marcus.valtonen.ornhag@ericsson.com>
This commit is contained in:
Marcus Valtonen Örnhag
2025-04-04 01:13:13 +02:00
committed by GitHub
parent e89f0699b5
commit aed34825e3
3 changed files with 8 additions and 0 deletions

View File

@@ -81,6 +81,7 @@ class WebRTCConnectionMixin:
self.time_limit: float | None
self.modality: Literal["video", "audio", "audio-video"]
self.mode: Literal["send", "receive", "send-receive"]
self.allow_extra_tracks: bool
@staticmethod
async def wait_for_time_limit(pc: RTCPeerConnection, time_limit: float):
@@ -329,6 +330,8 @@ class WebRTCConnectionMixin:
if self.modality not in ["video", "audio", "audio-video"]:
msg = "Modality must be either video, audio, or audio-video"
else:
if self.allow_extra_tracks:
return
msg = f"Unsupported track kind '{track.kind}' for modality '{self.modality}'"
raise ValueError(msg)
if body["webrtc_id"] not in self.connections: