15
15
"video_codec_type" ,
16
16
["H264" , "H265" ],
17
17
)
18
- def test_macos_video_hwa_sendonly (setup , video_codec_type ):
18
+ def test_apple_video_toolbox_sendonly (setup , video_codec_type ):
19
19
signaling_urls = setup .get ("signaling_urls" )
20
20
channel_id_prefix = setup .get ("channel_id_prefix" )
21
21
metadata = setup .get ("metadata" )
@@ -56,6 +56,70 @@ def test_macos_video_hwa_sendonly(setup, video_codec_type):
56
56
assert outbound_rtp_stats ["packetsSent" ] > 0
57
57
58
58
59
+ @pytest .mark .skipif (
60
+ os .environ .get ("APPLE_VIDEO_TOOLBOX" ) is None , reason = "Apple Video Toolbox でのみ実行する"
61
+ )
62
+ @pytest .mark .parametrize (
63
+ "video_codec_type" ,
64
+ ["H264" , "H265" ],
65
+ )
66
+ def test_apple_video_toolbox_sendonly_recvonly (setup , video_codec_type ):
67
+ signaling_urls = setup .get ("signaling_urls" )
68
+ channel_id_prefix = setup .get ("channel_id_prefix" )
69
+ metadata = setup .get ("metadata" )
70
+
71
+ channel_id = f"{ channel_id_prefix } _{ __name__ } _{ sys ._getframe ().f_code .co_name } _{ uuid .uuid4 ()} "
72
+
73
+ sendonly = SoraClient (
74
+ signaling_urls ,
75
+ SoraRole .SENDONLY ,
76
+ channel_id ,
77
+ audio = False ,
78
+ video = True ,
79
+ video_codec_type = video_codec_type ,
80
+ metadata = metadata ,
81
+ )
82
+ sendonly .connect (fake_video = True )
83
+
84
+ recvonly = SoraClient (
85
+ signaling_urls ,
86
+ SoraRole .RECVONLY ,
87
+ channel_id ,
88
+ metadata = metadata ,
89
+ )
90
+ recvonly .connect ()
91
+
92
+ time .sleep (5 )
93
+
94
+ sendonly_stats = sendonly .get_stats ()
95
+ recvonly_stats = recvonly .get_stats ()
96
+
97
+ sendonly .disconnect ()
98
+ recvonly .disconnect ()
99
+
100
+ # codec が無かったら StopIteration 例外が上がる
101
+ sendonly_codec_stats = next (s for s in sendonly_stats if s .get ("type" ) == "codec" )
102
+ # 指定した video_codec_type が採用されているかどうか確認する
103
+ assert sendonly_codec_stats ["mimeType" ] == f"video/{ video_codec_type } "
104
+
105
+ # outbound-rtp が無かったら StopIteration 例外が上がる
106
+ outbound_rtp_stats = next (s for s in sendonly_stats if s .get ("type" ) == "outbound-rtp" )
107
+ assert outbound_rtp_stats ["encoderImplementation" ] == "VideoToolbox"
108
+ assert outbound_rtp_stats ["bytesSent" ] > 0
109
+ assert outbound_rtp_stats ["packetsSent" ] > 0
110
+
111
+ # codec が無かったら StopIteration 例外が上がる
112
+ recvonly_codec_stats = next (s for s in recvonly_stats if s .get ("type" ) == "codec" )
113
+ # 指定した video_codec_type が採用されているかどうか確認する
114
+ assert recvonly_codec_stats ["mimeType" ] == f"video/{ video_codec_type } "
115
+
116
+ # outbound-rtp が無かったら StopIteration 例外が上がる
117
+ inbound_rtp_stats = next (s for s in recvonly_stats if s .get ("type" ) == "inbound-rtp" )
118
+ assert inbound_rtp_stats ["decoderImplementation" ] == "VideoToolbox"
119
+ assert inbound_rtp_stats ["bytesReceived" ] > 0
120
+ assert inbound_rtp_stats ["packetsReceived" ] > 0
121
+
122
+
59
123
@pytest .mark .skipif (
60
124
os .environ .get ("APPLE_VIDEO_TOOLBOX" ) is None , reason = "Apple Video Toolbox でのみ実行する"
61
125
)
@@ -90,7 +154,7 @@ def test_macos_video_hwa_sendonly(setup, video_codec_type):
90
154
("H265" , "VideoToolbox" , 200 , 320 , 180 , 1 ),
91
155
],
92
156
)
93
- def test_macos_simulcast (
157
+ def test_apple_video_toolbox_simulcast (
94
158
setup ,
95
159
video_codec_type ,
96
160
expected_implementation ,
@@ -187,124 +251,6 @@ def test_macos_simulcast(
187
251
)
188
252
189
253
190
- @pytest .mark .skipif (
191
- os .environ .get ("APPLE_VIDEO_TOOLBOX" ) is None , reason = "Apple Video Toolbox でのみ実行する"
192
- )
193
- def test_macos_h264_sendonly_recvonly (setup ):
194
- signaling_urls = setup .get ("signaling_urls" )
195
- channel_id_prefix = setup .get ("channel_id_prefix" )
196
- metadata = setup .get ("metadata" )
197
-
198
- channel_id = f"{ channel_id_prefix } _{ __name__ } _{ sys ._getframe ().f_code .co_name } _{ uuid .uuid4 ()} "
199
-
200
- sendonly = SoraClient (
201
- signaling_urls ,
202
- SoraRole .SENDONLY ,
203
- channel_id ,
204
- audio = False ,
205
- video = True ,
206
- video_codec_type = "H264" ,
207
- metadata = metadata ,
208
- )
209
- sendonly .connect ()
210
-
211
- recvonly = SoraClient (
212
- signaling_urls ,
213
- SoraRole .RECVONLY ,
214
- channel_id ,
215
- metadata = metadata ,
216
- )
217
- recvonly .connect ()
218
-
219
- time .sleep (5 )
220
-
221
- sendonly_stats = sendonly .get_stats ()
222
- recvonly_stats = recvonly .get_stats ()
223
-
224
- sendonly .disconnect ()
225
- recvonly .disconnect ()
226
-
227
- # codec が無かったら StopIteration 例外が上がる
228
- sendonly_codec_stats = next (s for s in sendonly_stats if s .get ("type" ) == "codec" )
229
- # H.264 が採用されているかどうか確認する
230
- assert sendonly_codec_stats ["mimeType" ] == "video/H264"
231
-
232
- # outbound-rtp が無かったら StopIteration 例外が上がる
233
- outbound_rtp_stats = next (s for s in sendonly_stats if s .get ("type" ) == "outbound-rtp" )
234
- assert outbound_rtp_stats ["encoderImplementation" ] == "VideoToolbox"
235
- assert outbound_rtp_stats ["bytesSent" ] > 0
236
- assert outbound_rtp_stats ["packetsSent" ] > 0
237
-
238
- # codec が無かったら StopIteration 例外が上がる
239
- recvonly_codec_stats = next (s for s in recvonly_stats if s .get ("type" ) == "codec" )
240
- # H.264 が採用されているかどうか確認する
241
- assert recvonly_codec_stats ["mimeType" ] == "video/H264"
242
-
243
- # outbound-rtp が無かったら StopIteration 例外が上がる
244
- inbound_rtp_stats = next (s for s in recvonly_stats if s .get ("type" ) == "inbound-rtp" )
245
- assert inbound_rtp_stats ["decoderImplementation" ] == "VideoToolbox"
246
- assert inbound_rtp_stats ["bytesReceived" ] > 0
247
- assert inbound_rtp_stats ["packetsReceived" ] > 0
248
-
249
-
250
- @pytest .mark .skipif (
251
- os .environ .get ("APPLE_VIDEO_TOOLBOX" ) is None , reason = "Apple Video Toolbox でのみ実行する"
252
- )
253
- def test_macos_h265_sendonly_recvonly (setup ):
254
- signaling_urls = setup .get ("signaling_urls" )
255
- channel_id_prefix = setup .get ("channel_id_prefix" )
256
- metadata = setup .get ("metadata" )
257
-
258
- channel_id = f"{ channel_id_prefix } _{ __name__ } _{ sys ._getframe ().f_code .co_name } _{ uuid .uuid4 ()} "
259
-
260
- sendonly = SoraClient (
261
- signaling_urls ,
262
- SoraRole .SENDONLY ,
263
- channel_id ,
264
- audio = False ,
265
- video = True ,
266
- video_codec_type = "H265" ,
267
- metadata = metadata ,
268
- )
269
- sendonly .connect ()
270
-
271
- recvonly = SoraClient (
272
- signaling_urls ,
273
- SoraRole .RECVONLY ,
274
- channel_id ,
275
- metadata = metadata ,
276
- )
277
- recvonly .connect ()
278
-
279
- time .sleep (5 )
280
-
281
- sendonly_stats = sendonly .get_stats ()
282
- recvonly_stats = recvonly .get_stats ()
283
-
284
- sendonly .disconnect ()
285
- recvonly .disconnect ()
286
-
287
- # codec が無かったら StopIteration 例外が上がる
288
- sendonly_codec_stats = next (s for s in sendonly_stats if s .get ("type" ) == "codec" )
289
- assert sendonly_codec_stats ["mimeType" ] == "video/H265"
290
-
291
- # outbound-rtp が無かったら StopIteration 例外が上がる
292
- outbound_rtp_stats = next (s for s in sendonly_stats if s .get ("type" ) == "outbound-rtp" )
293
- assert outbound_rtp_stats ["encoderImplementation" ] == "VideoToolbox"
294
- assert outbound_rtp_stats ["bytesSent" ] > 0
295
- assert outbound_rtp_stats ["packetsSent" ] > 0
296
-
297
- # codec が無かったら StopIteration 例外が上がる
298
- recvonly_codec_stats = next (s for s in recvonly_stats if s .get ("type" ) == "codec" )
299
- assert recvonly_codec_stats ["mimeType" ] == "video/H265"
300
-
301
- # outbound-rtp が無かったら StopIteration 例外が上がる
302
- inbound_rtp_stats = next (s for s in recvonly_stats if s .get ("type" ) == "inbound-rtp" )
303
- assert inbound_rtp_stats ["decoderImplementation" ] == "VideoToolbox"
304
- assert inbound_rtp_stats ["bytesReceived" ] > 0
305
- assert inbound_rtp_stats ["packetsReceived" ] > 0
306
-
307
-
308
254
@pytest .mark .skipif (
309
255
os .environ .get ("APPLE_VIDEO_TOOLBOX" ) is None , reason = "Apple Video Toolbox でのみ実行する"
310
256
)
@@ -322,7 +268,7 @@ def test_macos_h265_sendonly_recvonly(setup):
322
268
("H265" , "VideoToolbox" , 1000 , 320 , 180 ),
323
269
],
324
270
)
325
- def test_macos_simulcast_authz_scale_resolution_to (
271
+ def test_apple_video_toolbox_simulcast_authz_scale_resolution_to (
326
272
setup ,
327
273
video_codec_type ,
328
274
encoder_implementation ,
@@ -384,7 +330,7 @@ def test_macos_simulcast_authz_scale_resolution_to(
384
330
)
385
331
sendonly .connect (fake_video = True )
386
332
387
- time .sleep (10 )
333
+ time .sleep (5 )
388
334
389
335
# "type": "offer" の SDP で Simulcast があるかどうか
390
336
assert sendonly .offer_message is not None
0 commit comments