Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Mar 17, 2024
1 parent 5f79534 commit fbe2d26
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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\","
Expand All @@ -86,6 +90,7 @@ static void slmix_metrics(void *arg)
video_stat->rtt / 1000);
}
}

if (mbuf_pos(mb) == 0)
goto out;

Expand Down

0 comments on commit fbe2d26

Please sign in to comment.