Skip to content

Commit

Permalink
authz の払い出しが audio/video で正常に動作していないように見える
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Nov 10, 2024
1 parent b585f68 commit 946d81b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions tests/test_authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
from client import SoraClient, SoraRole


@pytest.mark.skipif(reason="TODO: バグ")
@pytest.mark.parametrize(
"video_codec_params",
[
# video_codec, encoder_implementation, decoder_implementation
("VP8", "libvpx", "libvpx"),
("VP9", "libvpx", "libvpx"),
("AV1", "libaom", "dav1d"),
("VP8", "libvpx"),
("VP9", "libvpx"),
("AV1", "libaom"),
],
)
def test_sendonly_authz_video_codec_type(setup, video_codec_params):
video_codec, encoder_implementation, decoder_implementation = video_codec_params
video_codec_type, encoder_implementation = video_codec_params

signaling_urls = setup.get("signaling_urls")
channel_id_prefix = setup.get("channel_id_prefix")
Expand All @@ -28,8 +29,9 @@ def test_sendonly_authz_video_codec_type(setup, video_codec_params):
access_token = jwt.encode(
{
"channel_id": channel_id,
"audio": False,
"video": True,
"video_codec_type": video_codec,
"video_codec_type": video_codec_type,
},
secret,
algorithm="HS256",
Expand All @@ -40,24 +42,28 @@ def test_sendonly_authz_video_codec_type(setup, video_codec_params):
signaling_urls,
SoraRole.SENDONLY,
channel_id,
audio=False,
video=True,
# audio True だけど、authz で audio False になる
audio=True,
# video False だけど、authz で video True になる
video=False,
metadata=metadata,
)
sendonly.connect(fake_video=True)

time.sleep(5)

assert sendonly.offer_message is not None
print(sendonly.offer_message)
assert sendonly.offer_message["sdp"] is not None
assert video_codec_type in sendonly.offer_message["sdp"]

sendonly_stats = sendonly.get_stats()

sendonly.disconnect()

# codec が無かったら StopIteration 例外が上がる
# 統計で video が見つからないので謎挙動になってる
sendonly_codec_stats = next(s for s in sendonly_stats if s.get("type") == "codec")
assert sendonly_codec_stats["mimeType"] == f"video/{video_codec}"
assert sendonly_codec_stats["mimeType"] == f"video/{video_codec_type}"

# outbound-rtp が無かったら StopIteration 例外が上がる
outbound_rtp_stats = next(s for s in sendonly_stats if s.get("type") == "outbound-rtp")
Expand Down

0 comments on commit 946d81b

Please sign in to comment.