MT#61263 add flexible MOS calculation

Support different MOS formulas. Only "legacy" (existing formula) is
supported at this point.

Change-Id: I25846da993bf61a34f26a8384622b7a2a2bbcf06
pull/1872/head^2
Richard Fuchs 7 months ago
parent bcf9d7a0fd
commit 50b1d03e61

@ -1036,6 +1036,10 @@ static void options(int *argc, char ***argv) {
rtpe_config.mos = MOS_CQ; rtpe_config.mos = MOS_CQ;
else if (!strcasecmp(mos, "lq")) else if (!strcasecmp(mos, "lq"))
rtpe_config.mos = MOS_LQ; rtpe_config.mos = MOS_LQ;
#ifdef WITH_TRANSCODING
else if (!strcasecmp(mos, "legacy"))
rtpe_config.common.mos_type = MOS_LEGACY;
#endif
else else
die("Invalid --mos option ('%s')", mos); die("Invalid --mos option ('%s')", mos);
} }

@ -8,6 +8,15 @@
#include "codeclib.h" #include "codeclib.h"
#include "bufferpool.h" #include "bufferpool.h"
typedef void mos_calc_fn(struct ssrc_stats_block *ssb);
static mos_calc_fn mos_calc_legacy;
#ifdef WITH_TRANSCODING
static mos_calc_fn *mos_calcs[__MOS_TYPES] = {
[MOS_LEGACY] = mos_calc_legacy,
};
#endif
static void __free_ssrc_entry_call(void *e); static void __free_ssrc_entry_call(void *e);
@ -67,7 +76,7 @@ static void ssrc_entry_put(void *ep) {
} }
// returned as mos * 10 (i.e. 10 - 50 for 1.0 to 5.0) // returned as mos * 10 (i.e. 10 - 50 for 1.0 to 5.0)
static void mos_calc(struct ssrc_stats_block *ssb) { static void mos_calc_legacy(struct ssrc_stats_block *ssb) {
uint64_t rtt = ssb->rtt; uint64_t rtt = ssb->rtt;
if (rtpe_config.mos == MOS_CQ && !rtt) if (rtpe_config.mos == MOS_CQ && !rtt)
return; // can not compute the MOS-CQ unless we have a valid RTT return; // can not compute the MOS-CQ unless we have a valid RTT
@ -422,6 +431,12 @@ void ssrc_receiver_report(struct call_media *m, stream_fd *sfd, const struct ssr
RTPE_SAMPLE_SFD(rtt_dsct, rtt, sfd); RTPE_SAMPLE_SFD(rtt_dsct, rtt, sfd);
RTPE_SAMPLE_SFD(packetloss, ssb->packetloss, sfd); RTPE_SAMPLE_SFD(packetloss, ssb->packetloss, sfd);
mos_calc_fn *mos_calc = mos_calc_legacy;
#ifdef WITH_TRANSCODING
if (rpt->codec_def)
mos_calc = mos_calcs[rpt->codec_def->mos_type];
#endif
other_e->packets_lost = rr->packets_lost; other_e->packets_lost = rr->packets_lost;
mos_calc(ssb); mos_calc(ssb);
if (ssb->mos) { if (ssb->mos) {

@ -37,6 +37,7 @@ struct rtpengine_common_config {
gboolean io_uring; gboolean io_uring;
int io_uring_buffers; int io_uring_buffers;
int max_log_line_length; int max_log_line_length;
int mos_type; // enum in codec_def_t
char *evs_lib_path; char *evs_lib_path;
char *codec_chain_lib_path; char *codec_chain_lib_path;
int codec_chain_runners; int codec_chain_runners;

@ -1652,6 +1652,9 @@ void codeclib_init(int print) {
if (def->supplemental) if (def->supplemental)
g_queue_push_tail(&__supplemental_codecs, def); g_queue_push_tail(&__supplemental_codecs, def);
if (rtpe_common_config_ptr->mos_type)
def->mos_type = rtpe_common_config_ptr->mos_type;
} }
} }

@ -198,6 +198,11 @@ struct codec_def_s {
const int bits_per_sample; const int bits_per_sample;
const enum media_type media_type; const enum media_type media_type;
const str silence_pattern; const str silence_pattern;
enum {
MOS_LEGACY = 0, // default
__MOS_TYPES
} mos_type;
// codec-specific callbacks // codec-specific callbacks
format_init_f *init; format_init_f *init;

Loading…
Cancel
Save