From fbe2d260957e5d9195a9af81e4b590cbdd631ebd Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sun, 17 Mar 2024 13:25:52 +0100 Subject: [PATCH] fix types --- src/mix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mix.c b/src/mix.c index bbdb009..17f932e 100644 --- a/src/mix.c +++ b/src/mix.c @@ -53,14 +53,13 @@ static void slmix_metrics(void *arg) struct sl_httpconn *http_conn; const struct rtcp_stats *audio_stat; const struct rtcp_stats *video_stat; + bool types = true; (void)arg; struct mbuf *mb = mbuf_alloc(512); if (!mb) goto out; - mbuf_printf(mb, "# TYPE mix_rtt gauge\n"); - LIST_FOREACH(&mix.sessl, le) { struct session *sess = le->data; @@ -71,6 +70,11 @@ static void slmix_metrics(void *arg) audio_stat = stream_rtcp_stats(media_get_stream(sess->maudio)); video_stat = stream_rtcp_stats(media_get_stream(sess->mvideo)); + if (types) { + mbuf_printf(mb, "# TYPE mix_rtt gauge\n"); + types = false; + } + if (audio_stat) { mbuf_printf(mb, "mix_rtt{instance=\"%s\",user=\"%s\"," @@ -86,6 +90,7 @@ static void slmix_metrics(void *arg) video_stat->rtt / 1000); } } + if (mbuf_pos(mb) == 0) goto out;