|
15 | 15 | import asyncio |
16 | 16 | import ctypes |
17 | 17 | import logging |
18 | | -from dataclasses import dataclass |
| 18 | +from dataclasses import dataclass, field |
19 | 19 | from typing import Optional |
20 | 20 |
|
21 | 21 | from pyee.asyncio import EventEmitter |
|
33 | 33 | from .track_publication import RemoteTrackPublication |
34 | 34 |
|
35 | 35 |
|
| 36 | +@dataclass |
| 37 | +class RtcConfiguration: |
| 38 | + ice_transport_type: proto_room.IceTransportType = \ |
| 39 | + proto_room.IceTransportType.TRANSPORT_ALL |
| 40 | + continual_gathering_policy: proto_room.ContinualGatheringPolicy = \ |
| 41 | + proto_room.ContinualGatheringPolicy.GATHER_CONTINUALLY |
| 42 | + ice_servers: list[proto_room.IceServer] = field(default_factory=list) |
| 43 | + |
| 44 | + |
36 | 45 | @dataclass |
37 | 46 | class RoomOptions: |
38 | 47 | auto_subscribe: bool = True |
39 | 48 | dynacast: bool = False |
40 | 49 | e2ee: Optional[E2EEOptions] = None |
| 50 | + rtc_config: Optional[RtcConfiguration] = None |
41 | 51 |
|
42 | 52 |
|
43 | 53 | class ConnectError(Exception): |
@@ -102,6 +112,14 @@ async def connect(self, |
102 | 112 | req.connect.options.e2ee.key_provider_options.ratchet_window_size = \ |
103 | 113 | options.e2ee.key_provider_options.ratchet_window_size |
104 | 114 |
|
| 115 | + if options.rtc_config: |
| 116 | + req.connect.options.rtc_config.ice_transport_type = \ |
| 117 | + options.rtc_config.ice_transport_type # type: ignore |
| 118 | + req.connect.options.rtc_config.continual_gathering_policy = \ |
| 119 | + options.rtc_config.continual_gathering_policy # type: ignore |
| 120 | + req.connect.options.rtc_config.ice_servers.extend( |
| 121 | + options.rtc_config.ice_servers) |
| 122 | + |
105 | 123 | try: |
106 | 124 | queue = ffi_client.queue.subscribe(self._loop) |
107 | 125 | resp = ffi_client.request(req) |
|
0 commit comments