diff options
author | Marvin W <git@larma.de> | 2021-11-10 23:12:19 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2021-11-10 23:13:33 +0100 |
commit | 1b157a20ab728a010eb85292177bcb62cef6a839 (patch) | |
tree | fb9edafd481d78b46331f615b71075bd446f6b16 /plugins/rtp/src/stream.vala | |
parent | cfe43de5d5bcc46691be0d0328fcbcb9f1a2e2af (diff) | |
download | dino-1b157a20ab728a010eb85292177bcb62cef6a839.tar.gz dino-1b157a20ab728a010eb85292177bcb62cef6a839.zip |
Fix REMB calculation
Diffstat (limited to 'plugins/rtp/src/stream.vala')
-rw-r--r-- | plugins/rtp/src/stream.vala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/rtp/src/stream.vala b/plugins/rtp/src/stream.vala index 5d1cf6bf..17c955a5 100644 --- a/plugins/rtp/src/stream.vala +++ b/plugins/rtp/src/stream.vala @@ -201,12 +201,15 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { source_stat.get_uint64("packets-received", out packets_received); source_stat.get_uint64("octets-received", out octets_received); int new_lost = packets_lost - last_packets_lost; + if (new_lost < 0) new_lost = 0; uint64 new_received = packets_received - last_packets_received; + if (packets_received < last_packets_received) new_received = 0; uint64 new_octets = octets_received - last_octets_received; - if (new_received == 0) continue; + if (octets_received < last_octets_received) octets_received = 0; last_packets_lost = packets_lost; last_packets_received = packets_received; last_octets_received = octets_received; + if (new_received == 0) continue; double loss_rate = (double)new_lost / (double)(new_lost + new_received); if (new_lost <= 0 || loss_rate < 0.02) { remb = (uint)(1.08 * (double)remb); @@ -256,7 +259,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { uint8 br_exp = data[5] >> 2; uint32 br_mant = (((uint32)data[5] & 0x3) << 16) + ((uint32)data[6] << 8) + (uint32)data[7]; uint bitrate = (br_mant << br_exp) / 1000; - self.input_device.update_bitrate(self.payload_type, bitrate * 8); + self.input_device.update_bitrate(self.payload_type, bitrate); } } |