MT#61263 add Opus MOS tests

Change-Id: I566038f5fff96dbd5c1117d4016d56a4dfe72680
pull/1872/head^2
Richard Fuchs 7 months ago
parent 7ceacf9713
commit 743867b43d

@ -569,6 +569,494 @@ cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '>=', 200
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '<', 200000 + $processing_us, 'metric matches';
($sock_a, $sock_ax, $sock_b, $sock_bx) = new_call([qw(198.51.100.23 3016)], [qw(198.51.100.23 3017)],
[qw(198.51.100.23 3018)], [qw(198.51.100.23 3019)]);
($port_a, $port_ax) = offer('Opus MOS basic', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
c=IN IP4 198.51.100.23
t=0 0
m=audio 3016 RTP/AVP 96
a=rtpmap:96 opus/48000/2
-----------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
t=0 0
m=audio PORT RTP/AVP 96
c=IN IP4 203.0.113.1
a=rtpmap:96 opus/48000/2
a=sendrecv
a=rtcp:PORT
SDP
($port_b, $port_bx) = answer('Opus MOS basic', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
c=IN IP4 198.51.100.23
t=0 0
m=audio 3018 RTP/AVP 96
a=rtpmap:96 opus/48000/2
-----------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
t=0 0
m=audio PORT RTP/AVP 96
c=IN IP4 203.0.113.1
a=rtpmap:96 opus/48000/2
a=sendrecv
a=rtcp:PORT
SDP
# populate known payload type
snd($sock_a, $port_b, rtp(96, 1000, 3000, 0x1234567, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(96, 1000, 3000, 0x1234567, "\x00" x 160));
snd($sock_b, $port_a, rtp(96, 2000, 4000, 0x7654321, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(96, 2000, 4000, 0x7654321, "\x00" x 160));
snd($sock_ax, $port_bx, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x1234567, # sender SSRC
0x00100001, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x7654321, # received SSRC
0 << 24 # fraction lost
| 0, # number of packets lost
2000, # extended highest sequence number received
0, # jitter
0x00000000, # last SR
0 / 65536, # delay since last SR
));
Time::HiRes::usleep(3 * 1000000);
snd($sock_bx, $port_ax, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x7654321, # sender SSRC
0x00100004, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x1234567, # received SSRC
0 << 24 # fraction lost
| 0, # number of packets lost
1010, # extended highest sequence number received
0, # jitter
0x00010020, # last SR
3 * 65536, # delay since last SR
));
# no MOS calculated here as we don't have an opposite side RTT yet ^
Time::HiRes::usleep(2 * 1000000);
snd($sock_ax, $port_bx, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x1234567, # sender SSRC
0x00100006, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x7654321, # received SSRC
0 << 24 # fraction lost
| 0, # number of packets lost
2020, # extended highest sequence number received
0, # jitter
0x00040020, # last SR
2 * 65536, # delay since last SR
));
# CQ MOS for 0x1234567 calculated here ^
Time::HiRes::usleep(3 * 1000000);
snd($sock_bx, $port_ax, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x7654321, # sender SSRC
0x00100007, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x1234567, # received SSRC
0 << 24 # fraction lost
| 0, # number of packets lost
1030, # extended highest sequence number received
0, # jitter
0x00060020, # last SR
3 * 65536, # delay since last SR
));
# CQ MOS for 0x7654321 calculated here ^
$resp = rtpe_req('delete', 'Opus MOS basic', { });
is $resp->{SSRC}{0x1234567}{'average MOS'}{samples}, 1, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{MOS}, 43, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{jitter}, 0, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{'packet loss'}, 0, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time'}, '>=', 0, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time'}, '<', $processing_us * 2, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time leg'}, '>=', 0, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time leg'}, '<', $processing_us, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{samples}, 1, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{MOS}, 43, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{jitter}, 0, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{'packet loss'}, 0, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time'}, '>=', 0, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time'}, '<', $processing_us * 2, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '>=', 0, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '<', $processing_us, 'metric matches';
($sock_a, $sock_ax, $sock_b, $sock_bx) = new_call([qw(198.51.100.23 3020)], [qw(198.51.100.23 3021)],
[qw(198.51.100.23 3022)], [qw(198.51.100.23 3023)]);
($port_a, $port_ax) = offer('Opus MOS degraded', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
c=IN IP4 198.51.100.23
t=0 0
m=audio 3020 RTP/AVP 96
a=rtpmap:96 opus/48000/2
-----------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
t=0 0
m=audio PORT RTP/AVP 96
c=IN IP4 203.0.113.1
a=rtpmap:96 opus/48000/2
a=sendrecv
a=rtcp:PORT
SDP
($port_b, $port_bx) = answer('Opus MOS degraded', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
c=IN IP4 198.51.100.23
t=0 0
m=audio 3022 RTP/AVP 96
a=rtpmap:96 opus/48000/2
-----------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
t=0 0
m=audio PORT RTP/AVP 96
c=IN IP4 203.0.113.1
a=rtpmap:96 opus/48000/2
a=sendrecv
a=rtcp:PORT
SDP
# populate known payload type
snd($sock_a, $port_b, rtp(96, 1000, 3000, 0x1234567, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(96, 1000, 3000, 0x1234567, "\x00" x 160));
snd($sock_b, $port_a, rtp(96, 2000, 4000, 0x7654321, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(96, 2000, 4000, 0x7654321, "\x00" x 160));
snd($sock_ax, $port_bx, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x1234567, # sender SSRC
0x00100001, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x7654321, # received SSRC
(0.04*256) << 24 # fraction lost
| 0, # number of packets lost
2000, # extended highest sequence number received
15 * 48000 / 1000, # jitter
0x00000000, # last SR
0 / 65536, # delay since last SR
));
Time::HiRes::usleep(3 * 1000000);
snd($sock_bx, $port_ax, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x7654321, # sender SSRC
0x00100004, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x1234567, # received SSRC
(0.04*256) << 24 # fraction lost
| 0, # number of packets lost
1010, # extended highest sequence number received
15 * 48000 / 1000, # jitter
0x00010020, # last SR
2.88 * 65536,# delay since last SR
));
# no MOS calculated here as we don't have an opposite side RTT yet ^
Time::HiRes::usleep(2 * 1000000);
snd($sock_ax, $port_bx, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x1234567, # sender SSRC
0x00100006, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x7654321, # received SSRC
(0.04*256) << 24 # fraction lost
| 0, # number of packets lost
2020, # extended highest sequence number received
15 * 48000 / 1000, # jitter
0x00040020, # last SR
1.87 * 65536,#delay since last SR
));
# CQ MOS for 0x1234567 calculated here ^
Time::HiRes::usleep(3 * 1000000);
snd($sock_bx, $port_ax, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x7654321, # sender SSRC
0x00100007, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x1234567, # received SSRC
(0.04*256) << 24 # fraction lost
| 0, # number of packets lost
1030, # extended highest sequence number received
15 * 48000 / 1000, # jitter
0x00060020, # last SR
2.88 * 65536,# delay since last SR
));
# CQ MOS for 0x7654321 calculated here ^
$resp = rtpe_req('delete', 'Opus MOS degraded', { });
is $resp->{SSRC}{0x1234567}{'average MOS'}{samples}, 1, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{MOS}, 36, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{jitter}, 15, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{'packet loss'}, 3, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time'}, '>=', 250000, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time'}, '<', 250000 + $processing_us * 2, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time leg'}, '>=', 130000, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time leg'}, '<', 130000 + $processing_us, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{samples}, 1, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{MOS}, 36, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{jitter}, 15, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{'packet loss'}, 3, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time'}, '>=', 250000, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time'}, '<', 250000 + $processing_us * 2, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '>=', 120000, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '<', 120000 + $processing_us, 'metric matches';
($sock_a, $sock_ax, $sock_b, $sock_bx) = new_call([qw(198.51.100.23 3024)], [qw(198.51.100.23 3025)],
[qw(198.51.100.23 3026)], [qw(198.51.100.23 3027)]);
($port_a, $port_ax) = offer('Opus MOS very degraded', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
c=IN IP4 198.51.100.23
t=0 0
m=audio 3024 RTP/AVP 96
a=rtpmap:96 opus/48000/2
-----------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
t=0 0
m=audio PORT RTP/AVP 96
c=IN IP4 203.0.113.1
a=rtpmap:96 opus/48000/2
a=sendrecv
a=rtcp:PORT
SDP
($port_b, $port_bx) = answer('Opus MOS very degraded', { }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
c=IN IP4 198.51.100.23
t=0 0
m=audio 3026 RTP/AVP 96
a=rtpmap:96 opus/48000/2
-----------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.23
s=tester
t=0 0
m=audio PORT RTP/AVP 96
c=IN IP4 203.0.113.1
a=rtpmap:96 opus/48000/2
a=sendrecv
a=rtcp:PORT
SDP
# populate known payload type
snd($sock_a, $port_b, rtp(96, 1000, 3000, 0x1234567, "\x00" x 160));
rcv($sock_b, $port_a, rtpm(96, 1000, 3000, 0x1234567, "\x00" x 160));
snd($sock_b, $port_a, rtp(96, 2000, 4000, 0x7654321, "\x00" x 160));
rcv($sock_a, $port_b, rtpm(96, 2000, 4000, 0x7654321, "\x00" x 160));
snd($sock_ax, $port_bx, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x1234567, # sender SSRC
0x00100001, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x7654321, # received SSRC
(0.04*256) << 24 # fraction lost
| 0, # number of packets lost
2000, # extended highest sequence number received
20 * 48000 / 1000, # jitter
0x00000000, # last SR
0 / 65536, # delay since last SR
));
Time::HiRes::usleep(3 * 1000000);
snd($sock_bx, $port_ax, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x7654321, # sender SSRC
0x00100004, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x1234567, # received SSRC
(0.06*256) << 24 # fraction lost
| 0, # number of packets lost
1010, # extended highest sequence number received
20 * 48000 / 1000, # jitter
0x00010020, # last SR
2.80 * 65536,# delay since last SR
));
# no MOS calculated here as we don't have an opposite side RTT yet ^
Time::HiRes::usleep(2 * 1000000);
snd($sock_ax, $port_bx, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x1234567, # sender SSRC
0x00100006, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x7654321, # received SSRC
(0.06*256) << 24 # fraction lost
| 0, # number of packets lost
2020, # extended highest sequence number received
20 * 48000 / 1000, # jitter
0x00040020, # last SR
1.80 * 65536,#delay since last SR
));
# CQ MOS for 0x1234567 calculated here ^
Time::HiRes::usleep(3 * 1000000);
snd($sock_bx, $port_ax, pack("CC n N NN N N N N N N N N N",
0x81, # version, one reception report
200, # sender report
52 / 4 - 1, # length
0x7654321, # sender SSRC
0x00100007, # NTP MSB
0x00200000, # NTP LSB
4000, # RTP TS
100, # sender packet count
16000, # sender octet count
0x1234567, # received SSRC
(0.06*256) << 24 # fraction lost
| 0, # number of packets lost
1030, # extended highest sequence number received
20 * 48000 / 1000, # jitter
0x00060020, # last SR
2.80 * 65536,# delay since last SR
));
# CQ MOS for 0x7654321 calculated here ^
$resp = rtpe_req('delete', 'Opus MOS very degraded', { });
is $resp->{SSRC}{0x1234567}{'average MOS'}{samples}, 1, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{MOS}, 29, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{jitter}, 20, 'metric matches';
is $resp->{SSRC}{0x1234567}{'average MOS'}{'packet loss'}, 5, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time'}, '>=', 400000, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time'}, '<', 400000 + $processing_us * 2, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time leg'}, '>=', 200000, 'metric matches';
cmp_ok $resp->{SSRC}{0x1234567}{'average MOS'}{'round-trip time leg'}, '<', 200000 + $processing_us, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{samples}, 1, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{MOS}, 29, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{jitter}, 20, 'metric matches';
is $resp->{SSRC}{0x7654321}{'average MOS'}{'packet loss'}, 5, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time'}, '>=', 400000, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time'}, '<', 400000 + $processing_us * 2, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '>=', 200000, 'metric matches';
cmp_ok $resp->{SSRC}{0x7654321}{'average MOS'}{'round-trip time leg'}, '<', 200000 + $processing_us, 'metric matches';
}

Loading…
Cancel
Save