forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Added only video h265 with new imp #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
diegonunes4
wants to merge
21
commits into
garethsb:master
Choose a base branch
from
diegonunes4:only-video-h265
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+248
−0
Open
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
43ccbba
Added h265 implementation on different files
4da6ec1
Added make_video_h265_parameters
26349e4
Fixed typo
1bae471
Update Development/nmos/video_h265.h
diegonunes4 3872f0c
Update Development/nmos/video_h265.h
diegonunes4 a0f85e2
Update Development/nmos/video_h265.cpp
diegonunes4 0bd4f51
Removed unused parameters on IS-04
206e764
Spacing
03f9546
Merge branch 'only-video-h265' of https://github.com/diegonunes4/nmos…
1a29bc4
Capitalized name and rafactored
4d9c5d2
Changed links and refactored
849e245
Removed unused parameters
c2ff020
Added new parameters
88ae86a
Added new parameters, now parsing interop-constraints and validating …
54c3f61
Fixed spacing
6472d62
Merge branch 'master' into only-video-h265
garethsb 02ae35e
Revert changes in sdp_utils.cpp that aren't needed
garethsb c62582e
Revert changes in sdp_utils.h that aren't needed
garethsb be75d89
Add nmos/video_h265.{cpp,h} to nmos-cpp library
garethsb 3998ddd
Tweak links
garethsb f4eba16
Fix up validate_video_H265_sdp_parameters
garethsb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| #include "nmos/video_h265.h" | ||
| #include "json_fields.h" | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
|
|
||
| namespace nmos | ||
| { | ||
|
|
||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
|
|
||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| // Construct additional "video/H265" parameters from the IS-04 resources | ||
| video_h265_parameters make_video_h265_parameters(const web::json::value& node, const web::json::value& source, const web::json::value& flow, const web::json::value& sender, const utility::string_t& sprop_parameter_sets) | ||
| { | ||
| video_h265_parameters params; | ||
|
|
||
| params.profile_id = nmos::fields::profile_id(flow); | ||
|
|
||
| params.level_id = nmos::fields::level_id(flow); | ||
|
|
||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| params.interop_constraints = nmos::fields::interop_constraints(flow); | ||
|
|
||
| return params; | ||
| } | ||
|
|
||
| // Construct SDP parameters for "video/H265", with sensible defaults for unspecified fields | ||
| sdp_parameters make_video_H265_sdp_parameters(const utility::string_t& session_name, const video_h265_parameters& params, uint64_t payload_type, const std::vector<utility::string_t>& media_stream_ids, const std::vector<sdp_parameters::ts_refclk_t>& ts_refclk) | ||
| { | ||
| // a=rtpmap:<payload type> <encoding name>/<clock rate>[/<encoding parameters>] | ||
| sdp_parameters::rtpmap_t rtpmap = { payload_type, U("H265"), 90000 }; | ||
|
|
||
|
|
||
|
|
||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| // a=fmtp:<format> <format specific parameters> | ||
| // for simplicity, following the order of parameters given in VSF TR-05:2017 | ||
| // See https://tools.ietf.org/html/rfc4566#section-6 | ||
| sdp_parameters::fmtp_t fmtp = { | ||
| { sdp::fields::profile_id, utility::ostringstreamed(params.profile_id) }, | ||
| { sdp::fields::level_id, utility::ostringstreamed(params.level_id) }, | ||
| { sdp::fields::interop_constraints, utility::ostringstreamed(params.interop_constraints) }, | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| { sdp::fields::sprop_vps, params.sprop_vps }, | ||
| { sdp::fields::sprop_sps, params.sprop_sps }, | ||
| { sdp::fields::sprop_pps, params.sprop_pps } | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| }; | ||
|
|
||
| return{ session_name, sdp::media_types::video, rtpmap, fmtp, {}, {}, {}, {}, media_stream_ids, ts_refclk }; | ||
| } | ||
|
|
||
|
|
||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| namespace details | ||
| { | ||
| // ought to be declared in nmos/sdp_utils.h | ||
| std::runtime_error sdp_processing_error(const std::string& message); | ||
|
|
||
| // ought to be declared in nmos/sdp_utils.h (definition currently has internal linkage) | ||
| sdp_parameters::fmtp_t::const_iterator find_fmtp(const sdp_parameters::fmtp_t& fmtp, const utility::string_t& param_name) | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| { | ||
| return std::find_if(fmtp.begin(), fmtp.end(), [&](const sdp_parameters::fmtp_t::value_type& param) | ||
| { | ||
| return param.first == param_name; | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| // Get additional "video/h265" parameters from the SDP parameters | ||
| video_h265_parameters get_video_h265_parameters(const sdp_parameters& sdp_params) | ||
| { | ||
| video_h265_parameters params; | ||
|
|
||
| if (sdp_params.fmtp.empty()) throw details::sdp_processing_error("missing attribute: fmtp"); | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
|
|
||
| // optional | ||
| const auto profile_id = details::find_fmtp(sdp_params.fmtp, sdp::fields::profile_id); | ||
| if(sdp_params.fmtp.end() != profile_id ) throw details::sdp_processing_error("missing format parameter: profile-id"); | ||
| params.profile_id = utility::istringstreamed<uint32_t>( profile_id->second ); | ||
|
diegonunes4 marked this conversation as resolved.
|
||
|
|
||
| // optional | ||
| const auto level_id = details::find_fmtp(sdp_params.fmtp, sdp::fields::level_id); | ||
| if (sdp_params.fmtp.end() == level_id) throw details::sdp_processing_error("missing format parameter: level_id"); | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| params.level_id = utility::istringstreamed<uint32_t>( level_id->second ); | ||
|
|
||
| //optional | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| const auto interop_constraints = details::find_fmtp(sdp_params.fmtp, sdp::fields::interop_constraints); | ||
| if (sdp_params.fmtp.end() == interop_constraints) throw details::sdp_processing_error("missing format parameter: interop_constraints"); | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
| params.interop_constraints = utility::istringstreamed<uint32_t>( interop_constraints->second ); | ||
|
|
||
| //optional | ||
| const auto sprop_vps = details::find_fmtp(sdp_params.fmtp, sdp::fields::sprop_vps); | ||
| if (sdp_params.fmtp.end() == sprop_vps) throw details::sdp_processing_error("missing format parameter: sprop_vps"); | ||
| params.sprop_vps = sprop_vps->second; | ||
|
|
||
| //optional | ||
| const auto sprop_sps = details::find_fmtp(sdp_params.fmtp, sdp::fields::sprop_sps); | ||
| if (sdp_params.fmtp.end() == sprop_sps) throw details::sdp_processing_error("missing format parameter: sprop_sps"); | ||
| params.sprop_sps = sprop_sps->second; | ||
|
|
||
| //optional | ||
| const auto sprop_pps = details::find_fmtp(sdp_params.fmtp, sdp::fields::sprop_pps); | ||
| if (sdp_params.fmtp.end() == sprop_pps) throw details::sdp_processing_error("missing format parameter: sprop_pps"); | ||
| params.sprop_pps = sprop_pps->second; | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
|
|
||
| return params; | ||
| } | ||
| } | ||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||||||
| #ifndef NMOS_VIDEO_H265_H | ||||||||||
| #define NMOS_VIDEO_H265_H | ||||||||||
|
|
||||||||||
| #include "nmos/media_type.h" | ||||||||||
| #include "nmos/sdp_utils.h" | ||||||||||
|
|
||||||||||
| namespace sdp | ||||||||||
| { | ||||||||||
| namespace fields | ||||||||||
| { | ||||||||||
| // See https://datatracker.ietf.org/doc/html/rfc7798#page-64 | ||||||||||
| //H265 payload mapping | ||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| const web::json::field<uint32_t> profile_id{U("profile-id")}; | ||||||||||
| const web::json::field<uint32_t> level_id{U("level-id")}; | ||||||||||
| const web::json::field<uint32_t> interop_constraints{U("interop-constraints")}; | ||||||||||
| const web::json::field_as_string sprop_vps{U("sprop-vps")}; | ||||||||||
| const web::json::field_as_string sprop_sps{U("sprop-sps")}; | ||||||||||
| const web::json::field_as_string sprop_pps{U("sprop-pps")}; | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| namespace nmos | ||||||||||
| { | ||||||||||
| namespace media_types | ||||||||||
| { | ||||||||||
| // H.265 Video | ||||||||||
| // See https://datatracker.ietf.org/doc/html/rfc7798 | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| const media_type video_H265{ U("video/H265") }; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
|
garethsb marked this conversation as resolved.
|
||||||||||
| // Additional "video/H265" parameters | ||||||||||
| // See https://datatracker.ietf.org/doc/html/rfc7798#section-4.4 | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| struct video_h265_parameters | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| { | ||||||||||
| // fmtp indicates format | ||||||||||
| uint32_t profile_id; | ||||||||||
| uint32_t level_id; | ||||||||||
| uint32_t interop_constraints; | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| utility::string_t sprop_vps; | ||||||||||
| utility::string_t sprop_sps; | ||||||||||
| utility::string_t sprop_pps; | ||||||||||
|
|
||||||||||
| video_h265_parameters() : profile_id(), level_id(), interop_constraints(), sprop_vps(), sprop_sps(), sprop_pps() {} | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
|
|
||||||||||
| video_h265_parameters(uint32_t profile_id, uint32_t level_id, uint32_t interop_constraints, utility::string_t sprop_vps, | ||||||||||
| utility::string_t sprop_sps, utility::string_t sprop_pps) | ||||||||||
| : profile_id(profile_id), level_id(level_id), interop_constraints(interop_constraints), sprop_vps(sprop_vps), | ||||||||||
| sprop_sps(sprop_sps), sprop_pps(sprop_pps) {} | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| }; | ||||||||||
|
|
||||||||||
|
|
||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
| // Construct additional "video/H265" parameters from the IS-04 resources | ||||||||||
| video_h265_parameters make_video_H265_parameters(const web::json::value& node, const web::json::value& source, const web::json::value& flow, const web::json::value& sender, const utility::string_t& sprop_parameter_sets); | ||||||||||
| // Construct SDP parameters for "video/H265" | ||||||||||
| sdp_parameters make_video_h265_sdp_parameters(const utility::string_t& session_name, const video_h265_parameters& params, uint64_t payload_type, const std::vector<utility::string_t>& media_stream_ids = {}, const std::vector<sdp_parameters::ts_refclk_t>& ts_refclk = {}); | ||||||||||
| // Get additional "video/H265" parameters from the SDP parameters | ||||||||||
| video_h265_parameters get_video_H265_parameters(const sdp_parameters& sdp_params); | ||||||||||
|
|
||||||||||
| // Construct SDP parameters for "video/H265" | ||||||||||
| inline sdp_parameters make_sdp_parameters(const utility::string_t& session_name, const video_h265_parameters& params, uint64_t payload_type, const std::vector<utility::string_t>& media_stream_ids = {}, const std::vector<sdp_parameters::ts_refclk_t>& ts_refclk = {}) | ||||||||||
| { | ||||||||||
| return make_video_h265_sdp_parameters(session_name, params, payload_type, media_stream_ids, ts_refclk); | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
diegonunes4 marked this conversation as resolved.
|
||||||||||
|
|
||||||||||
| #endif | ||||||||||
|
diegonunes4 marked this conversation as resolved.
Outdated
|
||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.