sora-sdk 2025.3.0.dev1__tar.gz → 2025.3.0.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sora-sdk might be problematic. Click here for more details.

Files changed (45) hide show
  1. {sora_sdk-2025.3.0.dev1/src/sora_sdk.egg-info → sora_sdk-2025.3.0.dev3}/PKG-INFO +1 -1
  2. sora_sdk-2025.3.0.dev3/VERSION +1 -0
  3. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/pyproject.toml +5 -5
  4. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/run.py +2 -2
  5. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk/sora_sdk_ext.cpython-311-darwin.so +0 -0
  6. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk/sora_sdk_ext.pyi +6 -0
  7. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3/src/sora_sdk.egg-info}/PKG-INFO +1 -1
  8. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_amd_amf.py +6 -26
  9. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_apple_video_toolbox.py +17 -62
  10. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_authz.py +15 -51
  11. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_authz_simulcast.py +21 -70
  12. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_ca_cert.py +4 -22
  13. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_capability.py +4 -22
  14. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_degradation_preference.py +8 -41
  15. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_encoded_transform.py +46 -33
  16. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_intel_vpl.py +18 -73
  17. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_messaging.py +3 -15
  18. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_messaging_header.py +3 -15
  19. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_nvidia_video_codec_sdk.py +9 -39
  20. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_openh264.py +12 -31
  21. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_openh264_simulcast.py +20 -69
  22. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_opus.py +2 -12
  23. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_re_offer_re_answer_sdp.py +5 -22
  24. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_sendonly_recvonly.py +6 -28
  25. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_signaling.py +4 -22
  26. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_signaling_message.py +8 -34
  27. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_signaling_notify.py +3 -16
  28. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_simulcast.py +2 -11
  29. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_sora_disconnect.py +36 -108
  30. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_type_disconnect.py +8 -32
  31. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_type_switched.py +9 -41
  32. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/tests/test_vad.py +27 -19
  33. sora_sdk-2025.3.0.dev1/VERSION +0 -1
  34. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/LICENSE +0 -0
  35. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/MANIFEST.in +0 -0
  36. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/README.md +0 -0
  37. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/buildbase.py +0 -0
  38. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/pypath.py +0 -0
  39. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/setup.cfg +0 -0
  40. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/setup.py +0 -0
  41. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk/__init__.py +0 -0
  42. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk/py.typed +0 -0
  43. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk.egg-info/SOURCES.txt +0 -0
  44. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk.egg-info/dependency_links.txt +0 -0
  45. {sora_sdk-2025.3.0.dev1 → sora_sdk-2025.3.0.dev3}/src/sora_sdk.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sora_sdk
3
- Version: 2025.3.0.dev1
3
+ Version: 2025.3.0.dev3
4
4
  Summary: WebRTC SFU Sora Python SDK
5
5
  Home-page: https://github.com/shiguredo/sora-python-sdk
6
6
  Author-email: "Shiguredo Inc." <contact+pypi@shiguredo.jp>
@@ -0,0 +1 @@
1
+ 2025.3.0.dev3
@@ -20,26 +20,26 @@ Documentation = "https://sora-python-sdk.shiguredo.jp"
20
20
  Discord = "https://discord.gg/shiguredo"
21
21
 
22
22
  [build-system]
23
- requires = ["setuptools==80.0", "wheel==0.45.1"]
23
+ requires = ["setuptools==80.8", "wheel==0.45.1"]
24
24
  build-backend = "setuptools.build_meta"
25
25
 
26
26
  [tool.uv]
27
27
  python-preference = "only-managed"
28
28
  dev-dependencies = [
29
29
  "nanobind==2.7.0",
30
- "setuptools==80.0",
30
+ "setuptools==80.8",
31
31
  "build==1.2.2.post1",
32
32
  "wheel==0.45.1",
33
33
  "typing-extensions",
34
- "python-dotenv",
35
34
  "numpy",
36
35
  "httpx",
37
36
  "pytest",
38
37
  "ruff",
39
- "mypy",
40
38
  "pyjwt",
41
39
  "pytest-repeat",
42
- "psutil",
40
+ # "ty",
41
+ "pydantic-settings",
42
+ "pyright",
43
43
  ]
