From 7ad2470b6324558b8a4809d1bb79be736b17d863 Mon Sep 17 00:00:00 2001 From: Bartosz Krystowski Date: Mon, 27 Jan 2025 16:53:25 +0000 Subject: [PATCH] Changed connection parameters names to fit gstreamer plugin names, 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 --- tests/validation/tests/Engine/GstreamerApp.py | 20 +++++++++---------- .../validation/tests/Engine/media_creator.py | 4 ++-- .../audio_format/test_audio_format.py | 8 ++++---- .../video_format/test_video_format.py | 6 +++--- .../video_resolution/test_video_resolution.py | 6 +++--- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/tests/validation/tests/Engine/GstreamerApp.py b/tests/validation/tests/Engine/GstreamerApp.py index c0cb51bdd..7b5149daa 100644 --- a/tests/validation/tests/Engine/GstreamerApp.py +++ b/tests/validation/tests/Engine/GstreamerApp.py @@ -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 @@ -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 @@ -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}", @@ -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 @@ -149,7 +148,6 @@ def setup_gstreamer_st30_tx_pipeline( "gst-launch-1.0", "filesrc", f"location={input_path}", - "blocksize=70000", "!", "rawaudioparse", "format=pcm", diff --git a/tests/validation/tests/Engine/media_creator.py b/tests/validation/tests/Engine/media_creator.py index ed569669b..f3f96ee62 100644 --- a/tests/validation/tests/Engine/media_creator.py +++ b/tests/validation/tests/Engine/media_creator.py @@ -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, ): @@ -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, ): """ diff --git a/tests/validation/tests/single/gstreamer/audio_format/test_audio_format.py b/tests/validation/tests/single/gstreamer/audio_format/test_audio_format.py index 3ed071a45..9163c8143 100644 --- a/tests/validation/tests/single/gstreamer/audio_format/test_audio_format.py +++ b/tests/validation/tests/single/gstreamer/audio_format/test_audio_format.py @@ -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, @@ -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), @@ -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")) diff --git a/tests/validation/tests/single/gstreamer/video_format/test_video_format.py b/tests/validation/tests/single/gstreamer/video_format/test_video_format.py index 8b684768b..d5d978645 100644 --- a/tests/validation/tests/single/gstreamer/video_format/test_video_format.py +++ b/tests/validation/tests/single/gstreamer/video_format/test_video_format.py @@ -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"], @@ -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")) diff --git a/tests/validation/tests/single/gstreamer/video_resolution/test_video_resolution.py b/tests/validation/tests/single/gstreamer/video_resolution/test_video_resolution.py index c21bf3bee..54989cc1e 100644 --- a/tests/validation/tests/single/gstreamer/video_resolution/test_video_resolution.py +++ b/tests/validation/tests/single/gstreamer/video_resolution/test_video_resolution.py @@ -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"], @@ -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"))