webrtc: stats: Improve spec compliance for ICE candidate stats
We now fill the foundation, related-address, related-port, username-fragment and tcp-type fields. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8792>
This commit is contained in:
parent
d1f43f781a
commit
72433cb942
@ -190,6 +190,97 @@ and/or use gtk-doc annotations. -->
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_ADDRESS" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_ADDRESS" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_FOUNDATION" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_FOUNDATION" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_PORT" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_PORT" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_PRIORITY" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_PRIORITY" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_PROTOCOL" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_PROTOCOL" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_RELATED_ADDRESS" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_ADDRESS" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_RELATED_PORT" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_PORT" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_RELAY_PROTOCOL" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_RELAY_PROTOCOL" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_STREAM_ID" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_STREAM_ID" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_TYPE" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_TYPE" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_URL" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_URL" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CANDIDATE_STATS_USERNAME_FRAGMENT" c:identifier="GST_WEBRTC_ICE_CANDIDATE_STATS_USERNAME_FRAGMENT" version="1.28" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
<parameter name="c">
|
||||
</parameter>
|
||||
</parameters>
|
||||
</function-macro>
|
||||
<function-macro name="WEBRTC_ICE_CLASS" c:identifier="GST_WEBRTC_ICE_CLASS" introspectable="0">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<parameters>
|
||||
@ -1485,34 +1576,66 @@ stops automatic ICE gathering.</doc>
|
||||
<record name="WebRTCICECandidateStats" c:type="GstWebRTCICECandidateStats" version="1.22" glib:type-name="GstWebRTCICECandidateStats" glib:get-type="gst_webrtc_ice_candidate_stats_get_type" c:symbol-prefix="webrtc_ice_candidate_stats">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<field name="ipaddr" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">A string containing the address of the candidate. This value may be
|
||||
an IPv4 address, an IPv6 address, or a fully-qualified domain name</doc>
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</field>
|
||||
<field name="port" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">The network port number used by the candidate</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</field>
|
||||
<field name="stream_id" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">A string that uniquely identifies the object that is being
|
||||
monitored to produce this set of statistics</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</field>
|
||||
<field name="type" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">The candidate type</doc>
|
||||
<type name="utf8" c:type="const gchar*"/>
|
||||
</field>
|
||||
<field name="proto" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">A string specifying the protocol (tcp or udp) used to transmit data
|
||||
on the @port</doc>
|
||||
<type name="utf8" c:type="const gchar*"/>
|
||||
</field>
|
||||
<field name="relay_proto" writable="1">
|
||||
<type name="utf8" c:type="const gchar*"/>
|
||||
</field>
|
||||
<field name="prio" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">The candidate's priority, corresponding to RTCIceCandidate.priority</doc>
|
||||
<type name="guint" c:type="guint"/>
|
||||
</field>
|
||||
<field name="url" writable="1">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h">For local candidates, the url property is the URL of the ICE server
|
||||
from which the candidate was received</doc>
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</field>
|
||||
<field name="_gst_reserved" writable="1">
|
||||
<array zero-terminated="0" fixed-size="20">
|
||||
<type name="gpointer" c:type="gpointer"/>
|
||||
</array>
|
||||
</field>
|
||||
<union name="ABI" c:type="ABI">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<record name="abi" c:type="abi">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<field name="foundation" writable="1">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</field>
|
||||
<field name="related_address" writable="1">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</field>
|
||||
<field name="related_port" writable="1">
|
||||
<type name="guint" c:type="guint"/>
|
||||
</field>
|
||||
<field name="username_fragment" writable="1">
|
||||
<type name="utf8" c:type="gchar*"/>
|
||||
</field>
|
||||
<field name="tcp_type" writable="1">
|
||||
<type name="WebRTCICETcpCandidateType" c:type="GstWebRTCICETcpCandidateType"/>
|
||||
</field>
|
||||
</record>
|
||||
<field name="_gst_reserved" readable="0" private="1">
|
||||
<array zero-terminated="0" fixed-size="20">
|
||||
<type name="gpointer" c:type="gpointer"/>
|
||||
</array>
|
||||
</field>
|
||||
</union>
|
||||
<method name="copy" c:identifier="gst_webrtc_ice_candidate_stats_copy" version="1.22">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h"/>
|
||||
<return-value transfer-ownership="full">
|
||||
@ -2161,6 +2284,25 @@ Get HTTP Proxy to be used when connecting to TURN server.</doc>
|
||||
</callback>
|
||||
</field>
|
||||
</record>
|
||||
<enumeration name="WebRTCICETcpCandidateType" version="1.28" glib:type-name="GstWebRTCICETcpCandidateType" glib:get-type="gst_webrtc_ice_tcp_candidate_type_get_type" c:type="GstWebRTCICETcpCandidateType">
|
||||
<member name="active" value="0" c:identifier="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_ACTIVE" glib:nick="active" glib:name="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_ACTIVE">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">An "active" TCP candidate is one for which the transport
|
||||
will attempt to open an outbound connection but will not
|
||||
receive incoming connection requests.</doc>
|
||||
</member>
|
||||
<member name="passive" value="1" c:identifier="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_PASSIVE" glib:nick="passive" glib:name="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_PASSIVE">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">A "passive" TCP candidate is one for which the transport
|
||||
will receive incoming connection attempts but not attempt
|
||||
a connection.</doc>
|
||||
</member>
|
||||
<member name="so" value="2" c:identifier="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_SO" glib:nick="so" glib:name="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_SO">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">An "so" candidate is one for which the transport will attempt
|
||||
to open a connection simultaneously with its peer.</doc>
|
||||
</member>
|
||||
<member name="none" value="3" c:identifier="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE" glib:nick="none" glib:name="GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">Value used for non-TCP candidate type.</doc>
|
||||
</member>
|
||||
</enumeration>
|
||||
<class name="WebRTCICETransport" c:symbol-prefix="webrtc_ice_transport" c:type="GstWebRTCICETransport" parent="Gst.Object" abstract="1" glib:type-name="GstWebRTCICETransport" glib:get-type="gst_webrtc_ice_transport_get_type" glib:type-struct="WebRTCICETransportClass">
|
||||
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/icetransport.h"/>
|
||||
<virtual-method name="gather_candidates">
|
||||
|
@ -9256,6 +9256,11 @@ gst_webrtc_bin_class_init (GstWebRTCBinClass * klass)
|
||||
* "protocol" G_TYPE_STRING Either "udp" or "tcp". Based on the "transport" defined in RFC 5245
|
||||
* "relay-protocol" G_TYPE_STRING protocol used by the endpoint to communicate with the TURN server. Only present for local candidates. Either "udp", "tcp" or "tls"
|
||||
* "url" G_TYPE_STRING URL of the ICE server from which the candidate was obtained. Only present for local candidates
|
||||
* "foundation" G_TYPE_STRING ICE foundation as defined in RFC 5245 section 15.1 (Since: 1.28)
|
||||
* "related-address" G_TYPE_STRING ICE rel-addr as defined in RFC 5245 section 15.1. Only set for server-reflexive, peer-reflexive and relay candidates (Since: 1.28)
|
||||
* "related-port" G_TYPE_UINT ICE rel-port as defined in RFC 5245 section 15.1. Only set for serverreflexive, peer-reflexive and relay candidates (Since: 1.28)
|
||||
* "username-fragment" G_TYPE_STRING ICE username fragment as defined in RFC 5245 section 7.1.2.3 (Since: 1.28)
|
||||
* "tcp-type" G_TYPE_STRING ICE candidate TCP type as defined in RTCIceTcpCandidateType (Since: 1.28)
|
||||
*
|
||||
* RTCIceCandidatePairStats supported fields (https://www.w3.org/TR/webrtc-stats/#candidatepair-dict*) (Since: 1.22)
|
||||
*
|
||||
|
@ -615,6 +615,11 @@ _get_stats_from_ice_candidates (GstWebRTCBin * webrtc,
|
||||
long priority;
|
||||
DOMString url;
|
||||
DOMString relayProtocol;
|
||||
DOMString foundation;
|
||||
DOMString relatedAddress;
|
||||
long relatedPort;
|
||||
DOMString usernameFragment;
|
||||
RTCIceTcpCandidateType tcpType;
|
||||
*/
|
||||
|
||||
if (transport_id)
|
||||
@ -630,6 +635,21 @@ _get_stats_from_ice_candidates (GstWebRTCBin * webrtc,
|
||||
NULL);
|
||||
if (can->url)
|
||||
gst_structure_set (stats, "url", G_TYPE_STRING, can->url, NULL);
|
||||
if (can->ABI.abi.foundation)
|
||||
gst_structure_set (stats, "foundation", G_TYPE_STRING,
|
||||
can->ABI.abi.foundation, NULL);
|
||||
if (can->ABI.abi.related_address)
|
||||
gst_structure_set (stats, "related-address", G_TYPE_STRING,
|
||||
can->ABI.abi.related_address, NULL);
|
||||
if (can->ABI.abi.related_port)
|
||||
gst_structure_set (stats, "related-port", G_TYPE_UINT,
|
||||
can->ABI.abi.related_port, NULL);
|
||||
if (can->ABI.abi.username_fragment)
|
||||
gst_structure_set (stats, "username-fragment", G_TYPE_STRING,
|
||||
can->ABI.abi.username_fragment, NULL);
|
||||
if (can->ABI.abi.tcp_type != GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE)
|
||||
gst_structure_set (stats, "tcp-type",
|
||||
GST_TYPE_WEBRTC_ICE_TCP_CANDIDATE_TYPE, can->ABI.abi.tcp_type, NULL);
|
||||
|
||||
gst_structure_set (s, id, GST_TYPE_STRUCTURE, stats, NULL);
|
||||
gst_structure_free (stats);
|
||||
|
@ -341,6 +341,9 @@ gst_webrtc_ice_candidate_stats_free (GstWebRTCICECandidateStats * stats)
|
||||
if (stats) {
|
||||
g_free (stats->ipaddr);
|
||||
g_free (stats->url);
|
||||
g_free (stats->ABI.abi.foundation);
|
||||
g_free (stats->ABI.abi.related_address);
|
||||
g_free (stats->ABI.abi.username_fragment);
|
||||
}
|
||||
|
||||
g_free (stats);
|
||||
@ -364,6 +367,9 @@ gst_webrtc_ice_candidate_stats_copy (GstWebRTCICECandidateStats * stats)
|
||||
|
||||
copy->ipaddr = g_strdup (stats->ipaddr);
|
||||
copy->url = g_strdup (stats->url);
|
||||
copy->ABI.abi.foundation = g_strdup (stats->ABI.abi.foundation);
|
||||
copy->ABI.abi.related_address = g_strdup (stats->ABI.abi.related_address);
|
||||
copy->ABI.abi.username_fragment = g_strdup (stats->ABI.abi.username_fragment);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
@ -47,6 +47,31 @@ struct _GstWebRTCICE
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstWebRTCICECandidateStats:
|
||||
* @ipaddr: A string containing the address of the candidate. This value may be
|
||||
* an IPv4 address, an IPv6 address, or a fully-qualified domain name
|
||||
* @port: The network port number used by the candidate
|
||||
* @stream_id: A string that uniquely identifies the object that is being
|
||||
* monitored to produce this set of statistics
|
||||
* @type: The candidate type
|
||||
* @proto: A string specifying the protocol (tcp or udp) used to transmit data
|
||||
* on the @port
|
||||
* @replay_proto: A string identifying the protocol used by the endpoint for
|
||||
* communicating with the TURN server; valid values are tcp, udp, and tls
|
||||
* @prio: The candidate's priority, corresponding to RTCIceCandidate.priority
|
||||
* @url: For local candidates, the url property is the URL of the ICE server
|
||||
* from which the candidate was received
|
||||
* @foundation: The ICE foundation as defined in RFC5245 section 15.1 (Since: 1.28)
|
||||
* @related_address: The ICE rel-addr defined in RFC5245 section 15.1 Only
|
||||
* set for serverreflexive, peerreflexive and relay candidates. (Since: 1.28)
|
||||
* @related_port: The ICE rel-addr defined in RFC5245 section 15.1. Only set
|
||||
* for serverreflexive, peerreflexive and relay candidates. (Since: 1.28)
|
||||
* @username_fragment: The ICE username fragment as defined in RFC5245 section 7.1.2.3 (Since: 1.28)
|
||||
* @tcp_type: The ICE candidate TCP type, (Since: 1.28)
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
struct _GstWebRTCICECandidateStats
|
||||
{
|
||||
gchar *ipaddr;
|
||||
@ -58,9 +83,155 @@ struct _GstWebRTCICECandidateStats
|
||||
guint prio;
|
||||
gchar *url;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING_LARGE];
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI: (attributes doc.skip=true)
|
||||
*
|
||||
* ABI compatibility union
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
union {
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI.abi: (attributes doc.skip=true)
|
||||
*
|
||||
* ABI compatibility struct
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
struct {
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI.abi.foundation:
|
||||
*
|
||||
* The foundation of the ICE candidate.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
gchar *foundation;
|
||||
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI.abi.related_address:
|
||||
*
|
||||
* The related address (STUN or TURN server) of the candidate. Will be
|
||||
* NULL for host candidates.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
gchar *related_address;
|
||||
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI.abi.related_port:
|
||||
*
|
||||
* The related port (STUN or TURN server) of the candidate. Will be
|
||||
* 0 for host candidates.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
guint related_port;
|
||||
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI.abi.username_fragment:
|
||||
*
|
||||
* The ICE username for this candidate.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
gchar *username_fragment;
|
||||
|
||||
/**
|
||||
* GstWebRTCICECandidateStats.ABI.abi.tcp_type:
|
||||
*
|
||||
* The type of TCP candidate. Will be NULL if the candidate is not a TCP
|
||||
* candidate.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
GstWebRTCICETcpCandidateType tcp_type;
|
||||
} abi;
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING_LARGE];
|
||||
} ABI;
|
||||
};
|
||||
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_ADDRESS:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_ADDRESS(c) ((c)->ipaddr)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_PORT:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_PORT(c) ((c)->port)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_STREAM_ID:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_STREAM_ID(c) ((c)->stream_id)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_TYPE:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_TYPE(c) ((c)->type)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_PROTOCOL:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_PROTOCOL(c) ((c)->proto)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_RELAY_PROTOCOL:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_RELAY_PROTOCOL(c) ((c)->relay_proto)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_PRIORITY:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_PRIORITY(c) ((c)->prio)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_URL:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_URL(c) ((c)->url)
|
||||
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_FOUNDATION:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_FOUNDATION(c) ((c)->ABI.abi.foundation)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_ADDRESS:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_ADDRESS(c) ((c)->ABI.abi.related_address)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_PORT:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_PORT(c) ((c)->ABI.abi.related_port)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_USERNAME_FRAGMENT:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_USERNAME_FRAGMENT(c) ((c)->ABI.abi.username_fragment)
|
||||
/**
|
||||
* GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE:
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
#define GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE(c) ((c)->ABI.abi.tcp_type)
|
||||
|
||||
/**
|
||||
* GstWebRTCICEOnCandidateFunc:
|
||||
* @ice: The #GstWebRTCICE
|
||||
|
@ -551,6 +551,31 @@ gst_webrtc_nice_add_stream (GstWebRTCICE * ice, guint session_id)
|
||||
return item->stream;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_candidate_credentials (NiceAgent * agent, NiceCandidate * candidate)
|
||||
{
|
||||
|
||||
if (!candidate->username || !candidate->password) {
|
||||
gboolean got_credentials;
|
||||
gchar *ufrag, *password;
|
||||
|
||||
got_credentials =
|
||||
nice_agent_get_local_credentials (agent, candidate->stream_id, &ufrag,
|
||||
&password);
|
||||
g_warn_if_fail (got_credentials);
|
||||
|
||||
if (!candidate->username)
|
||||
candidate->username = ufrag;
|
||||
else
|
||||
g_free (ufrag);
|
||||
|
||||
if (!candidate->password)
|
||||
candidate->password = password;
|
||||
else
|
||||
g_free (password);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_on_new_candidate (NiceAgent * agent, NiceCandidate * candidate,
|
||||
GstWebRTCNice * ice)
|
||||
@ -565,24 +590,7 @@ _on_new_candidate (NiceAgent * agent, NiceCandidate * candidate,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!candidate->username || !candidate->password) {
|
||||
gboolean got_credentials;
|
||||
gchar *ufrag, *password;
|
||||
|
||||
got_credentials = nice_agent_get_local_credentials (ice->priv->nice_agent,
|
||||
candidate->stream_id, &ufrag, &password);
|
||||
g_warn_if_fail (got_credentials);
|
||||
|
||||
if (!candidate->username)
|
||||
candidate->username = ufrag;
|
||||
else
|
||||
g_free (ufrag);
|
||||
|
||||
if (!candidate->password)
|
||||
candidate->password = password;
|
||||
else
|
||||
g_free (password);
|
||||
}
|
||||
_fill_candidate_credentials (agent, candidate);
|
||||
|
||||
attr = nice_agent_generate_local_candidate_sdp (agent, candidate);
|
||||
|
||||
@ -1084,19 +1092,56 @@ _populate_candidate_stats (GstWebRTCNice * ice, NiceCandidate * cand,
|
||||
g_assert (cand != NULL);
|
||||
|
||||
nice_address_to_string (&cand->addr, ipaddr);
|
||||
stats->port = nice_address_get_port (&cand->addr);
|
||||
stats->ipaddr = g_strdup (ipaddr);
|
||||
stats->stream_id = stream->stream_id;
|
||||
stats->type = nice_candidate_type_to_string (cand->type);
|
||||
stats->prio = cand->priority;
|
||||
stats->proto =
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_PORT (stats) =
|
||||
nice_address_get_port (&cand->addr);
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_ADDRESS (stats) = g_strdup (ipaddr);
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_STREAM_ID (stats) = stream->stream_id;
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_TYPE (stats) =
|
||||
nice_candidate_type_to_string (cand->type);
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_PRIORITY (stats) = cand->priority;
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_PROTOCOL (stats) =
|
||||
cand->transport == NICE_CANDIDATE_TRANSPORT_UDP ? "udp" : "tcp";
|
||||
if (is_local) {
|
||||
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED)
|
||||
stats->relay_proto =
|
||||
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED) {
|
||||
NiceAddress relay_address;
|
||||
nice_candidate_relay_address (cand, &relay_address);
|
||||
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_ADDRESS (stats) =
|
||||
nice_address_dup_string (&relay_address);
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_RELATED_PORT (stats) =
|
||||
nice_address_get_port (&relay_address);
|
||||
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_RELAY_PROTOCOL (stats) =
|
||||
gst_webrtc_nice_get_candidate_relay_protocol (ice->priv->turn_server);
|
||||
stats->url = gst_webrtc_nice_get_candidate_server_url (ice, cand);
|
||||
}
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_URL (stats) =
|
||||
gst_webrtc_nice_get_candidate_server_url (ice, cand);
|
||||
}
|
||||
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_FOUNDATION (stats) =
|
||||
g_strdup (cand->foundation);
|
||||
|
||||
switch (cand->transport) {
|
||||
case NICE_CANDIDATE_TRANSPORT_UDP:
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE (stats) =
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE;
|
||||
break;
|
||||
case NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE:
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE (stats) =
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_ACTIVE;
|
||||
break;
|
||||
case NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE:
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE (stats) =
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_PASSIVE;
|
||||
break;
|
||||
case NICE_CANDIDATE_TRANSPORT_TCP_SO:
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_TCP_TYPE (stats) =
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_SO;
|
||||
break;
|
||||
};
|
||||
|
||||
GST_WEBRTC_ICE_CANDIDATE_STATS_USERNAME_FRAGMENT (stats) =
|
||||
g_strdup (cand->username);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1167,6 +1212,9 @@ gst_webrtc_nice_get_selected_pair (GstWebRTCICE * ice,
|
||||
if (stream) {
|
||||
if (nice_agent_get_selected_pair (nice->priv->nice_agent, stream->stream_id,
|
||||
NICE_COMPONENT_TYPE_RTP, &local_cand, &remote_cand)) {
|
||||
_fill_candidate_credentials (nice->priv->nice_agent, local_cand);
|
||||
_fill_candidate_credentials (nice->priv->nice_agent, remote_cand);
|
||||
|
||||
*local_stats = g_new0 (GstWebRTCICECandidateStats, 1);
|
||||
_populate_candidate_stats (nice, local_cand, stream, *local_stats, TRUE);
|
||||
|
||||
|
@ -70,13 +70,30 @@ typedef struct _GstWebRTCDTLSTransportClass GstWebRTCDTLSTransportClass;
|
||||
typedef struct _GstWebRTCICE GstWebRTCICE;
|
||||
typedef struct _GstWebRTCICEClass GstWebRTCICEClass;
|
||||
|
||||
/**
|
||||
* GstWebRTCICECandidateStats:
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
typedef struct _GstWebRTCICECandidateStats GstWebRTCICECandidateStats;
|
||||
|
||||
/**
|
||||
* GstWebRTCICETcpCandidateType:
|
||||
* @GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_ACTIVE: An "active" TCP candidate is one for which the transport
|
||||
* will attempt to open an outbound connection but will not
|
||||
* receive incoming connection requests.
|
||||
* @GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_PASSIVE: A "passive" TCP candidate is one for which the transport
|
||||
* will receive incoming connection attempts but not attempt
|
||||
* a connection.
|
||||
* @GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_SO: An "so" candidate is one for which the transport will attempt
|
||||
* to open a connection simultaneously with its peer.
|
||||
* @GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE: Value used for non-TCP candidate type.
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
typedef enum /*< underscore_name=gst_webrtc_ice_tcp_candidate_type >*/
|
||||
{
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_ACTIVE,
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_PASSIVE,
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_SO,
|
||||
GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE,
|
||||
} GstWebRTCICETcpCandidateType;
|
||||
|
||||
/**
|
||||
* GstWebRTCICEStream:
|
||||
*
|
||||
|
@ -1748,6 +1748,7 @@ validate_candidate_stats (const GstStructure * s, const GstStructure * stats)
|
||||
guint port;
|
||||
guint64 priority;
|
||||
gchar *address, *candidateType, *protocol;
|
||||
gchar *foundation, *username_fragment;
|
||||
|
||||
fail_unless (gst_structure_get (s, "address", G_TYPE_STRING, &address, NULL));
|
||||
fail_unless (gst_structure_get (s, "port", G_TYPE_UINT, &port, NULL));
|
||||
@ -1759,9 +1760,37 @@ validate_candidate_stats (const GstStructure * s, const GstStructure * stats)
|
||||
|
||||
fail_unless (strcmp (protocol, "udp") || strcmp (protocol, "tcp"));
|
||||
|
||||
fail_unless (gst_structure_get (s, "foundation", G_TYPE_STRING, &foundation,
|
||||
NULL));
|
||||
fail_unless (gst_structure_get (s, "username-fragment", G_TYPE_STRING,
|
||||
&username_fragment, NULL));
|
||||
|
||||
if (strcmp (candidateType, "host")) {
|
||||
guint related_port;
|
||||
gchar *related_address;
|
||||
fail_unless (gst_structure_get (s, "related-address", G_TYPE_STRING,
|
||||
&related_address, NULL));
|
||||
fail_unless (gst_structure_get (s, "related-port", G_TYPE_UINT,
|
||||
&related_port, NULL));
|
||||
g_free (related_address);
|
||||
} else {
|
||||
fail_if (gst_structure_has_field (s, "related-address"));
|
||||
fail_if (gst_structure_has_field (s, "related-port"));
|
||||
}
|
||||
|
||||
if (!strcmp (protocol, "tcp")) {
|
||||
GstWebRTCICETcpCandidateType tcp_type;
|
||||
fail_unless (gst_structure_get (s, "tcp-type",
|
||||
GST_TYPE_WEBRTC_ICE_TCP_CANDIDATE_TYPE, &tcp_type, NULL));
|
||||
fail_if (tcp_type == GST_WEBRTC_ICE_TCP_CANDIDATE_TYPE_NONE);
|
||||
} else {
|
||||
fail_if (gst_structure_has_field (s, "tcp-type"));
|
||||
}
|
||||
g_free (address);
|
||||
g_free (candidateType);
|
||||
g_free (protocol);
|
||||
g_free (foundation);
|
||||
g_free (username_fragment);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user