Skip to content

Commit

Permalink
Merge branch 'master' into is-12
Browse files Browse the repository at this point in the history
  • Loading branch information
lo-simon committed Feb 9, 2024
2 parents 2fbd8e1 + 6fc99f1 commit cb6aec7
Show file tree
Hide file tree
Showing 18 changed files with 418 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ jobs:
libssl-dev
cd ${{ env.RUNNER_WORKSPACE }}
git clone --recurse-submodules --branch v2.10.18 https://github.com/Microsoft/cpprestsdk
git clone --recurse-submodules --branch v2.10.19 https://github.com/Microsoft/cpprestsdk
cd cpprestsdk/Release
mkdir build
cd build
Expand Down Expand Up @@ -801,7 +801,7 @@ jobs:
libssl-dev
cd ${{ env.RUNNER_WORKSPACE }}
git clone --recurse-submodules --branch v2.10.18 https://github.com/Microsoft/cpprestsdk
git clone --recurse-submodules --branch v2.10.19 https://github.com/Microsoft/cpprestsdk
cd cpprestsdk/Release
mkdir build
cd build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/src/build-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
libssl-dev
cd ${{ env.RUNNER_WORKSPACE }}
git clone --recurse-submodules --branch v2.10.18 https://github.com/Microsoft/cpprestsdk
git clone --recurse-submodules --branch v2.10.19 https://github.com/Microsoft/cpprestsdk
cd cpprestsdk/Release
mkdir build
cd build
Expand Down
4 changes: 2 additions & 2 deletions Development/cmake/NmosCppDependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Boost

set(BOOST_VERSION_MIN "1.54.0")
set(BOOST_VERSION_CUR "1.80.0")
set(BOOST_VERSION_CUR "1.83.0")
# note: 1.57.0 doesn't work due to https://svn.boost.org/trac10/ticket/10754
# note: some components are only required for one platform or other
# so find_package(Boost) is called after adding those components
Expand Down Expand Up @@ -95,7 +95,7 @@ add_library(nmos-cpp::Boost ALIAS Boost)

# note: 2.10.16 or higher is recommended (which is the first version with cpprestsdk-configVersion.cmake)
set(CPPRESTSDK_VERSION_MIN "2.10.11")
set(CPPRESTSDK_VERSION_CUR "2.10.18")
set(CPPRESTSDK_VERSION_CUR "2.10.19")
find_package(cpprestsdk REQUIRED)
if(NOT cpprestsdk_VERSION)
message(STATUS "Found cpprestsdk unknown version; minimum version: " ${CPPRESTSDK_VERSION_MIN})
Expand Down
2 changes: 2 additions & 0 deletions Development/cmake/NmosCppTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ set(NMOS_CPP_TEST_NMOS_TEST_SOURCES
nmos/test/jwt_validation_test.cpp
nmos/test/paging_utils_test.cpp
nmos/test/query_api_test.cpp
nmos/test/sdp_test_utils.cpp
nmos/test/sdp_utils_test.cpp
nmos/test/system_resources_test.cpp
nmos/test/video_jxsv_test.cpp
)
set(NMOS_CPP_TEST_NMOS_TEST_HEADERS
nmos/test/sdp_test_utils.h
)

set(NMOS_CPP_TEST_PPLX_TEST_SOURCES
Expand Down
4 changes: 2 additions & 2 deletions Development/conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[requires]
boost/1.80.0
cpprestsdk/2.10.18
boost/1.83.0
cpprestsdk/2.10.19
websocketpp/0.8.2
openssl/1.1.1s
json-schema-validator/2.3.0
Expand Down
2 changes: 1 addition & 1 deletion Development/mdns/service_advertiser_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace mdns_details
}
}

static bool register_address(DNSServiceRef client, const std::string& host_name, const std::string& ip_address_, const std::string& domain, std::uint32_t interface_id, slog::base_gate& gate)
static bool register_address(DNSServiceRef& client, const std::string& host_name, const std::string& ip_address_, const std::string& domain, std::uint32_t interface_id, slog::base_gate& gate)
{
// since empty host_name is valid for other functions, check that logic error here
if (host_name.empty()) return false;
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/client_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ namespace nmos
}

