@@ -154,6 +154,32 @@ void fill_conf_receiver_mcm(Config &config) {
154154 }
155155}
156156
157+ void fill_conf_receiver_srt (Config &config) {
158+ config.function = " rx" ;
159+ config.gpu_hw_acceleration = " none" ;
160+ config.logging_level = 0 ;
161+
162+ Payload p = get_video_payload_common ();
163+ {
164+ Stream s;
165+
166+ s.payload = p;
167+ s.stream_type .type = stream_type::srt;
168+ s.stream_type .srt .urn = " srt://:20001?mode=caller" ;
169+ config.receivers .push_back (s);
170+ }
171+
172+ {
173+ Stream s;
174+
175+ s.payload = p;
176+ s.stream_type .type = stream_type::file;
177+ s.stream_type .file .path = " /home/test/recv" ;
178+ s.stream_type .file .filename = " 1920x1080p10le_1.yuv" ;
179+ config.senders .push_back (s);
180+ }
181+ }
182+
157183void fill_conf_multiviewer (Config &config) {
158184 config.function = " multiviewer" ;
159185 config.gpu_hw_acceleration = " intel" ;
@@ -425,12 +451,25 @@ TEST(FFmpegPipelineGeneratorTest, test_mcm_receiver) {
425451 std::string pipeline_string;
426452
427453 if (ffmpeg_generate_pipeline (conf, pipeline_string) != 0 ) {
428- ASSERT_EQ (1 , 0 ) << " Error generating receiver pipeline" << std::endl;
454+ ASSERT_EQ (1 , 0 ) << " Error generating receiver mcm pipeline" << std::endl;
429455 }
430456 std::string expected_string = " -y -video_size 1920x1080 -pix_fmt yuv422p10le -r 30/1 -f rawvideo -f mcm -conn_type st2110 -transport st2110-20 -transport_pixel_format yuv422p10rfc4175 -ip_addr 192.168.96.10 -port 9002 -i \" 0\" /home/test/recv/1920x1080p10le_1.yuv" ;
431457 ASSERT_EQ (pipeline_string.compare (expected_string) == 0 , 1 ) << " Expected: " << std::endl << expected_string << std::endl << " Got: " << std::endl << pipeline_string << std::endl;
432458}
433459
460+ TEST (FFmpegPipelineGeneratorTest, test_srt) {
461+ Config conf;
462+ fill_conf_receiver_srt (conf);
463+
464+ std::string pipeline_string;
465+
466+ if (ffmpeg_generate_pipeline (conf, pipeline_string) != 0 ) {
467+ ASSERT_EQ (1 , 0 ) << " Error generating srt pipeline" << std::endl;
468+ }
469+ std::string expected_string = " -y -i srt://:20001?mode=caller /home/test/recv/1920x1080p10le_1.yuv" ;
470+ ASSERT_EQ (pipeline_string.compare (expected_string) == 0 , 1 ) << " Expected: " << std::endl << expected_string << std::endl << " Got: " << std::endl << pipeline_string << std::endl;
471+ }
472+
434473TEST (FFmpegPipelineConfigTest, serialize_deserialize_multiviewer) {
435474 Config conf_reference;
436475 fill_conf_multiviewer (conf_reference);
@@ -485,4 +524,35 @@ TEST(FFmpegPipelineConfigTest, serialize_deserialize_upscale) {
485524
486525 ASSERT_EQ (pipeline_string_reference.compare (pipeline_string_deserialized) == 0 , 1 ) << " Expected: " << std::endl << pipeline_string_reference
487526 << std::endl << " Got: " << std::endl << pipeline_string_deserialized << std::endl;
488- }
527+ }
528+
529+ TEST (FFmpegPipelineConfigTest, serialize_deserialize_upscale_srt) {
530+ Config conf_reference;
531+ fill_conf_upscale (conf_reference);
532+
533+ conf_reference.receivers [0 ].stream_type .type = stream_type::srt;
534+ conf_reference.receivers [0 ].stream_type .srt .urn = " srt://:20001" ;
535+
536+ std::string pipeline_string_reference;
537+
538+ if (ffmpeg_generate_pipeline (conf_reference, pipeline_string_reference) != 0 ) {
539+ ASSERT_EQ (1 , 0 ) << " Error generating convert pipeline" << std::endl;
540+ }
541+
542+ std::string json_conf_serialized;
543+ if (serialize_config_json (conf_reference, json_conf_serialized) != 0 ) {
544+ ASSERT_EQ (1 , 0 ) << " Error serializing config" << std::endl;
545+ }
546+
547+ Config conf_deserialized;
548+ std::string pipeline_string_deserialized;
549+ if (deserialize_config_json (conf_deserialized, json_conf_serialized) != 0 ) {
550+ ASSERT_EQ (1 , 0 ) << " Error serializing config" << std::endl;
551+ }
552+ if (ffmpeg_generate_pipeline (conf_deserialized, pipeline_string_deserialized) != 0 ) {
553+ ASSERT_EQ (1 , 0 ) << " Error generating convert pipeline after deserialization" << std::endl;
554+ }
555+
556+ ASSERT_EQ (pipeline_string_reference.compare (pipeline_string_deserialized) == 0 , 1 ) << " Expected: " << std::endl << pipeline_string_reference
557+ << std::endl << " Got: " << std::endl << pipeline_string_deserialized << std::endl;
558+ }
0 commit comments