Skip to content

Commit

Permalink
libwebrtc fixes and updates (#944)
Browse files Browse the repository at this point in the history
- Fix calculation of feedback min_pending_time in goog_cc
  - Fixes #849
  - Commit in libwebrtc: https://webrtc.googlesource.com/src/+/d65dc979b17cdc7cd359aada59e5bce8a6f1b8ce%5E%21/
-
Fix signed-to-unsigned overflow in send_side_bandwidth_estimation.cc
  - Fixes #872
  - Issue in libwebrtc: https://bugs.chromium.org/p/webrtc/issues/detail?id=14272
  - Commit in libwebrtc: https://webrtc.googlesource.com/src/+/9804aa5f6ad26a45338d685da66497c3bbd88ca6%5E%21/

NOTE: Some changes are already present in ongoing PR #922 but it's not yet merged.
  • Loading branch information
ibc committed Nov 4, 2022
1 parent 235afe3 commit 60f8200
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* `DataConsumer`: Fix `bufferedAmount` type to be a number again (PR #936).
* `ActiveSpeakerObserver`: Fix 'dominantspeaker' event by having a single `Producer` as argument rather than an array with a single `Producer` into it (PR #941).
* `ActiveSpeakerObserver`: Fix memory leak (PR #942).
* Fix some libwebrtc issues (PR #944).
* Update NPM deps.


Expand All @@ -19,7 +20,7 @@

### 3.10.11

* RTCP: Fix trailing space needed by srtp_protect_rtcp() (PR #929).
* RTCP: Fix trailing space needed by `srtp_protect_rtcp()` (PR #929).


### 3.10.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,26 +382,29 @@ void SendSideBandwidthEstimation::UpdatePacketsLost(int packets_lost,

// Check sequence number diff and weight loss report
if (number_of_packets > 0) {
// Accumulate reports.
lost_packets_since_last_loss_update_ += packets_lost;
expected_packets_since_last_loss_update_ += number_of_packets;
int64_t expected =
expected_packets_since_last_loss_update_ + number_of_packets;

// Don't generate a loss rate until it can be based on enough packets.
if (expected_packets_since_last_loss_update_ < kLimitNumPackets)
if (expected < kLimitNumPackets) {
// Accumulate reports.
expected_packets_since_last_loss_update_ = expected;
lost_packets_since_last_loss_update_ += packets_lost;
return;
}

has_decreased_since_last_fraction_loss_ = false;
int64_t lost_q8 = lost_packets_since_last_loss_update_ << 8;
int64_t expected = expected_packets_since_last_loss_update_;
int64_t lost_q8 =
std::max<int64_t>(lost_packets_since_last_loss_update_ + packets_lost, 0) << 8;
last_fraction_loss_ = std::min<int>(lost_q8 / expected, 255);

// Reset accumulators.

lost_packets_since_last_loss_update_ = 0;
expected_packets_since_last_loss_update_ = 0;
last_loss_packet_report_ = at_time;
UpdateEstimate(at_time);
}

UpdateUmaStatsPacketsLost(at_time, packets_lost);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
for (const auto& feedback : feedbacks) {
TimeDelta feedback_rtt =
report.feedback_time - feedback.sent_packet.send_time;
TimeDelta min_pending_time = feedback.receive_time - max_recv_time;
TimeDelta min_pending_time = max_recv_time - feedback.receive_time;
TimeDelta propagation_rtt = feedback_rtt - min_pending_time;
max_feedback_rtt = std::max(max_feedback_rtt, feedback_rtt);
min_propagation_rtt = std::min(min_propagation_rtt, propagation_rtt);
Expand Down

0 comments on commit 60f8200

Please sign in to comment.