#ifdef CPPRESTSDK_ENABLE_BIND_WEBSOCKET_CLIENT
// The current version of the C++ REST SDK 2.10.18 does not provide the callback to enable the custom websocket setting
// The current version of the C++ REST SDK 2.10.19 does not provide the callback to enable the custom websocket setting
inline std::function<void(web::websockets::client::native_handle)> make_ws_client_nativehandle_options(bool secure, const utility::string_t& client_address, slog::base_gate& gate)
{
if (client_address.empty()) return {};
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/mdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ namespace nmos
auto resolved_ver = std::find_first_of(resolved_vers.rbegin(), resolved_vers.rend(), api_ver.rbegin(), api_ver.rend());
if (resolved_vers.rend() == resolved_ver) return true;

// hmm, may be in the furture check for the matching 'api_selector' value
// hmm, maybe in the future check for the matching 'api_selector' value
auto resolved_selector = nmos::parse_api_selector_record(records);

auto resolved_uri = web::uri_builder();
Expand Down
12 changes: 6 additions & 6 deletions Development/nmos/sdp_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,11 @@ namespace nmos
// additional parameters introduced by SMPTE specs since then...
if (!params.range.empty()) fmtp.push_back({ sdp::fields::range, params.range.name });
if (0 != params.par) fmtp.push_back({ sdp::fields::pixel_aspect_ratio, nmos::details::make_pixel_aspect_ratio(params.par) });
if (0 != params.troff) fmtp.push_back({ sdp::fields::TROFF, utility::ostringstreamed(params.troff) });
if (params.troff) fmtp.push_back({ sdp::fields::TROFF, utility::ostringstreamed(*params.troff) });
if (0 != params.cmax) fmtp.push_back({ sdp::fields::CMAX, utility::ostringstreamed(params.cmax) });
if (0 != params.maxudp) fmtp.push_back({ sdp::fields::max_udp_packet_size, utility::ostringstreamed(params.maxudp) });
if (!params.tsmode.empty()) fmtp.push_back({ sdp::fields::timestamp_mode, params.tsmode.name });
if (0 != params.tsdelay) fmtp.push_back({ sdp::fields::timestamp_delay, utility::ostringstreamed(params.tsdelay) });
if (params.tsdelay) fmtp.push_back({ sdp::fields::timestamp_delay, utility::ostringstreamed(*params.tsdelay) });

return{ session_name, sdp::media_types::video, rtpmap, fmtp, {}, {}, {}, {}, media_stream_ids, ts_refclk };
}
Expand All @@ -814,7 +814,7 @@ namespace nmos
sdp_parameters::fmtp_t fmtp = {};
if (!params.channel_order.empty()) fmtp.push_back({ sdp::fields::channel_order, params.channel_order });
if (!params.tsmode.empty()) fmtp.push_back({ sdp::fields::timestamp_mode, params.tsmode.name });
if (0 != params.tsdelay) fmtp.push_back({ sdp::fields::timestamp_delay, utility::ostringstreamed(params.tsdelay) });
if (params.tsdelay) fmtp.push_back({ sdp::fields::timestamp_delay, utility::ostringstreamed(*params.tsdelay) });

return{ session_name, sdp::media_types::audio, rtpmap, fmtp, {}, params.packet_time, {}, {}, media_stream_ids, ts_refclk };
}
Expand All @@ -836,9 +836,9 @@ namespace nmos
if (0 != params.exactframerate) fmtp.push_back({ sdp::fields::exactframerate, nmos::details::make_exactframerate(params.exactframerate) });
if (!params.tm.empty()) fmtp.push_back({ sdp::fields::TM, params.tm.name });
if (!params.ssn.empty()) fmtp.push_back({ sdp::fields::smpte_standard_number, params.ssn.name });
if (0 != params.troff) fmtp.push_back({ sdp::fields::TROFF, utility::ostringstreamed(params.troff) });
if (params.troff) fmtp.push_back({ sdp::fields::TROFF, utility::ostringstreamed(*params.troff) });
if (!params.tsmode.empty()) fmtp.push_back({ sdp::fields::timestamp_mode, params.tsmode.name });
if (0 != params.tsdelay) fmtp.push_back({ sdp::fields::timestamp_delay, utility::ostringstreamed(params.tsdelay) });
if (params.tsdelay) fmtp.push_back({ sdp::fields::timestamp_delay, utility::ostringstreamed(*params.tsdelay) });

