mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
srt: Remove callers for which srt_bstats fails
This keeps them from accumulating in the element and in the stats while the sink is not being fed, as long as we at least periodically grab stats. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3156>
This commit is contained in:
parent
d575a41145
commit
424b331afc
1 changed files with 16 additions and 8 deletions
|
@ -1872,7 +1872,7 @@ gst_srt_object_write (GstSRTObject * srtobject,
|
||||||
static GstStructure *
|
static GstStructure *
|
||||||
get_stats_for_srtsock (GstSRTObject * srtobject, SRTSOCKET srtsock)
|
get_stats_for_srtsock (GstSRTObject * srtobject, SRTSOCKET srtsock)
|
||||||
{
|
{
|
||||||
GstStructure *s = gst_structure_new_empty ("application/x-srt-statistics");
|
GstStructure *s;
|
||||||
int ret;
|
int ret;
|
||||||
SRT_TRACEBSTATS stats;
|
SRT_TRACEBSTATS stats;
|
||||||
|
|
||||||
|
@ -1881,10 +1881,10 @@ get_stats_for_srtsock (GstSRTObject * srtobject, SRTSOCKET srtsock)
|
||||||
GST_WARNING_OBJECT (srtobject->element,
|
GST_WARNING_OBJECT (srtobject->element,
|
||||||
"failed to retrieve stats for socket %d (reason %s)",
|
"failed to retrieve stats for socket %d (reason %s)",
|
||||||
srtsock, srt_getlasterror_str ());
|
srtsock, srt_getlasterror_str ());
|
||||||
return s;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_structure_set (s,
|
s = gst_structure_new ("application/x-srt-statistics",
|
||||||
/* number of sent data packets, including retransmissions */
|
/* number of sent data packets, including retransmissions */
|
||||||
"packets-sent", G_TYPE_INT64, stats.pktSent,
|
"packets-sent", G_TYPE_INT64, stats.pktSent,
|
||||||
/* number of lost packets (sender side) */
|
/* number of lost packets (sender side) */
|
||||||
|
@ -1939,22 +1939,31 @@ gst_srt_object_get_stats (GstSRTObject * srtobject)
|
||||||
|
|
||||||
if (srtobject->sock != SRT_INVALID_SOCK) {
|
if (srtobject->sock != SRT_INVALID_SOCK) {
|
||||||
s = get_stats_for_srtsock (srtobject, srtobject->sock);
|
s = get_stats_for_srtsock (srtobject, srtobject->sock);
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s = gst_structure_new_empty ("application/x-srt-statistics");
|
if (s == NULL) {
|
||||||
|
s = gst_structure_new_empty ("application/x-srt-statistics");
|
||||||
|
}
|
||||||
|
|
||||||
if (srtobject->callers) {
|
if (srtobject->callers) {
|
||||||
GValueArray *callers_stats = g_value_array_new (1);
|
GValueArray *callers_stats = g_value_array_new (1);
|
||||||
GValue callers_stats_v = G_VALUE_INIT;
|
GValue callers_stats_v = G_VALUE_INIT;
|
||||||
GList *item;
|
GList *item, *next;
|
||||||
|
|
||||||
for (item = srtobject->callers; item; item = item->next) {
|
for (item = srtobject->callers, next = NULL; item; item = next) {
|
||||||
SRTCaller *caller = item->data;
|
SRTCaller *caller = item->data;
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
GValue *v;
|
GValue *v;
|
||||||
|
|
||||||
|
next = item->next;
|
||||||
|
|
||||||
tmp = get_stats_for_srtsock (srtobject, caller->sock);
|
tmp = get_stats_for_srtsock (srtobject, caller->sock);
|
||||||
|
if (tmp == NULL) {
|
||||||
|
srtobject->callers = g_list_delete_link (srtobject->callers, item);
|
||||||
|
srt_caller_signal_removed (caller, srtobject);
|
||||||
|
srt_caller_free (caller);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
gst_structure_set (tmp, "caller-address", G_TYPE_SOCKET_ADDRESS,
|
gst_structure_set (tmp, "caller-address", G_TYPE_SOCKET_ADDRESS,
|
||||||
caller->sockaddr, NULL);
|
caller->sockaddr, NULL);
|
||||||
|
@ -1970,7 +1979,6 @@ gst_srt_object_get_stats (GstSRTObject * srtobject)
|
||||||
gst_structure_take_value (s, "callers", &callers_stats_v);
|
gst_structure_take_value (s, "callers", &callers_stats_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
|
||||||
gst_structure_set (s, is_sender ? "bytes-sent-total" : "bytes-received-total",
|
gst_structure_set (s, is_sender ? "bytes-sent-total" : "bytes-received-total",
|
||||||
G_TYPE_UINT64, srtobject->bytes, NULL);
|
G_TYPE_UINT64, srtobject->bytes, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue