webrtc_sdp_media (webrtc v0.1.0)
View SourceQueries and updates on parsed SDP for JSEP.
Attribute lookups take the key used in webrtc_sdp:attribute() (an atom for typed attributes, a binary for others). Functions taking both a media section and the session apply the session-level fallback rules: ice-ufrag, ice-pwd and ice-options (RFC 8839 §5.4, §5.6), fingerprint (RFC 8122 §5), setup (RFC 4145 §4) and direction (RFC 8866 §6.7).
[Audio | _] = webrtc_sdp_media:sections(Sdp),
{ok, #{ufrag := U, pwd := P}} = webrtc_sdp_media:ice_credentials(Audio, Sdp),
[#{name := <<"opus">>} | _] = webrtc_sdp_media:codecs(Audio).
Summary
Functions
Append an attribute.
First value of attribute Key at this level only.
All values of attribute Key at this level, in order.
Attributes describing Codecs: for each codec its rtpmap, its rtcp-fb lines, then its fmtp when it has parameters (the order used by libwebrtc).
Codecs of an RTP media section in m= line order, merging rtpmap, fmtp and rtcp-fb. Wildcard (*) feedback is copied into every codec. A payload type without rtpmap uses the RFC 3551 static assignment; one that has neither is skipped.
Media direction; defaults to sendrecv (RFC 8866 §6.7).
First value of Key in the media section, else at session level.
Values of Key in the media section if there is any, else the session-level values. Levels are not merged.
Fingerprints for a media section: the media-level ones if any, else the session-level ones (RFC 8122 §5).
Mid lists of the session-level groups with these semantics, for example groups(<<"BUNDLE">>, Sdp).
ICE credentials of a media section, each falling back to the session level (RFC 8839 §5.4).
True when the session declares a=ice-lite (session level only).
The Ta the session asks for (a=ice-pacing, session level, RFC 8839 §5.5), 50 ms when absent.
Payload types of the m= line, for RTP media.
Replace the first Key attribute (dropping the others), or append.
The media sections in order.
Replace the codecs of a media section: the m= line payload types and the rtpmap, fmtp and rtcp-fb attributes. The new codec attributes take the place of the first old one; other attributes keep their order.
a=setup role, media level first. JSEP (RFC 8842 §5.1) requires the attribute, so an absent one is reported rather than defaulted.
Types
-type codec() :: #{pt := 0..127, name := binary(), clock_rate := pos_integer(), channels := pos_integer() | undefined, fmtp := [webrtc_sdp_rtp:fmtp_param()], rtcp_fb := [#{type := binary(), param := binary() | undefined}]}.
-type container() :: #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]} | #sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}.
Functions
Append an attribute.
First value of attribute Key at this level only.
All values of attribute Key at this level, in order.
-spec candidates(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}) -> [#sdp_candidate{foundation :: binary(), component :: 1..256, transport :: binary(), priority :: 1..2147483647, address :: webrtc_sdp_lex:address(), port :: inet:port_number(), type :: host | srflx | prflx | relay | binary(), raddr :: webrtc_sdp_lex:address() | undefined, rport :: inet:port_number() | undefined, tcptype :: active | passive | so | undefined, extensions :: [{binary(), binary()}]}].
-spec codec_attributes([codec()]) -> [webrtc_sdp:attribute()].
Attributes describing Codecs: for each codec its rtpmap, its rtcp-fb lines, then its fmtp when it has parameters (the order used by libwebrtc).
-spec codecs(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}) -> [codec()].
Codecs of an RTP media section in m= line order, merging rtpmap, fmtp and rtcp-fb. Wildcard (*) feedback is copied into every codec. A payload type without rtpmap uses the RFC 3551 static assignment; one that has neither is skipped.
-spec direction(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> webrtc_sdp_rtp:direction().
Media direction; defaults to sendrecv (RFC 8866 §6.7).
-spec end_of_candidates(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}) -> boolean().
-spec find_attr(key(), #sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> {ok, term()} | error.
First value of Key in the media section, else at session level.
-spec find_attrs(key(), #sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> [term()].
Values of Key in the media section if there is any, else the session-level values. Levels are not merged.
-spec fingerprints(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> [webrtc_sdp_attr:fingerprint()].
Fingerprints for a media section: the media-level ones if any, else the session-level ones (RFC 8122 §5).
-spec groups(binary(), #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> [[binary()]].
Mid lists of the session-level groups with these semantics, for example groups(<<"BUNDLE">>, Sdp).
-spec ice_credentials(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> {ok, #{ufrag := binary(), pwd := binary()}} | {error, missing_ice_credentials}.
ICE credentials of a media section, each falling back to the session level (RFC 8839 §5.4).
-spec ice_lite(#sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> boolean().
True when the session declares a=ice-lite (session level only).
-spec ice_options(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> [binary()].
-spec ice_pacing(#sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> non_neg_integer().
The Ta the session asks for (a=ice-pacing, session level, RFC 8839 §5.5), 50 ms when absent.
-spec mid(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}) -> binary() | undefined.
-spec payload_types(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}) -> [0..127].
Payload types of the m= line, for RTP media.
Replace the first Key attribute (dropping the others), or append.
-spec sections(#sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}].
The media sections in order.
-spec set_codecs(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, [codec(), ...]) -> #sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}.
Replace the codecs of a media section: the m= line payload types and the rtpmap, fmtp and rtcp-fb attributes. The new codec attributes take the place of the first old one; other attributes keep their order.
-spec setup(#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}, #sdp{version :: non_neg_integer(), origin :: #sdp_origin{username :: binary(), sess_id :: non_neg_integer(), sess_version :: non_neg_integer(), nettype :: binary(), addrtype :: binary(), address :: binary()}, session_name :: binary(), information :: binary() | undefined, uri :: binary() | undefined, emails :: [binary()], phones :: [binary()], connection :: #sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()} | undefined, bandwidths :: [{binary(), non_neg_integer()}], times :: [#sdp_time{start :: non_neg_integer(), stop :: non_neg_integer(), repeats :: [[binary(), ...]], zones :: [{non_neg_integer(), binary()}]}, ...], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()], media :: [#sdp_media{media :: binary(), port :: inet:port_number(), port_count :: pos_integer() | undefined, proto :: binary(), fmts :: [binary()], information :: binary() | undefined, connections :: [#sdp_connection{nettype :: binary(), addrtype :: binary(), address :: binary()}], bandwidths :: [{binary(), non_neg_integer()}], key :: binary() | undefined, attributes :: [webrtc_sdp:attribute()]}]}) -> {ok, webrtc_sdp_attr:setup()} | error.
a=setup role, media level first. JSEP (RFC 8842 §5.1) requires the attribute, so an absent one is reported rather than defaulted.