return{ session_name, sdp::media_types::video, rtpmap, fmtp, {}, {}, {}, {}, media_stream_ids, ts_refclk };
}
Expand All @@ -854,7 +854,7 @@ namespace nmos
// See https://tools.ietf.org/html/rfc4566#section-6
sdp_parameters::fmtp_t fmtp = {};
if (!params.tp.empty()) fmtp.push_back({ sdp::fields::type_parameter, params.tp.name });
if (0 != params.troff) fmtp.push_back({ sdp::fields::TROFF, utility::ostringstreamed(params.troff) });
if (params.troff) fmtp.push_back({ sdp::fields::TROFF, utility::ostringstreamed(*params.troff) });

return{ session_name, sdp::media_types::video, rtpmap, fmtp, {}, {}, {}, {}, media_stream_ids, ts_refclk };
}
Expand Down
24 changes: 12 additions & 12 deletions Development/nmos/sdp_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ namespace nmos

// additional fmtp parameters from ST 2110-21:2022
sdp::type_parameter tp;
uint32_t troff; // if omitted (zero), assume default
bst::optional<uint32_t> troff; // if omitted, assume default
uint32_t cmax; // if omitted (zero), assume max defined for tp

// additional fmtp parameters from ST 2110-10:2022
uint32_t maxudp; // if omitted (zero), assume the Standard UP Size Limit
sdp::timestamp_mode tsmode; // if omitted (empty), assume sdp::timestamp_modes::NEW
uint32_t tsdelay;
bst::optional<uint32_t> tsdelay;

video_raw_parameters() : depth(), width(), height(), interlace(), segmented(), troff(), cmax(), maxudp(), tsdelay() {}

Expand All @@ -341,11 +341,11 @@ namespace nmos
sdp::packing_mode pm,
sdp::smpte_standard_number ssn,
sdp::type_parameter tp,
uint32_t troff,
bst::optional<uint32_t> troff,
uint32_t cmax,
uint32_t maxudp,
sdp::timestamp_mode tsmode,
uint32_t tsdelay
bst::optional<uint32_t> tsdelay
)
: sampling(std::move(sampling))
, depth(depth)
Expand Down Expand Up @@ -393,7 +393,7 @@ namespace nmos

// additional fmtp parameters from ST 2110-10:2022
sdp::timestamp_mode tsmode; // if omitted (empty), assume sdp::timestamp_modes::NEW
uint32_t tsdelay;
bst::optional<uint32_t> tsdelay;

// ptime
double packet_time;
Expand All @@ -406,7 +406,7 @@ namespace nmos
uint64_t sample_rate,
utility::string_t channel_order,
sdp::timestamp_mode tsmode,
uint32_t tsdelay,
bst::optional<uint32_t> tsdelay,
double packet_time
)
: channel_count(channel_count)
Expand Down Expand Up @@ -442,11 +442,11 @@ namespace nmos
sdp::smpte_standard_number ssn;

// additional fmtp parameters from ST 2110-21:2022
uint32_t troff; // if omitted (zero), assume default
bst::optional<uint32_t> troff; // if omitted, assume default

// additional fmtp parameters from ST 2110-10:2022
sdp::timestamp_mode tsmode; // if omitted (empty), assume sdp::timestamp_modes::NEW
uint32_t tsdelay;
bst::optional<uint32_t> tsdelay;

video_smpte291_parameters() : vpid_code(), troff(), tsdelay() {}

