From 66f6784c92f43a6318c672083b07a307071db638 Mon Sep 17 00:00:00 2001 From: lo-simon Date: Tue, 6 Feb 2024 15:58:05 +0000 Subject: [PATCH] Update sdp unit tests with @garethsb suggestions --- Development/nmos/test/sdp_test_utils.cpp | 2 +- Development/nmos/test/sdp_test_utils.h | 3 - Development/nmos/test/sdp_utils_test.cpp | 171 +++++++++++++++++++--- Development/nmos/test/video_jxsv_test.cpp | 93 ++++++++++-- 4 files changed, 231 insertions(+), 38 deletions(-) diff --git a/Development/nmos/test/sdp_test_utils.cpp b/Development/nmos/test/sdp_test_utils.cpp index 413e163c..f4c141e5 100644 --- a/Development/nmos/test/sdp_test_utils.cpp +++ b/Development/nmos/test/sdp_test_utils.cpp @@ -3,7 +3,7 @@ #include "bst/test/test.h" #include "nmos/sdp_utils.h" -namespace sdp_test +namespace nmos { typedef std::multimap comparable_fmtp_t; diff --git a/Development/nmos/test/sdp_test_utils.h b/Development/nmos/test/sdp_test_utils.h index 614ef4d5..5de233cf 100644 --- a/Development/nmos/test/sdp_test_utils.h +++ b/Development/nmos/test/sdp_test_utils.h @@ -4,10 +4,7 @@ namespace nmos { struct sdp_parameters; -} -namespace sdp_test -{ void check_sdp_parameters(const nmos::sdp_parameters& lhs, const nmos::sdp_parameters& rhs); } diff --git a/Development/nmos/test/sdp_utils_test.cpp b/Development/nmos/test/sdp_utils_test.cpp index 66f01672..edf850a2 100644 --- a/Development/nmos/test/sdp_utils_test.cpp +++ b/Development/nmos/test/sdp_utils_test.cpp @@ -561,6 +561,60 @@ BST_TEST_CASE(testSdpParametersVideoRaw) U("raw"), 90000 }, + { + { U("sampling"), U("UNSPECIFIED") }, + { U("depth"), U("16") }, + { U("width"), U("9999") }, + { U("height"), U("6666") }, + { U("exactframerate"), U("123") }, + { U("interlace"), {} }, + { U("segmented"), {} }, + { U("TCS"), U("ST2115LOGS3") }, + { U("colorimetry"), U("BT2100") }, + { U("RANGE"), U("FULLPROTECT") }, + { U("PAR"), U("12:11") }, + { U("PM"), U("2110BPM") }, + { U("SSN"), U("ST2110-20:2022") }, + { U("TP"), U("2110TPW") }, + { U("TROFF"), U("37") }, + { U("CMAX"), U("42") }, + { U("MAXUDP"), U("57") }, + { U("TSMODE"), U("SAMP") }, + { U("TSDELAY"), U("82") } + } + }, + { + sdp::samplings::UNSPECIFIED, + 16, + 9999, + 6666, + { 123, 1 }, + true, + true, + sdp::transfer_characteristic_systems::ST2115LOGS3, + sdp::colorimetries::BT2100, + sdp::ranges::FULLPROTECT, + { 12, 11 }, + sdp::packing_modes::block, + sdp::smpte_standard_numbers::ST2110_20_2022, + sdp::type_parameters::type_W, + 37, + 42, + 57, + sdp::timestamp_modes::SAMP, + 82 + } + }; + + std::pair zero_troff_tsdelay{ + { + U("zero_troff_tsdelay"), + sdp::media_types::video, + { + 123, + U("raw"), + 90000 + }, { { U("sampling"), U("UNSPECIFIED") }, { U("depth"), U("16") }, @@ -598,20 +652,20 @@ BST_TEST_CASE(testSdpParametersVideoRaw) sdp::packing_modes::block, sdp::smpte_standard_numbers::ST2110_20_2022, sdp::type_parameters::type_W, - uint32_t(0), + 0U, 42, 57, sdp::timestamp_modes::SAMP, - uint32_t(0) + 0U } }; - for (auto& test : { example, wacky }) + for (auto& test : { example, wacky, zero_troff_tsdelay }) { auto made = nmos::make_video_raw_sdp_parameters(test.first.session_name, test.second, test.first.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, made); + nmos::check_sdp_parameters(test.first, made); auto roundtripped = nmos::make_video_raw_sdp_parameters(made.session_name, nmos::get_video_raw_parameters(made), made.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, roundtripped); + nmos::check_sdp_parameters(test.first, roundtripped); } } @@ -654,6 +708,34 @@ BST_TEST_CASE(testSdpParametersAudioL) U("L16"), 96000 }, + { + { U("channel-order"), U("SMPTE2110.(M,M,M,M,ST,U02)") }, + { U("TSMODE"), U("SAMP") }, + { U("TSDELAY"), U("82") } + }, + {}, + 0.333 + }, + { + 1, + 16, + 96000, + U("SMPTE2110.(M,M,M,M,ST,U02)"), // not testing nmos::make_fmtp_channel_order here + sdp::timestamp_modes::SAMP, + 82, + 0.333 + } + }; + + std::pair zero_tsdelay{ + { + U("zero_tsdelay"), + sdp::media_types::audio, + { + 123, + U("L16"), + 96000 + }, { { U("channel-order"), U("SMPTE2110.(M,M,M,M,ST,U02)") }, { U("TSMODE"), U("SAMP") }, @@ -668,17 +750,17 @@ BST_TEST_CASE(testSdpParametersAudioL) 96000, U("SMPTE2110.(M,M,M,M,ST,U02)"), // not testing nmos::make_fmtp_channel_order here sdp::timestamp_modes::SAMP, - uint32_t(0), + 0U, 0.333 } }; - for (auto& test : { example, wacky }) + for (auto& test : { example, wacky, zero_tsdelay }) { auto made = nmos::make_audio_L_sdp_parameters(test.first.session_name, test.second, test.first.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, made); + nmos::check_sdp_parameters(test.first, made); auto roundtripped = nmos::make_audio_L_sdp_parameters(made.session_name, nmos::get_audio_L_parameters(made), made.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, roundtripped); + nmos::check_sdp_parameters(test.first, roundtripped); } } @@ -720,6 +802,39 @@ BST_TEST_CASE(testSdpParametersVideoSmpte291) U("smpte291"), 90000 }, + { + { U("DID_SDID"), U("{0xAB,0xCD}") }, + { U("DID_SDID"), U("{0xEF,0x01}") }, + { U("VPID_Code"), U("132") }, + { U("exactframerate"), U("60000/1001") }, + { U("TM"), U("CTM") }, + { U("SSN"), U("ST2110-40:2021") }, + { U("TROFF"), U("37") }, + { U("TSMODE"), U("SAMP") }, + { U("TSDELAY"), U("82") } + } + }, + { + { { 0xAB, 0xCD }, { 0xEF, 0x01 } }, + nmos::vpid_codes::vpid_1_5Gbps_720_line, + nmos::rates::rate59_94, + sdp::transmission_models::compatible, + sdp::smpte_standard_numbers::ST2110_40_2023, + 37, + sdp::timestamp_modes::SAMP, + 82 + } + }; + + std::pair zero_troff_tsdelay{ + { + U("zero_troff_tsdelay"), + sdp::media_types::video, + { + 123, + U("smpte291"), + 90000 + }, { { U("DID_SDID"), U("{0xAB,0xCD}") }, { U("DID_SDID"), U("{0xEF,0x01}") }, @@ -738,18 +853,18 @@ BST_TEST_CASE(testSdpParametersVideoSmpte291) nmos::rates::rate59_94, sdp::transmission_models::compatible, sdp::smpte_standard_numbers::ST2110_40_2023, - uint32_t(0), + 0U, sdp::timestamp_modes::SAMP, - uint32_t(0) + 0U } }; - for (auto& test : { example, wacky }) + for (auto& test : { example, wacky, zero_troff_tsdelay }) { auto made = nmos::make_video_smpte291_sdp_parameters(test.first.session_name, test.second, test.first.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, made); + nmos::check_sdp_parameters(test.first, made); auto roundtripped = nmos::make_video_smpte291_sdp_parameters(made.session_name, nmos::get_video_smpte291_parameters(made), made.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, roundtripped); + nmos::check_sdp_parameters(test.first, roundtripped); } } @@ -784,6 +899,26 @@ BST_TEST_CASE(testSdpParametersVideoSmpte2022_6) U("SMPTE2022-6"), 27000000 }, + { + { U("TP"), U("2110TPW") }, + { U("TROFF"), U("37") } + } + }, + { + sdp::type_parameters::type_W, + 37 + } + }; + + std::pair zero_troff{ + { + U("zero_troff"), + sdp::media_types::video, + { + 123, + U("SMPTE2022-6"), + 27000000 + }, { { U("TP"), U("2110TPW") }, { U("TROFF"), U("0") } @@ -791,15 +926,15 @@ BST_TEST_CASE(testSdpParametersVideoSmpte2022_6) }, { sdp::type_parameters::type_W, - uint32_t(0) + 0U } }; - for (auto& test : { example, wacky }) + for (auto& test : { example, wacky, zero_troff }) { auto made = nmos::make_video_SMPTE2022_6_sdp_parameters(test.first.session_name, test.second, test.first.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, made); + nmos::check_sdp_parameters(test.first, made); auto roundtripped = nmos::make_video_SMPTE2022_6_sdp_parameters(made.session_name, nmos::get_video_SMPTE2022_6_parameters(made), made.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, roundtripped); + nmos::check_sdp_parameters(test.first, roundtripped); } } diff --git a/Development/nmos/test/video_jxsv_test.cpp b/Development/nmos/test/video_jxsv_test.cpp index eab7fb7f..cfbab508 100644 --- a/Development/nmos/test/video_jxsv_test.cpp +++ b/Development/nmos/test/video_jxsv_test.cpp @@ -125,10 +125,11 @@ BST_TEST_CASE(testSdpParametersVideoJpegXs) 90000 }, { - { U("packetmode"), U("0") }, - { U("profile"), U("High444.12") }, - { U("level"), U("1k-1") }, - { U("sublevel"), U("Sublev3bpp") }, + { U("packetmode"), U("1") }, + { U("transmode"), U("0") }, + { U("profile"), U("Light444.12") }, + { U("level"), U("Bayer16k-1") }, + { U("sublevel"), U("Full") }, { U("sampling"), U("UNSPECIFIED") }, { U("width"), U("9999") }, { U("height"), U("6666") }, @@ -136,7 +137,67 @@ BST_TEST_CASE(testSdpParametersVideoJpegXs) { U("depth"), U("16") }, { U("colorimetry"), U("BT2100") }, { U("TCS"), U("UNSPECIFIED") }, - { U("RANGE"), U("FULL") }, + { U("RANGE"), U("NARROW") }, + { U("SSN"), U("ST2110-20:2022") }, + { U("TP"), U("2110TPW") }, + { U("TROFF"), U("37") }, + { U("CMAX"), U("42") }, + { U("MAXUDP"), U("57") }, + { U("TSMODE"), U("SAMP") }, + { U("TSDELAY"), U("82") } + }, + 200000 + }, + { + sdp::video_jxsv::packetization_mode::slice, + sdp::video_jxsv::transmission_mode::out_of_order, + sdp::video_jxsv::profiles::Light444_12, + sdp::video_jxsv::levels::Bayer16k_1, + sdp::video_jxsv::sublevels::Full, + sdp::samplings::UNSPECIFIED, + 16, + 9999, + 6666, + { 123, 1 }, + false, + false, + sdp::transfer_characteristic_systems::UNSPECIFIED, + sdp::colorimetries::BT2100, + sdp::ranges::NARROW, + sdp::smpte_standard_numbers::ST2110_20_2022, + sdp::type_parameters::type_W, + 37, + 42, + 57, + sdp::timestamp_modes::SAMP, + 82, + 200000 + } + }; + + std::pair zero_troff_tsdelay{ + { + U("zero_troff_tsdelay"), + sdp::media_types::video, + { + 123, + U("jxsv"), + 90000 + }, + { + { U("packetmode"), U("1") }, + { U("transmode"), U("0") }, + { U("profile"), U("Light444.12") }, + { U("level"), U("Bayer16k-1") }, + { U("sublevel"), U("Full") }, + { U("sampling"), U("UNSPECIFIED") }, + { U("width"), U("9999") }, + { U("height"), U("6666") }, + { U("exactframerate"), U("123") }, + { U("depth"), U("16") }, + { U("colorimetry"), U("BT2100") }, + { U("TCS"), U("UNSPECIFIED") }, + { U("RANGE"), U("NARROW") }, { U("SSN"), U("ST2110-20:2022") }, { U("TP"), U("2110TPW") }, { U("TROFF"), U("0") }, @@ -148,11 +209,11 @@ BST_TEST_CASE(testSdpParametersVideoJpegXs) 200000 }, { - sdp::video_jxsv::packetization_mode::codestream, - sdp::video_jxsv::transmission_mode::sequential, - sdp::video_jxsv::profiles::High444_12, - sdp::video_jxsv::levels::Level1k_1, - sdp::video_jxsv::sublevels::Sublev3bpp, + sdp::video_jxsv::packetization_mode::slice, + sdp::video_jxsv::transmission_mode::out_of_order, + sdp::video_jxsv::profiles::Light444_12, + sdp::video_jxsv::levels::Bayer16k_1, + sdp::video_jxsv::sublevels::Full, sdp::samplings::UNSPECIFIED, 16, 9999, @@ -162,23 +223,23 @@ BST_TEST_CASE(testSdpParametersVideoJpegXs) false, sdp::transfer_characteristic_systems::UNSPECIFIED, sdp::colorimetries::BT2100, - sdp::ranges::FULL, + sdp::ranges::NARROW, sdp::smpte_standard_numbers::ST2110_20_2022, sdp::type_parameters::type_W, - uint32_t(0), + 0U, 42, 57, sdp::timestamp_modes::SAMP, - uint32_t(0), + 0U, 200000 } }; - for (auto& test : { example, wacky }) + for (auto& test : { example, wacky, zero_troff_tsdelay }) { auto made = nmos::make_video_jxsv_sdp_parameters(test.first.session_name, test.second, test.first.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, made); + nmos::check_sdp_parameters(test.first, made); auto roundtripped = nmos::make_video_jxsv_sdp_parameters(made.session_name, nmos::get_video_jxsv_parameters(made), made.rtpmap.payload_type); - sdp_test::check_sdp_parameters(test.first, roundtripped); + nmos::check_sdp_parameters(test.first, roundtripped); } }