Refactor (and a few breaking interface changes) of sdp_utils#225
Merged
Conversation
… apart format-agnostic SDP creation, parsing and validation from format-specific functionality
…p_parameters, not members of a media_t member
Contributor
Author
Next steps
|
…d add make_sdp_parameters overloads for clear extensibility
Contributor
Author
|
@aholzinger, after our discussions around #202, you may be interested in this also. |
Contributor
Author
|
@peterbrightwell, @David-P-B, @pedro-alves-ferreira, you may also be interested in this. |
…additional make_<media type/sub-type>_sdp_parameters functions for application-specific media types
… for new media types
…claration to header
…r shorter line lengths
Closed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactor (and a few breaking interface changes) of nmos/sdp_utils.{cpp,h} to tease apart format-agnostic SDP creation, parsing and validation from format-specific functionality.
This is intended to simplify future addition of support for
video/jxsvand other media types mentioned in #213, whether within nmos-cpp or in application code for specific use cases.Details
sdp_parametersis now format-agnostic.It no longer includes any format (media type/subtype) specific fields, like
video.width.Instead, the format-specific parameters for the
a=fmtp:line are serialized to a vector of pairs of string in this object. (It can't be a map because some keys may appear multiple times, likeDID_SDID.)Other common (RFC4566-defined) attributes that are likely to be used, like
a=ptime:,a=maxptime:anda=framerate:are added to the format-agnostic struct, as is direct support for one bandwidthb=line.fmtp,rtpmapand other member variables.E.g. audio sample rate and channel count from the
m=line, packet time froma=ptime:, and in the future, JPEG XS bit rate from theb=line.These are
make_<media type/subtype>_sdp_parametersbutget_<media type/subtype>_parametersrather thanparse_because there are other members ofsdp_parameterswhich are not reflected into the<media type/subtype>_parametersobjects.Breaking interface changes
sdp_parametersthat tooksdp_parameters::video_t,audio_t, etc. are deprecated (so not a breaking change, yet!).Equivalent constructors for new media types should not be added in the future. The free function approach should be adopted. See below...
sdp.video,sdp.audio, etc. application code must now useget_video_raw_parameters(sdp),get_audio_L_parameters(sdp), etc.sdp_parameters::audio_t::sample_rateis now auint64_trather than annmos::rationalto correspond more closely with the SDP spec and roundtrip betterAdding a new media type
<media type/subtype>_parameterswith members for the necessary format parameters.You may not want to include everything mentioned in the IANA registration, but that's a good place to start.
See e.g.
video_raw_parameters.make_<media type/subtype>_parameterswhich constructs the struct from info in the IS-04 resources and possibly commonly required additional info not carried in IS-04 resources (e.g. packet time for audio).See e.g.
make_video_raw_parameters.make_<media type/subtype>_sdp_parameterswhich constructs the format-agnosticsdp_parametersfrom the struct (and the non-transport, non-format-specific, parameters such as the SDP session name).This function can usually be very simple, for example building the rtpmap and fmtp from the
<media type/subtype>_parameters.Also add an equivalent overload of
make_sdp_parameters; should be a one-liner.See e.g.
make_video_raw_sdp_parameters.get_<media type/subtype>_parameterswhich constructs the struct fromsdp_parameters.This function can usually be very simple, for example extracting the values for the
<media type/subtype>_parametersfrom the rtpmap and fmtp.See e.g.
get_video_raw_parameters.Within the nmos-cpp library this would be done by updating the
nmos::make_sdp_parametersoverload to use the newmake_<media type/subtype>_sdp_parametersfunction.This nmos-cpp library function obviously couldn't be updated by application code, but since this function is only called from application code, such applications would use their own function for the application-specific media types instead.
Within the nmos-cpp library, this would be done by updating
nmos::validate_sdp_parameters.This nmos-cpp library function couldn't be updated by application code. It is called by a library function,
nmos::parse_rtp_transport_file, but since that function isn't used if the application provides annmos::transport_file_parser. An application can usenmos::details::parse_rtp_transport_filewhich now provides a way for application code to easily plug in the application-specific SDP parameters validation.