Expand All @@ -456,9 +456,9 @@ namespace nmos
nmos::rational exactframerate,
sdp::transmission_model tm,
sdp::smpte_standard_number ssn,
uint32_t troff,
bst::optional<uint32_t> troff,
sdp::timestamp_mode tsmode,
uint32_t tsdelay
bst::optional<uint32_t> tsdelay
)
: did_sdids(std::move(did_sdids))
, vpid_code(vpid_code)
Expand All @@ -482,13 +482,13 @@ namespace nmos
{
// additional fmtp parameters from ST 2110-21:2017
sdp::type_parameter tp;
uint32_t troff; // if omitted (zero), assume default
bst::optional<uint32_t> troff; // if omitted, assume default

video_SMPTE2022_6_parameters() : troff() {}

video_SMPTE2022_6_parameters(
sdp::type_parameter tp,
uint32_t troff
bst::optional<uint32_t> troff
)
: tp(std::move(tp))
, troff(troff)
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace nmos
// pri [registry, node]: used for the 'pri' TXT record; specifying nmos::service_priorities::no_priority (maximum value) disables advertisement completely
const web::json::field_as_integer_or pri{ U("pri"), 100 }; // default to highest_development_priority

// highest_pri, lowest_pri [registry, node]: used to specify the (inclusive) range of suitable 'pri' values of discovered APIs, to avoid development and live systems colliding
// highest_pri, lowest_pri [node]: used to specify the (inclusive) range of suitable 'pri' values of discovered APIs, to avoid development and live systems colliding
const web::json::field_as_integer_or highest_pri{ U("highest_pri"), 0 }; // default to highest_active_priority; specifying no_priority disables discovery completely
const web::json::field_as_integer_or lowest_pri{ U("lowest_pri"), (std::numeric_limits<int>::max)() }; // default to no_priority

Expand Down
31 changes: 31 additions & 0 deletions Development/nmos/test/sdp_test_utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "nmos/test/sdp_test_utils.h"

#include "bst/test/test.h"
#include "nmos/sdp_utils.h"

namespace nmos
{
typedef std::multimap<utility::string_t, utility::string_t> comparable_fmtp_t;

inline comparable_fmtp_t comparable_fmtp(const nmos::sdp_parameters::fmtp_t& fmtp)
{
return comparable_fmtp_t{ fmtp.begin(), fmtp.end() };
}

void check_sdp_parameters(const nmos::sdp_parameters& lhs, const nmos::sdp_parameters& rhs)
{
BST_REQUIRE_EQUAL(lhs.session_name, rhs.session_name);
BST_REQUIRE_EQUAL(lhs.rtpmap.payload_type, rhs.rtpmap.payload_type);
BST_REQUIRE_EQUAL(lhs.rtpmap.encoding_name, rhs.rtpmap.encoding_name);
BST_REQUIRE_EQUAL(lhs.rtpmap.clock_rate, rhs.rtpmap.clock_rate);
if (0 != lhs.rtpmap.encoding_parameters)
BST_REQUIRE_EQUAL(lhs.rtpmap.encoding_parameters, rhs.rtpmap.encoding_parameters);
else
BST_REQUIRE((0 == rhs.rtpmap.encoding_parameters || 1 == rhs.rtpmap.encoding_parameters));
BST_REQUIRE_EQUAL(comparable_fmtp(lhs.fmtp), comparable_fmtp(rhs.fmtp));
BST_REQUIRE_EQUAL(lhs.packet_time, rhs.packet_time);
BST_REQUIRE_EQUAL(lhs.max_packet_time, rhs.max_packet_time);
BST_REQUIRE_EQUAL(lhs.bandwidth.bandwidth_type, rhs.bandwidth.bandwidth_type);
BST_REQUIRE_EQUAL(lhs.bandwidth.bandwidth, rhs.bandwidth.bandwidth);
}
}
11 changes: 11 additions & 0 deletions Development/nmos/test/sdp_test_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef NMOS_SDP_TEST_UTILS_H
#define NMOS_SDP_TEST_UTILS_H

namespace nmos
{
struct sdp_parameters;

void check_sdp_parameters(const nmos::sdp_parameters& lhs, const nmos::sdp_parameters& rhs);
}

#endif
Loading

0 comments on commit cb6aec7

Please sign in to comment.