webrtc: stats: Set DTLS role and state on transport stats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9485>
This commit is contained in:
parent
829de89122
commit
9e38ee7526
@ -437,6 +437,17 @@ for more information.</doc>
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">max-bundle</doc>
|
||||
</member>
|
||||
</enumeration>
|
||||
<enumeration name="WebRTCDTLSRole" version="1.28" glib:type-name="GstWebRTCDTLSRole" glib:get-type="gst_webrtc_dtls_role_get_type" c:type="GstWebRTCDTLSRole">
|
||||
<member name="client" value="0" c:identifier="GST_WEBRTC_DTLS_ROLE_CLIENT" glib:nick="client" glib:name="GST_WEBRTC_DTLS_ROLE_CLIENT">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">client</doc>
|
||||
</member>
|
||||
<member name="server" value="1" c:identifier="GST_WEBRTC_DTLS_ROLE_SERVER" glib:nick="server" glib:name="GST_WEBRTC_DTLS_ROLE_SERVER">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">server</doc>
|
||||
</member>
|
||||
<member name="unknown" value="2" c:identifier="GST_WEBRTC_DTLS_ROLE_UNKNOWN" glib:nick="unknown" glib:name="GST_WEBRTC_DTLS_ROLE_UNKNOWN">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">unknown</doc>
|
||||
</member>
|
||||
</enumeration>
|
||||
<enumeration name="WebRTCDTLSSetup" glib:type-name="GstWebRTCDTLSSetup" glib:get-type="gst_webrtc_dtls_setup_get_type" c:type="GstWebRTCDTLSSetup">
|
||||
<member name="none" value="0" c:identifier="GST_WEBRTC_DTLS_SETUP_NONE" glib:nick="none" glib:name="GST_WEBRTC_DTLS_SETUP_NONE">
|
||||
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/webrtc/webrtc_fwd.h">none</doc>
|
||||
|
@ -763,6 +763,7 @@ _get_stats_from_dtls_transport (GstWebRTCBin * webrtc,
|
||||
gchar *id;
|
||||
double ts;
|
||||
gchar *ice_id;
|
||||
GstWebRTCDTLSRole dtls_role = GST_WEBRTC_DTLS_ROLE_UNKNOWN;
|
||||
|
||||
gst_structure_get_double (s, "timestamp", &ts);
|
||||
|
||||
@ -799,6 +800,17 @@ _get_stats_from_dtls_transport (GstWebRTCBin * webrtc,
|
||||
g_free (ice_id);
|
||||
}
|
||||
|
||||
if (transport->state > GST_WEBRTC_DTLS_TRANSPORT_STATE_NEW) {
|
||||
if (transport->client) {
|
||||
dtls_role = GST_WEBRTC_DTLS_ROLE_CLIENT;
|
||||
} else {
|
||||
dtls_role = GST_WEBRTC_DTLS_ROLE_SERVER;
|
||||
}
|
||||
}
|
||||
gst_structure_set (stats, "dtls-role", GST_TYPE_WEBRTC_DTLS_ROLE, dtls_role,
|
||||
"dtls-state", GST_TYPE_WEBRTC_DTLS_TRANSPORT_STATE, transport->state,
|
||||
NULL);
|
||||
|
||||
gst_structure_set (s, id, GST_TYPE_STRUCTURE, stats, NULL);
|
||||
gst_structure_free (stats);
|
||||
|
||||
|
@ -166,6 +166,21 @@ typedef enum /*< underscore_name=gst_webrtc_dtls_transport_state >*/
|
||||
GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED,
|
||||
} GstWebRTCDTLSTransportState;
|
||||
|
||||
/**
|
||||
* GstWebRTCDTLSRole:
|
||||
* @GST_WEBRTC_DTLS_ROLE_CLIENT: client
|
||||
* @GST_WEBRTC_DTLS_ROLE_SERVER: server
|
||||
* @GST_WEBRTC_DTLS_ROLE_UNKNOWN: unknown
|
||||
*
|
||||
* Since: 1.28
|
||||
*/
|
||||
typedef enum /*< underscore_name=gst_webrtc_dtls_role >*/
|
||||
{
|
||||
GST_WEBRTC_DTLS_ROLE_CLIENT,
|
||||
GST_WEBRTC_DTLS_ROLE_SERVER,
|
||||
GST_WEBRTC_DTLS_ROLE_UNKNOWN
|
||||
} GstWebRTCDTLSRole;
|
||||
|
||||
/**
|
||||
* GstWebRTCICEGatheringState:
|
||||
* @GST_WEBRTC_ICE_GATHERING_STATE_NEW: new
|
||||
|
@ -1799,6 +1799,23 @@ validate_candidate_stats (const GstStructure * s, const GstStructure * stats)
|
||||
g_free (username_fragment);
|
||||
}
|
||||
|
||||
static void
|
||||
validate_transport_stats (const GstStructure * s, const GstStructure * stats)
|
||||
{
|
||||
gchar *selected_candidate_pair_id;
|
||||
GstWebRTCDTLSTransportState state;
|
||||
GstWebRTCDTLSRole dtls_role;
|
||||
|
||||
fail_unless (gst_structure_get (s, "selected-candidate-pair-id",
|
||||
G_TYPE_STRING, &selected_candidate_pair_id, NULL));
|
||||
fail_unless (gst_structure_get (s, "dtls-state",
|
||||
GST_TYPE_WEBRTC_DTLS_TRANSPORT_STATE, &state, NULL));
|
||||
fail_unless (gst_structure_get (s, "dtls-role", GST_TYPE_WEBRTC_DTLS_ROLE,
|
||||
&dtls_role, NULL));
|
||||
|
||||
g_free (selected_candidate_pair_id);
|
||||
}
|
||||
|
||||
static void
|
||||
validate_peer_connection_stats (const GstStructure * s)
|
||||
{
|
||||
@ -1862,6 +1879,7 @@ validate_stats_foreach (const GstIdStr * fieldname, const GValue * value,
|
||||
} else if (type == GST_WEBRTC_STATS_DATA_CHANNEL) {
|
||||
} else if (type == GST_WEBRTC_STATS_STREAM) {
|
||||
} else if (type == GST_WEBRTC_STATS_TRANSPORT) {
|
||||
validate_transport_stats (s, stats);
|
||||
} else if (type == GST_WEBRTC_STATS_CANDIDATE_PAIR) {
|
||||
} else if (type == GST_WEBRTC_STATS_LOCAL_CANDIDATE) {
|
||||
validate_candidate_stats (s, stats);
|
||||
|
Loading…
x
Reference in New Issue
Block a user