Skip to content

Commit

Permalink
Changed connection parameters names to fit gstreamer plugin names,
Browse files Browse the repository at this point in the history
Added value for udp port for video stream,
Changed use of video plugin to rawvideoparse to remove hardcoded "blocksize" parameter,
Removed hardcoded "blocksize" parameter of audio,
Changed names of input and output files to be clearer
  • Loading branch information
Falron98 committed Jan 27, 2025
1 parent 6c9512a commit 7ad2470
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
20 changes: 9 additions & 11 deletions tests/validation/tests/Engine/GstreamerApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ def create_connection_params(
) -> dict:
params = {
"dev-port": dev_port,
"dev-ip": dev_ip,
"ip": ip,
"udp-port": udp_port,
"payload-type": payload_type,
}
if is_tx:
params.update(
{
"dev-ip": ip,
"tx-ip": dev_ip,
"tx-udp-port": udp_port,
"tx-payload-type": payload_type,
"ip": dev_ip,
}
)
else:
params.update(
{
"dev-ip": dev_ip,
"rx-ip": ip,
"rx-udp-port": udp_port,
"rx-payload-type": payload_type,
"ip": ip,
}
)
return params
Expand All @@ -53,7 +53,7 @@ def setup_gstreamer_st20p_tx_pipeline(
tx_fps: int = None,
):
connection_params = create_connection_params(
dev_port=nic_port_list, payload_type=tx_payload_type, is_tx=True
dev_port=nic_port_list, payload_type=tx_payload_type, udp_port=20000, is_tx=True
)

# st20 tx GStreamer command line
Expand All @@ -62,9 +62,8 @@ def setup_gstreamer_st20p_tx_pipeline(
"-v",
"filesrc",
f"location={input_path}",
"blocksize=5529600",
"!",
f"video/x-raw,format={format},height={height},width={width},framerate={framerate}/1",
f"rawvideoparse format={format} height={height} width={width} framerate={framerate}/1",
"!",
"mtl_st20p_tx",
f"tx-queues={tx_queues}",
Expand Down Expand Up @@ -100,7 +99,7 @@ def setup_gstreamer_st20p_rx_pipeline(
rx_fps: int = None,
):
connection_params = create_connection_params(
dev_port=nic_port_list, payload_type=rx_payload_type, is_tx=False
dev_port=nic_port_list, payload_type=rx_payload_type, udp_port=20000, is_tx=False
)

# st20 rx GStreamer command line
Expand Down Expand Up @@ -149,7 +148,6 @@ def setup_gstreamer_st30_tx_pipeline(
"gst-launch-1.0",
"filesrc",
f"location={input_path}",
"blocksize=70000",
"!",
"rawaudioparse",
"format=pcm",
Expand Down
4 changes: 2 additions & 2 deletions tests/validation/tests/Engine/media_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create_video_file(
framerate: str,
format: str,
media_path: str,
output_path: str = "test.yuv",
output_path: str = "test_video.yuv",
pattern: str = "ball",
duration: int = 10,
):
Expand Down Expand Up @@ -56,7 +56,7 @@ def create_audio_file_sox(
channels: int,
bit_depth: int,
frequency: int = 440,
output_path: str = "test.pcm",
output_path: str = "test_audio.pcm",
duration: int = 10,
):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def test_audio_format(
build, media, nic_port_list, audio_format, audio_channel, audio_rate
):
input_file_path = os.path.join(media, "test.pcm")
input_file_path = os.path.join(media, "test_audio.pcm")

media_create.create_audio_file_sox(
sample_rate=audio_rate,
Expand All @@ -39,7 +39,7 @@ def test_audio_format(
rx_config = gstreamerapp.setup_gstreamer_st30_rx_pipeline(
build=build,
nic_port_list=nic_port_list[1],
output_path=os.path.join(media, "output.pcm"),
output_path=os.path.join(media, "output_audio.pcm"),
rx_payload_type=111,
rx_queues=4,
rx_audio_format=gstreamerapp.audio_format_change(audio_format, rx_side=True),
Expand All @@ -53,9 +53,9 @@ def test_audio_format(
tx_command=tx_config,
rx_command=rx_config,
input_file=input_file_path,
output_file=os.path.join(media, "output.pcm"),
output_file=os.path.join(media, "output_audio.pcm"),
type="st30",
)
finally:
media_create.remove_file(input_file_path)
media_create.remove_file(os.path.join(media, "output.pcm"))
media_create.remove_file(os.path.join(media, "output_audio.pcm"))
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_video_format(
rx_config = gstreamerapp.setup_gstreamer_st20p_rx_pipeline(
build=build,
nic_port_list=nic_port_list[1],
output_path=os.path.join(media, "output.yuv"),
output_path=os.path.join(media, "output_video.yuv"),
width=video_file["width"],
height=video_file["height"],
framerate=video_file["fps"],
Expand All @@ -59,10 +59,10 @@ def test_video_format(
rx_command=rx_config,
fps=video_file["fps"],
input_file=input_file_path,
output_file=os.path.join(media, "output.yuv"),
output_file=os.path.join(media, "output_video.yuv"),
type="st20",
)
finally:
# Remove the video file after the test
media_create.remove_file(input_file_path)
media_create.remove_file(os.path.join(media, "output.yuv"))
media_create.remove_file(os.path.join(media, "output_video.yuv"))
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_video_resolutions(
rx_config = gstreamerapp.setup_gstreamer_st20p_rx_pipeline(
build=build,
nic_port_list=nic_port_list[1],
output_path=os.path.join(media, "output.yuv"),
output_path=os.path.join(media, "output_video.yuv"),
width=video_file["width"],
height=video_file["height"],
framerate=video_file["fps"],
Expand All @@ -58,10 +58,10 @@ def test_video_resolutions(
rx_command=rx_config,
fps=video_file["fps"],
input_file=input_file_path,
output_file=os.path.join(media, "output.yuv"),
output_file=os.path.join(media, "output_video.yuv"),
type="st20",
)
finally:
# Remove the video file after the test
media_create.remove_file(input_file_path)
media_create.remove_file(os.path.join(media, "output.yuv"))
media_create.remove_file(os.path.join(media, "output_video.yuv"))

0 comments on commit 7ad2470

Please sign in to comment.