11"""Sumomo の AMD AMF E2E テスト
22
3- AMD AMF (Advanced Media Framework) を使用した VP9/AV1/H264/H265 のテスト
3+ AMD AMF (Advanced Media Framework) を使用した AV1/H264/H265 のテスト
4+
5+ - TODO: VP9 はデコードのみ AMD-AMF が対応しているのでテストは独立させる
46"""
57
68import os
2931@pytest .mark .parametrize (
3032 "video_codec_type" ,
3133 [
32- "VP9" ,
3334 "AV1" ,
3435 "H264" ,
3536 "H265" ,
@@ -46,10 +47,7 @@ def test_sendonly_recvonly(
4647
4748 # エンコーダー設定を準備
4849 encoder_params = {}
49- if video_codec_type == "VP9" :
50- # VP9 は decode だけなので internal を指定
51- encoder_params ["vp9_encoder" ] = "internal"
52- elif video_codec_type == "AV1" :
50+ if video_codec_type == "AV1" :
5351 encoder_params ["av1_encoder" ] = "amd_amf"
5452 elif video_codec_type == "H264" :
5553 encoder_params ["h264_encoder" ] = "amd_amf"
@@ -58,9 +56,7 @@ def test_sendonly_recvonly(
5856
5957 # デコーダー設定を準備
6058 decoder_params = {}
61- if video_codec_type == "VP9" :
62- decoder_params ["vp9_decoder" ] = "amd_amf"
63- elif video_codec_type == "AV1" :
59+ if video_codec_type == "AV1" :
6460 decoder_params ["av1_decoder" ] = "amd_amf"
6561 elif video_codec_type == "H264" :
6662 decoder_params ["h264_decoder" ] = "amd_amf"
@@ -74,9 +70,9 @@ def test_sendonly_recvonly(
7470 role = "sendonly" ,
7571 metadata = sora_settings .metadata ,
7672 http_port = next (port_allocator ),
73+ audio = False ,
7774 video = True ,
7875 video_codec_type = video_codec_type ,
79- audio = True ,
8076 initial_wait = 10 ,
8177 ** encoder_params ,
8278 ) as sender :
@@ -87,8 +83,6 @@ def test_sendonly_recvonly(
8783 role = "recvonly" ,
8884 metadata = sora_settings .metadata ,
8985 http_port = next (port_allocator ),
90- video = True ,
91- audio = True ,
9286 ** decoder_params ,
9387 ) as receiver :
9488 time .sleep (3 )
@@ -102,11 +96,6 @@ def test_sendonly_recvonly(
10296 assert sender_video_codec is not None
10397 assert sender_video_codec ["mimeType" ] == expected_mime_type
10498
105- # audio codec を確認
106- sender_audio_codec = get_codec (sender_stats , "audio/opus" )
107- assert sender_audio_codec is not None
108- assert sender_audio_codec ["mimeType" ] == "audio/opus"
109-
11099 # video outbound-rtp を確認
111100 sender_video_outbound = get_outbound_rtp (sender_stats , "video" )
112101 assert sender_video_outbound is not None
@@ -115,12 +104,6 @@ def test_sendonly_recvonly(
115104 assert "encoderImplementation" in sender_video_outbound
116105 assert sender_video_outbound ["encoderImplementation" ] == CODEC_IMPLEMENTATION
117106
118- # audio outbound-rtp を確認
119- sender_audio_outbound = get_outbound_rtp (sender_stats , "audio" )
120- assert sender_audio_outbound is not None
121- assert sender_audio_outbound ["packetsSent" ] > 0
122- assert sender_audio_outbound ["bytesSent" ] > 0
123-
124107 # 受信側の統計を確認
125108 receiver_stats = receiver .get_stats ()
126109 assert receiver_stats is not None
@@ -130,11 +113,6 @@ def test_sendonly_recvonly(
130113 assert receiver_video_codec is not None
131114 assert receiver_video_codec ["mimeType" ] == expected_mime_type
132115
133- # audio codec を確認
134- receiver_audio_codec = get_codec (receiver_stats , "audio/opus" )
135- assert receiver_audio_codec is not None
136- assert receiver_audio_codec ["mimeType" ] == "audio/opus"
137-
138116 # video inbound-rtp を確認
139117 receiver_video_inbound = get_inbound_rtp (receiver_stats , "video" )
140118 assert receiver_video_inbound is not None
@@ -143,12 +121,6 @@ def test_sendonly_recvonly(
143121 assert "decoderImplementation" in receiver_video_inbound
144122 assert receiver_video_inbound ["decoderImplementation" ] == CODEC_IMPLEMENTATION
145123
146- # audio inbound-rtp を確認
147- receiver_audio_inbound = get_inbound_rtp (receiver_stats , "audio" )
148- assert receiver_audio_inbound is not None
149- assert receiver_audio_inbound ["packetsReceived" ] > 0
150- assert receiver_audio_inbound ["bytesReceived" ] > 0
151-
152124
153125@pytest .mark .parametrize (
154126 "video_codec_type" ,
@@ -170,10 +142,7 @@ def test_sendrecv(
170142
171143 # エンコーダー設定を準備
172144 encoder_params = {}
173- if video_codec_type == "VP9" :
174- # VP9 は decode だけなので internal を指定
175- encoder_params ["vp9_encoder" ] = "internal"
176- elif video_codec_type == "AV1" :
145+ if video_codec_type == "AV1" :
177146 encoder_params ["av1_encoder" ] = "amd_amf"
178147 elif video_codec_type == "H264" :
179148 encoder_params ["h264_encoder" ] = "amd_amf"
@@ -182,9 +151,7 @@ def test_sendrecv(
182151
183152 # デコーダー設定を準備
184153 decoder_params = {}
185- if video_codec_type == "VP9" :
186- decoder_params ["vp9_decoder" ] = "amd_amf"
187- elif video_codec_type == "AV1" :
154+ if video_codec_type == "AV1" :
188155 decoder_params ["av1_decoder" ] = "amd_amf"
189156 elif video_codec_type == "H264" :
190157 decoder_params ["h264_decoder" ] = "amd_amf"
@@ -201,9 +168,9 @@ def test_sendrecv(
201168 role = "sendrecv" ,
202169 metadata = sora_settings .metadata ,
203170 http_port = next (port_allocator ),
171+ audio = False ,
204172 video = True ,
205173 video_codec_type = video_codec_type ,
206- audio = True ,
207174 initial_wait = 10 ,
208175 ** codec_params ,
209176 ) as client1 :
@@ -214,9 +181,9 @@ def test_sendrecv(
214181 role = "sendrecv" ,
215182 metadata = sora_settings .metadata ,
216183 http_port = next (port_allocator ),
184+ audio = False ,
217185 video = True ,
218186 video_codec_type = video_codec_type ,
219- audio = True ,
220187 initial_wait = 10 ,
221188 ** codec_params ,
222189 ) as client2 :
@@ -231,11 +198,6 @@ def test_sendrecv(
231198 assert client1_video_codec is not None
232199 assert client1_video_codec ["mimeType" ] == expected_mime_type
233200
234- # audio codec を確認
235- client1_audio_codec = get_codec (client1_stats , "audio/opus" )
236- assert client1_audio_codec is not None
237- assert client1_audio_codec ["mimeType" ] == "audio/opus"
238-
239201 # video outbound-rtp を確認
240202 client1_video_outbound = get_outbound_rtp (client1_stats , "video" )
241203 assert client1_video_outbound is not None
@@ -244,12 +206,6 @@ def test_sendrecv(
244206 assert "encoderImplementation" in client1_video_outbound
245207 assert client1_video_outbound ["encoderImplementation" ] == CODEC_IMPLEMENTATION
246208
247- # audio outbound-rtp を確認
248- client1_audio_outbound = get_outbound_rtp (client1_stats , "audio" )
249- assert client1_audio_outbound is not None
250- assert client1_audio_outbound ["packetsSent" ] > 0
251- assert client1_audio_outbound ["bytesSent" ] > 0
252-
253209 # video inbound-rtp を確認
254210 client1_video_inbound = get_inbound_rtp (client1_stats , "video" )
255211 assert client1_video_inbound is not None
@@ -258,12 +214,6 @@ def test_sendrecv(
258214 assert "decoderImplementation" in client1_video_inbound
259215 assert client1_video_inbound ["decoderImplementation" ] == CODEC_IMPLEMENTATION
260216
261- # audio inbound-rtp を確認
262- client1_audio_inbound = get_inbound_rtp (client1_stats , "audio" )
263- assert client1_audio_inbound is not None
264- assert client1_audio_inbound ["packetsReceived" ] > 0
265- assert client1_audio_inbound ["bytesReceived" ] > 0
266-
267217 # クライアント 2 の統計を確認
268218 client2_stats = client2 .get_stats ()
269219 assert client2_stats is not None
@@ -273,11 +223,6 @@ def test_sendrecv(
273223 assert client2_video_codec is not None
274224 assert client2_video_codec ["mimeType" ] == expected_mime_type
275225
276- # audio codec を確認
277- client2_audio_codec = get_codec (client2_stats , "audio/opus" )
278- assert client2_audio_codec is not None
279- assert client2_audio_codec ["mimeType" ] == "audio/opus"
280-
281226 # video outbound-rtp を確認
282227 client2_video_outbound = get_outbound_rtp (client2_stats , "video" )
283228 assert client2_video_outbound is not None
@@ -286,12 +231,6 @@ def test_sendrecv(
286231 assert "encoderImplementation" in client2_video_outbound
287232 assert client2_video_outbound ["encoderImplementation" ] == CODEC_IMPLEMENTATION
288233
289- # audio outbound-rtp を確認
290- client2_audio_outbound = get_outbound_rtp (client2_stats , "audio" )
291- assert client2_audio_outbound is not None
292- assert client2_audio_outbound ["packetsSent" ] > 0
293- assert client2_audio_outbound ["bytesSent" ] > 0
294-
295234 # video inbound-rtp を確認
296235 client2_video_inbound = get_inbound_rtp (client2_stats , "video" )
297236 assert client2_video_inbound is not None
@@ -300,12 +239,6 @@ def test_sendrecv(
300239 assert "decoderImplementation" in client2_video_inbound
301240 assert client2_video_inbound ["decoderImplementation" ] == CODEC_IMPLEMENTATION
302241
303- # audio inbound-rtp を確認
304- client2_audio_inbound = get_inbound_rtp (client2_stats , "audio" )
305- assert client2_audio_inbound is not None
306- assert client2_audio_inbound ["packetsReceived" ] > 0
307- assert client2_audio_inbound ["bytesReceived" ] > 0
308-
309242
310243# AMD AMF では VP9 デコードのみ対応
311244@pytest .mark .parametrize (
@@ -333,7 +266,7 @@ def test_simulcast(sora_settings, free_port, video_codec_type):
333266 role = "sendonly" ,
334267 metadata = sora_settings .metadata ,
335268 http_port = free_port ,
336- audio = True ,
269+ audio = False ,
337270 video = True ,
338271 video_codec_type = video_codec_type ,
339272 simulcast = True ,
@@ -362,17 +295,6 @@ def test_simulcast(sora_settings, free_port, video_codec_type):
362295 for expected_type in expected_types :
363296 assert expected_type in stat_types
364297
365- # audio codec を確認
366- audio_codec_stats = [
367- stat
368- for stat in stats
369- if stat .get ("type" ) == "codec" and stat .get ("mimeType" ) == "audio/opus"
370- ]
371- assert len (audio_codec_stats ) == 1
372-
373- audio_codec = audio_codec_stats [0 ]
374- assert audio_codec ["clockRate" ] == 48000
375-
376298 # video codec を確認
377299 expected_mime_type = f"video/{ video_codec_type } "
378300 video_codec_stats = [
@@ -385,18 +307,6 @@ def test_simulcast(sora_settings, free_port, video_codec_type):
385307 video_codec = video_codec_stats [0 ]
386308 assert video_codec ["clockRate" ] == 90000
387309
388- # audio の outbound-rtp を確認
389- audio_outbound_rtp_stats = [
390- stat
391- for stat in stats
392- if stat .get ("type" ) == "outbound-rtp" and stat .get ("kind" ) == "audio"
393- ]
394- assert len (audio_outbound_rtp_stats ) == 1
395-
396- audio_outbound_rtp = audio_outbound_rtp_stats [0 ]
397- assert audio_outbound_rtp ["packetsSent" ] > 0
398- assert audio_outbound_rtp ["bytesSent" ] > 0
399-
400310 # simulcast では video の outbound-rtp が 3 つ存在することを確認
401311 video_outbound_rtp_by_rid = get_simulcast_outbound_rtp (stats , "video" )
402312 assert len (video_outbound_rtp_by_rid ) == 3
0 commit comments