44
44
 
45
45
  [tool.ruff]
@@ -267,8 +267,8 @@ def main():
267
267
  if platform.build.arch == "armv8":
268
268
  # ビルド環境が armv8 の場合は libwebrtc のバイナリが使えないのでローカルの clang を利用する
269
269
  cmake_args += [
270
- "-DCMAKE_C_COMPILER=clang-18",
271
- "-DCMAKE_CXX_COMPILER=clang++-18",
270
+ "-DCMAKE_C_COMPILER=clang-19",
271
+ "-DCMAKE_CXX_COMPILER=clang++-19",
272
272
  ]
273
273
  else:
274
274
  cmake_args += [
@@ -226,6 +226,12 @@ class SoraConnection:
226
226
  @on_message.setter
227
227
  def on_message(self, arg: Callable[[str, bytes], None], /) -> None: ...
228
228
 
229
+ @property
230
+ def on_rpc(self) -> Callable[[bytes], None]: ...
231
+
232
+ @on_rpc.setter
233
+ def on_rpc(self, arg: Callable[[bytes], None], /) -> None: ...
234
+
229
235
  @property
230
236
  def on_switched(self) -> Callable[[str], None]: ...
231
237
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sora_sdk
3
- Version: 2025.3.0.dev1
3
+ Version: 2025.3.0.dev3
4
4
  Summary: WebRTC SFU Sora Python SDK
5
5
  Home-page: https://github.com/shiguredo/sora-python-sdk
6
6
  Author-email: "Shiguredo Inc." <contact+pypi@shiguredo.jp>
@@ -1,7 +1,5 @@
1
1
  import os
2
- import sys
3
2
  import time
4
- import uuid
5
3
 
6
4
  import pytest
7
5
  from client import (
@@ -21,7 +19,7 @@ from sora_sdk import (
21
19
 
22
20
 
23
21
  @pytest.mark.skipif(os.environ.get("AMD_AMF") is None, reason="AMD AMF でのみ実行する")
24
- def test_amd_amf_available(setup):
22
+ def test_amd_amf_available(settings):
25
23
  capability = get_video_codec_capability()
26
24
 
27
25
  amd_amf_available = False
@@ -68,26 +66,18 @@ def test_amd_amf_available(setup):
68
66
  "H265",
69
67
  ],
70
68
  )
71
- def test_amd_amf_sendonly_recvonly(setup, video_codec_type):
69
+ def test_amd_amf_sendonly_recvonly(settings, video_codec_type):
72
70
  if not is_codec_supported(video_codec_type, SoraVideoCodecImplementation.AMD_AMF):
73
71
  pytest.skip(
74
72
  f"このチップでは {video_codec_type} のエンコード/デコードの両方がサポートされていません"
75
73
  )
76
74
 
77
- signaling_urls = setup.get("signaling_urls")
78
- channel_id_prefix = setup.get("channel_id_prefix")
79
- metadata = setup.get("metadata")
80
-
81
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
82
-
83
75
  sendonly = SoraClient(
84
- signaling_urls,
76
+ settings,
85
77
  SoraRole.SENDONLY,
86
- channel_id,
87
78
  audio=False,
88
79
  video=True,
89
80
  video_codec_type=video_codec_type,
90
- metadata=metadata,
91
81
  video_codec_preference=SoraVideoCodecPreference(
92
82
  codecs=[
93
83
  SoraVideoCodecPreference.Codec(
@@ -100,10 +90,8 @@ def test_amd_amf_sendonly_recvonly(setup, video_codec_type):
100
90
  sendonly.connect(fake_video=True)
101
91
 
102
92
  recvonly = SoraClient(
103
- signaling_urls,
93
+ settings,
104
94
  SoraRole.RECVONLY,
105
- channel_id,
106
- metadata=metadata,
107
95
  video_codec_preference=SoraVideoCodecPreference(
108
96
  codecs=[
109
97
  SoraVideoCodecPreference.Codec(
@@ -197,7 +185,7 @@ def test_amd_amf_sendonly_recvonly(setup, video_codec_type):
197
185
  ],
198
186
  )
199
187
  def test_amd_amf_simulcast(
200
- setup,
188
+ settings,
201
189
  video_codec_type,
202
190
  expected_implementation,
203
191
  video_width,
@@ -207,24 +195,16 @@ def test_amd_amf_simulcast(
207
195
  if not is_codec_supported(video_codec_type, SoraVideoCodecImplementation.AMD_AMF):
208
196
  pytest.skip(f"このチップでは {video_codec_type} のエンコードがサポートされていません")
209
197
 
210
- signaling_urls = setup.get("signaling_urls")
211
- channel_id_prefix = setup.get("channel_id_prefix")
212
- metadata = setup.get("metadata")
213
-
214
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
215
-
216
198
  video_bit_rate = default_video_bit_rate(video_codec_type, video_width, video_height)
217
199
 
218
200
  sendonly = SoraClient(
219
- signaling_urls,
201
+ settings,
220
202
  SoraRole.SENDONLY,
221
- channel_id,
222
203
  simulcast=True,
223
204
  audio=False,
224
205
  video=True,
225
206
  video_codec_type=video_codec_type,
226
207
  video_bit_rate=video_bit_rate,
227
- metadata=metadata,
228
208
  video_width=video_width,
229
209
  video_height=video_height,
230
210
  video_codec_preference=SoraVideoCodecPreference(
@@ -1,9 +1,6 @@
1
1
  import os
2
- import sys
3
2
  import time
4
- import uuid
5
3
 
6
- import jwt
7
4
  import pytest
8
5
  from client import SoraClient, SoraRole
9
6
  from simulcast import default_video_bit_rate, expect_target_bitrate
@@ -16,28 +13,20 @@ from simulcast import default_video_bit_rate, expect_target_bitrate
16
13
  "video_codec_type",
17
14
  ["H264", "H265"],
18
15
  )
19
- def test_apple_video_toolbox_sendonly(setup, video_codec_type):
20
- signaling_urls = setup.get("signaling_urls")
21
- channel_id_prefix = setup.get("channel_id_prefix")
22
- metadata = setup.get("metadata")
23
-
24
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
25
-
16
+ def test_apple_video_toolbox_sendonly(settings, video_codec_type):
26
17
  sendonly = SoraClient(
27
- signaling_urls,
18
+ settings,
28
19
  SoraRole.SENDONLY,
29
- channel_id,
30
20
  audio=False,
31
21
  video=True,
32
22
  video_codec_type=video_codec_type,
33
- metadata=metadata,
34
23
  )
35
24
  sendonly.connect(fake_video=True)
36
25
 
37
26
  time.sleep(5)
38
27
 
39
28
  assert sendonly.connect_message is not None
40
- assert sendonly.connect_message["channel_id"] == channel_id
29
+ assert sendonly.connect_message["channel_id"] == settings.channel_id
41
30
  assert "video" in sendonly.connect_message
42
31
  assert sendonly.connect_message["video"]["codec_type"] == video_codec_type
43
32
 
@@ -64,29 +53,19 @@ def test_apple_video_toolbox_sendonly(setup, video_codec_type):
64
53
  "video_codec_type",
65
54
  ["H264", "H265"],
66
55
  )
67
- def test_apple_video_toolbox_sendonly_recvonly(setup, video_codec_type):
68
- signaling_urls = setup.get("signaling_urls")
69
- channel_id_prefix = setup.get("channel_id_prefix")
70
- metadata = setup.get("metadata")
71
-
72
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
73
-
56
+ def test_apple_video_toolbox_sendonly_recvonly(settings, video_codec_type):
74
57
  sendonly = SoraClient(
75
- signaling_urls,
58
+ settings,
76
59
  SoraRole.SENDONLY,
77
- channel_id,
78
60
  audio=False,
79
61
  video=True,
80
62
  video_codec_type=video_codec_type,
81
- metadata=metadata,
82
63
  )
83
64
  sendonly.connect(fake_video=True)
84
65
 
85
66
  recvonly = SoraClient(
86
- signaling_urls,
67
+ settings,
87
68
  SoraRole.RECVONLY,
88
- channel_id,
89
- metadata=metadata,
90
69
  )
91
70
  recvonly.connect()
92
71
 
@@ -156,31 +135,23 @@ def test_apple_video_toolbox_sendonly_recvonly(setup, video_codec_type):
156
135
  ],
157
136
  )
158
137
  def test_apple_video_toolbox_simulcast(
159
- setup,
138
+ settings,
160
139
  video_codec_type,
161
140
  expected_implementation,
162
141
  video_width,
163
142
  video_height,
164
143
  simulcast_count,
165
144
  ):
166
- signaling_urls = setup.get("signaling_urls")
167
- channel_id_prefix = setup.get("channel_id_prefix")
168
- metadata = setup.get("metadata")
169
-
170
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
171
-
172
145
  video_bit_rate = default_video_bit_rate(video_codec_type, video_width, video_height)
173
146
 
174
147
  sendonly = SoraClient(
175
- signaling_urls,
148
+ settings,
176
149
  SoraRole.SENDONLY,
177
- channel_id,
178
150
  simulcast=True,
179
151
  audio=False,
180
152
  video=True,
181
153
  video_codec_type=video_codec_type,
182
154
  video_bit_rate=video_bit_rate,
183
- metadata=metadata,
184
155
  video_width=video_width,
185
156
  video_height=video_height,
186
157
  )
@@ -281,19 +252,13 @@ def test_apple_video_toolbox_simulcast(
281
252
  ],
282
253
  )
283
254
  def test_apple_video_toolbox_simulcast_authz_scale_resolution_to(
284
- setup,
255
+ settings,
285
256
  video_codec_type,
286
257
  encoder_implementation,
287
258
  video_bit_rate,
288
259
  video_width,
289
260
  video_height,
290
261
  ):
291
- signaling_urls = setup.get("signaling_urls")
292
- channel_id_prefix = setup.get("channel_id_prefix")
293
- secret = setup.get("secret")
294
-
295
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
296
-
297
262
  simulcast_encodings = [
298
263
  {
299
264
  "rid": "r0",
@@ -315,30 +280,20 @@ def test_apple_video_toolbox_simulcast_authz_scale_resolution_to(
315
280
  },
316
281
  ]
317
282
 
318
- access_token = jwt.encode(
319
- {
320
- "channel_id": channel_id,
321
- "video": True,
322
- "video_codec_type": video_codec_type,
323
- "video_bit_rate": video_bit_rate,
324
- "simulcast": True,
325
- "simulcast_encodings": simulcast_encodings,
326
- # 現在時刻 + 300 秒 (5分)
327
- "exp": int(time.time()) + 300,
328
- },
329
- secret,
330
- algorithm="HS256",
331
- )
332
-
333
283
  sendonly = SoraClient(
334
- signaling_urls,
284
+ settings,
335
285
  SoraRole.SENDONLY,
336
- channel_id,
337
286
  audio=False,
338
287
  video=True,
339
288
  video_codec_type=video_codec_type,
340
289
  video_bit_rate=video_bit_rate,
341
- metadata={"access_token": access_token},
290
+ jwt_private_claims={
291
+ "video": True,
292
+ "video_codec_type": video_codec_type,
293
+ "video_bit_rate": video_bit_rate,
294
+ "simulcast": True,
295
+ "simulcast_encodings": simulcast_encodings,
296
+ },
342
297
  video_width=video_width,
343
298
  video_height=video_height,
344
299
  )
@@ -1,43 +1,25 @@
1
- import sys
2
1
  import time
3
- import uuid
4
2
 
5
- import jwt
6
3
  import pytest
7
4
  from client import SoraClient, SoraRole
8
5
 
9
6
 
10
7
  @pytest.mark.skipif(reason="Sora C++ SDK 側の対応が必要")
11
- def test_sendonly_authz_video_true(setup):
8
+ def test_sendonly_authz_video_true(settings):
12
9
  """
13
10
  - type: connect で audio: true / video: false で繫ぐ
14
11
  - 認証成功時の払い出しで audio: false / video: true を払い出す
15
12
  """
16
- signaling_urls = setup.get("signaling_urls")
17
- channel_id_prefix = setup.get("channel_id_prefix")
18
- secret = setup.get("secret")
19
-
20
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
21
-
22
- access_token = jwt.encode(
23
- {
24
- "channel_id": channel_id,
25
- "audio": False,
26
- "video": True,
27
- # 現在時刻 + 300 秒 (5分)
28
- "exp": int(time.time()) + 300,
29
- },
30
- secret,
31
- algorithm="HS256",
32
- )
33
13
 
34
14
  sendonly = SoraClient(
35
- signaling_urls,
15
+ settings,
36
16
  SoraRole.SENDONLY,
37
- channel_id,
38
17
  audio=True,
39
18
  video=False,
40
- metadata={"access_token": access_token},
19
+ jwt_private_claims={
20
+ "audio": True,
21
+ "video": False,
22
+ },
41
23
  )
42
24
  sendonly.connect(fake_video=False, fake_audio=True)
43
25
 
@@ -64,42 +46,24 @@ def test_sendonly_authz_video_true(setup):
64
46
 
65
47
 
66
48
  @pytest.mark.parametrize(
67
- "video_codec_params",
49
+ ("video_codec_type", "expected_implementation"),
68
50
  [
69
- # video_codec, encoder_implementation, decoder_implementation
51
+ # video_codec, expected_implementation
70
52
  ("VP8", "libvpx"),
71
53
  ("VP9", "libvpx"),
72
54
  ("AV1", "libaom"),
73
55
  ],
74
56
  )
75
- def test_sendonly_authz_video_codec_type(setup, video_codec_params):
76
- video_codec_type, encoder_implementation = video_codec_params
77
-
78
- signaling_urls = setup.get("signaling_urls")
79
- channel_id_prefix = setup.get("channel_id_prefix")
80
- secret = setup.get("secret")
81
-
82
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
83
-
84
- access_token = jwt.encode(
85
- {
86
- "channel_id": channel_id,
87
- "video": True,
88
- "video_codec_type": video_codec_type,
89
- # 現在時刻 + 300 秒 (5分)
90
- "exp": int(time.time()) + 300,
91
- },
92
- secret,
93
- algorithm="HS256",
94
- )
95
-
57
+ def test_sendonly_authz_video_codec_type(settings, video_codec_type, expected_implementation):
96
58
  sendonly = SoraClient(
97
- signaling_urls,
59
+ settings,
98
60
  SoraRole.SENDONLY,
99
- channel_id,
100
61
  audio=False,
101
62
  video=True,
102
- metadata={"access_token": access_token},
63
+ jwt_private_claims={
64
+ "video": True,
65
+ "video_codec_type": video_codec_type,
66
+ },
103
67
  )
104
68
  sendonly.connect(fake_video=True)
105
69
 
@@ -120,6 +84,6 @@ def test_sendonly_authz_video_codec_type(setup, video_codec_params):
120
84
 
121
85
  # outbound-rtp が無かったら StopIteration 例外が上がる
122
86
  outbound_rtp_stats = next(s for s in sendonly_stats if s.get("type") == "outbound-rtp")
123
- assert outbound_rtp_stats["encoderImplementation"] == encoder_implementation
87
+ assert outbound_rtp_stats["encoderImplementation"] == expected_implementation
124
88
  assert outbound_rtp_stats["bytesSent"] > 0
125
89
  assert outbound_rtp_stats["packetsSent"] > 0
@@ -1,8 +1,6 @@
1
1
  import sys
2
2
  import time
3
- import uuid
4
3
 
5
- import jwt
6
4
  import pytest
7
5
  from client import SoraClient, SoraRole
8
6
  from simulcast import default_video_bit_rate, expect_target_bitrate
@@ -27,18 +25,12 @@ from simulcast import default_video_bit_rate, expect_target_bitrate
27
25
  ],
28
26
  )
29
27
  def test_authz_simulcast_r2_active_false(
30
- setup,
28
+ settings,
31
29
  video_codec_type,
32
30
  encoder_implementation,
33
31
  video_width,
34
32
  video_height,
35
33
  ):
36
- signaling_urls = setup.get("signaling_urls")
37
- channel_id_prefix = setup.get("channel_id_prefix")
38
- secret = setup.get("secret")
39
-
40
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
41
-
42
34
  video_bit_rate = default_video_bit_rate(video_codec_type, video_width, video_height)
43
35
 
44
36
  simulcast_encodings = [
@@ -60,28 +52,18 @@ def test_authz_simulcast_r2_active_false(
60
52
  },
61
53
  ]
62
54
 
63
- access_token = jwt.encode(
64
- {
65
- "channel_id": channel_id,
55
+ sendonly = SoraClient(
56
+ settings,
57
+ SoraRole.SENDONLY,
58
+ audio=False,
59
+ video=True,
60
+ jwt_private_claims={
66
61
  "video": True,
67
62
  "video_codec_type": video_codec_type,
68
63
  "video_bit_rate": video_bit_rate,
69
64
  "simulcast": True,
70
65
  "simulcast_encodings": simulcast_encodings,
71
- # 現在時刻 + 300 秒 (5分)
72
- "exp": int(time.time()) + 300,
73
66
  },
74
- secret,
75
- algorithm="HS256",
76
- )
77
-
78
- sendonly = SoraClient(
79
- signaling_urls,
80
- SoraRole.SENDONLY,
81
- channel_id,
82
- audio=False,
83
- video=True,
84
- metadata={"access_token": access_token},
85
67
  video_width=video_width,
86
68
  video_height=video_height,
87
69
  )
@@ -208,17 +190,12 @@ def test_authz_simulcast_r2_active_false(
208
190
  ],
209
191
  )
210
192
  def test_authz_simulcast_r2_and_r1_active_false(
211
- setup,
193
+ settings,
212
194
  video_codec_type,
213
195
  encoder_implementation,
214
196
  video_width,
215
197
  video_height,
216
198
  ):
217
- signaling_urls = setup.get("signaling_urls")
218
- channel_id_prefix = setup.get("channel_id_prefix")
219
- secret = setup.get("secret")
220
-
221
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
222
199
  video_bit_rate = default_video_bit_rate(video_codec_type, video_width, video_height)
223
200
 
224
201
  simulcast_encodings = [
@@ -238,28 +215,18 @@ def test_authz_simulcast_r2_and_r1_active_false(
238
215
  },
239
216
  ]
240
217
 
241
- access_token = jwt.encode(
242
- {
243
- "channel_id": channel_id,
218
+ sendonly = SoraClient(
219
+ settings,
220
+ SoraRole.SENDONLY,
221
+ audio=False,
222
+ video=True,
223
+ jwt_private_claims={
244
224
  "video": True,
245
225
  "video_codec_type": video_codec_type,
246
226
  "video_bit_rate": video_bit_rate,
247
227
  "simulcast": True,
248
228
  "simulcast_encodings": simulcast_encodings,
249
- # 現在時刻 + 300 秒 (5分)
250
- "exp": int(time.time()) + 300,
251
229
  },
252
- secret,
253
- algorithm="HS256",
254
- )
255
-
256
- sendonly = SoraClient(
257
- signaling_urls,
258
- SoraRole.SENDONLY,
259
- channel_id,
260
- audio=False,
261
- video=True,
262
- metadata={"access_token": access_token},
263
230
  video_width=video_width,
264
231
  video_height=video_height,
265
232
  )
@@ -368,19 +335,13 @@ def test_authz_simulcast_r2_and_r1_active_false(
368
335
  ],
369
336
  )
370
337
  def test_authz_simulcast_scale_resolution_down_to(
371
- setup,
338
+ settings,
372
339
  video_codec_type,
373
340
  encoder_implementation,
374
341
  video_bit_rate,
375
342
  video_width,
376
343
  video_height,
377
344
  ):
378
- signaling_urls = setup.get("signaling_urls")
379
- channel_id_prefix = setup.get("channel_id_prefix")
380
- secret = setup.get("secret")
381
-
382
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
383
-
384
345
  simulcast_encodings = [
385
346
  {
386
347
  "rid": "r0",
@@ -402,28 +363,18 @@ def test_authz_simulcast_scale_resolution_down_to(
402
363
  },
403
364
  ]
404
365
 
405
- access_token = jwt.encode(
406
- {
407
- "channel_id": channel_id,
366
+ sendonly = SoraClient(
367
+ settings,
368
+ SoraRole.SENDONLY,
369
+ audio=False,
370
+ video=True,
371
+ jwt_private_claims={
408
372
  "video": True,
409
373
  "video_codec_type": video_codec_type,
410
374
  "video_bit_rate": video_bit_rate,
411
375
  "simulcast": True,
412
376
  "simulcast_encodings": simulcast_encodings,
413
- # 現在時刻 + 300 秒 (5分)
414
- "exp": int(time.time()) + 300,
415
377
  },
416
- secret,
417
- algorithm="HS256",
418
- )
419
-
420
- sendonly = SoraClient(
421
- signaling_urls,
422
- SoraRole.SENDONLY,
423
- channel_id,
424
- audio=False,
425
- video=True,
426
- metadata={"access_token": access_token},
427
378
  video_width=video_width,
428
379
  video_height=video_height,
429
380
  )
@@ -1,6 +1,4 @@
1
- import sys
2
1
  import time
3
- import uuid
4
2
 
5
3
  import pytest
6
4
  from client import SoraClient, SoraRole
@@ -66,40 +64,24 @@ p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD
66
64
  """
67
65
 
68
66
 
69
- def test_ca_cert(setup):
70
- signaling_urls = setup.get("signaling_urls")
71
- channel_id_prefix = setup.get("channel_id_prefix")
72
- metadata = setup.get("metadata")
73
-
74
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
75
-
67
+ def test_ca_cert(settings):
76
68
  with SoraClient(
77
- signaling_urls,
69
+ settings,
78
70
  SoraRole.SENDONLY,
79
- channel_id,
80
71
  audio=True,
81
72
  video=True,
82
- metadata=metadata,
83
73
  ca_cert=letsencrypt_org_ca_cert,
84
74
  ):
85
75
  time.sleep(5)
86
76
 
87
77
 
88
78
  @pytest.mark.xfail(reason="Invalid CA certificate")
89
- def test_ca_cert_invalid(setup):
90
- signaling_urls = setup.get("signaling_urls")
91
- channel_id_prefix = setup.get("channel_id_prefix")
92
- metadata = setup.get("metadata")
93
-
94
- channel_id = f"{channel_id_prefix}_{__name__}_{sys._getframe().f_code.co_name}_{uuid.uuid4()}"
95
-
79
+ def test_ca_cert_invalid(settings):
96
80
  with SoraClient(
97
- signaling_urls,
81
+ settings,
98
82
  SoraRole.SENDONLY,
99
- channel_id,
100
83
  audio=True,
101
84
  video=True,
102
- metadata=metadata,
103
85
  ca_cert=pki_goog_ca_cert,
104
86
  ):
105
87
  pass