Let’s play with WebRTC statistics and the getStats() API. WebRTC Stats expert Varun Singh will review the many statistics WebRTC provides, what they mean, and how to use them to keep your service running smoothly.
2. Multimedia Systems
• connected to a network
• capture and transmit media
• receive and render media
• video codecs: e.g., H.264, VP8, VP9, …
• audio codecs: e.g., G.711, Opus, …
2
24. Example (1/3)
var selector = pc.getRemoteStreams()[0].getAudioTracks()[0];
var rttMeasures = [];
setTimeout(function () {
pc.getStats(selector, function (report) {
// do something
}, logError);
}, 1000);
24
25. Example (2/3)
var selector = pc.getRemoteStreams()[0].getAudioTracks()[0];
var rttMeasures = [];
setTimeout(function () {
pc.getStats(selector, function (report) {
for (var i in report) {
var now = report[i];
if (now.type == "outbound-rtp") {
//do something
}
}
}, logError);
}, 1000);
25
26. Example (3/3)
var selector = pc.getRemoteStreams()[0].getAudioTracks()[0];
var rttMeasures = [];
setTimeout(function () {
pc.getStats(selector, function (report) {
for (var i in report) {
var now = report[i];
if (now.type == "outbound-rtp") {
rttMeasures.append(now.roundTripTime);
var avgRoundTripTime = average(rttMeasures);
var emodel = simplemodel(avgRoundTripTime);
console.log ("e-model: "+str(emodel));
//can add jitter, losses, framesDiscarded, etc
}
}
}, logError);
}, 1000);
26
29. Disruption: loss of connectivity when
network interfaces change, low available
capacity,or high delay
The light grey vertical lines show disruption, highlighted by
the red bounding boxes.29
Network Disruptions
30. Disruptions and user behaviour
User Behaviour: The user tries to
correct for the disruption by
turning on and off video
30