Skip to content

Commit 8322a8b

Browse files
committed
TT#72350 add codec info to CLI output
closes #889 Change-Id: I7e717f58d5da8d505911f1df5bc6a99f0d9c97dc
1 parent 83f2cb0 commit 8322a8b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

daemon/cli.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "statistics.h"
2727
#include "main.h"
2828
#include "media_socket.h"
29+
#include "rtplib.h"
2930

3031
#include "rtpengine_config.h"
3132

@@ -633,6 +634,8 @@ static void cli_incoming_list_callid(str *instr, struct streambuf *replybuffer)
633634
for (k = ml->medias.head; k; k = k->next) {
634635
md = k->data;
635636

637+
const struct rtp_payload_type *rtp_pt = __rtp_stats_codec(md);
638+
636639
for (o = md->streams.head; o; o = o->next) {
637640
ps = o->data;
638641

@@ -654,7 +657,7 @@ static void cli_incoming_list_callid(str *instr, struct streambuf *replybuffer)
654657
atomic64_get(&ps->last_packet));
655658
} else {
656659
streambuf_printf(replybuffer, "------ Media #%u, %15s:%-5hu <> %15s:%-5hu%s, "
657-
""UINT64F" p, "UINT64F" b, "UINT64F" e, "UINT64F" last_packet, %.9f delay_min, %.9f delay_avg, %.9f delay_max\n",
660+
""UINT64F" p, "UINT64F" b, "UINT64F" e, "UINT64F" last_packet, " STR_FORMAT ", %.9f delay_min, %.9f delay_avg, %.9f delay_max\n",
658661
md->index,
659662
local_addr, (unsigned int) (ps->sfd ? ps->sfd->fd.localport : 0),
660663
sockaddr_print_buf(&ps->endpoint.ip46), ps->endpoint.port,
@@ -663,21 +666,25 @@ static void cli_incoming_list_callid(str *instr, struct streambuf *replybuffer)
663666
atomic64_get(&ps->stats.bytes),
664667
atomic64_get(&ps->stats.errors),
665668
atomic64_get(&ps->last_packet),
669+
rtp_pt ? (int) rtp_pt->encoding_with_params.len : (int) strlen("unknown codec"),
670+
rtp_pt ? rtp_pt->encoding_with_params.s : "unknown codec",
666671
(double) ps->stats.delay_min / 1000000,
667672
(double) ps->stats.delay_avg / 1000000,
668673
(double) ps->stats.delay_max / 1000000);
669674
}
670675
#else
671676
streambuf_printf(replybuffer, "------ Media #%u, %15s:%-5u <> %15s:%-5u%s, "
672-
""UINT64F" p, "UINT64F" b, "UINT64F" e, "UINT64F" last_packet\n",
677+
""UINT64F" p, "UINT64F" b, "UINT64F" e, "UINT64F" last_packet, " STR_FORMAT "\n",
673678
md->index,
674679
local_addr, (unsigned int) (ps->selected_sfd ? ps->selected_sfd->socket.local.port : 0),
675680
sockaddr_print_buf(&ps->endpoint.address), ps->endpoint.port,
676681
(!PS_ISSET(ps, RTP) && PS_ISSET(ps, RTCP)) ? " (RTCP)" : "",
677682
atomic64_get(&ps->stats.packets),
678683
atomic64_get(&ps->stats.bytes),
679684
atomic64_get(&ps->stats.errors),
680-
atomic64_get(&ps->last_packet));
685+
atomic64_get(&ps->last_packet),
686+
rtp_pt ? (int) rtp_pt->encoding_with_params.len : (int) strlen("unknown codec"),
687+
rtp_pt ? rtp_pt->encoding_with_params.s : "unknown codec");
681688
#endif
682689
}
683690
}

0 commit comments

Comments
 (0)