diff options
author | Marvin W <git@larma.de> | 2021-12-19 22:38:00 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2021-12-19 22:38:00 +0100 |
commit | cd6d501c23c8550e7b2d880f8e60e3df8e887c2a (patch) | |
tree | 2c867174d1830f7c5c960c19d361345e075d3f49 /plugins/rtp/src/stream.vala | |
parent | b1c1751cc42948ae76a363691fad575348207396 (diff) | |
download | dino-cd6d501c23c8550e7b2d880f8e60e3df8e887c2a.tar.gz dino-cd6d501c23c8550e7b2d880f8e60e3df8e887c2a.zip |
RTP: Improve screen resolution update logic
Diffstat (limited to 'plugins/rtp/src/stream.vala')
-rw-r--r-- | plugins/rtp/src/stream.vala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/rtp/src/stream.vala b/plugins/rtp/src/stream.vala index 385a590c..dc712b61 100644 --- a/plugins/rtp/src/stream.vala +++ b/plugins/rtp/src/stream.vala @@ -169,7 +169,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { Timeout.add(1000, () => remb_adjust()); } if (input_device != null && media == "video") { - input_device.update_bitrate(payload_type, 256); + input_device.update_bitrate(payload_type, target_send_bitrate); } } @@ -214,16 +214,18 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { if (packets_received < last_packets_received) new_received = 0; uint64 new_octets = octets_received - last_octets_received; if (octets_received < last_octets_received) octets_received = 0; + if (new_received == 0) continue; 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); - uint new_target_receive_bitrate = 256; + uint new_target_receive_bitrate; if (new_lost <= 0 || loss_rate < 0.02) { new_target_receive_bitrate = (uint)(1.08 * (double)target_receive_bitrate); } else if (loss_rate > 0.1) { new_target_receive_bitrate = (uint)((1.0 - 0.5 * loss_rate) * (double)target_receive_bitrate); + } else { + new_target_receive_bitrate = target_receive_bitrate; } if (last_remb_time == 0) { last_remb_time = get_monotonic_time(); @@ -670,6 +672,7 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { public void unpause() { if (!paused) return; set_input_and_pause(input_device != null ? input_device.link_source(payload_type, our_ssrc, next_seqnum_offset, next_timestamp_offset) : null, false); + input_device.update_bitrate(payload_type, target_send_bitrate); } public uint get_participant_ssrc(Xmpp.Jid participant) { |