Adds handling of untracked data to congestion controller.
Bug: webrtc:9796 Change-Id: I097e8f72a6c8d323c3ea73dbb4ade60873dd4e8d Reviewed-on: https://webrtc-review.googlesource.com/c/104883 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25129}
This commit is contained in:
parent
ca51189154
commit
8285841e8f
@ -15,6 +15,7 @@
|
||||
#include "absl/memory/memory.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -31,7 +32,9 @@ AcknowledgedBitrateEstimator::~AcknowledgedBitrateEstimator() {}
|
||||
|
||||
AcknowledgedBitrateEstimator::AcknowledgedBitrateEstimator(
|
||||
std::unique_ptr<BitrateEstimator> bitrate_estimator)
|
||||
: bitrate_estimator_(std::move(bitrate_estimator)) {}
|
||||
: account_for_unacknowledged_traffic_(
|
||||
field_trial::IsEnabled("WebRTC-Bwe-AccountForUnacked")),
|
||||
bitrate_estimator_(std::move(bitrate_estimator)) {}
|
||||
|
||||
void AcknowledgedBitrateEstimator::IncomingPacketFeedbackVector(
|
||||
const std::vector<PacketFeedback>& packet_feedback_vector) {
|
||||
@ -41,18 +44,25 @@ void AcknowledgedBitrateEstimator::IncomingPacketFeedbackVector(
|
||||
for (const auto& packet : packet_feedback_vector) {
|
||||
if (IsInSendTimeHistory(packet)) {
|
||||
MaybeExpectFastRateChange(packet.send_time_ms);
|
||||
bitrate_estimator_->Update(packet.arrival_time_ms,
|
||||
rtc::dchecked_cast<int>(packet.payload_size));
|
||||
int acknowledged_estimate = rtc::dchecked_cast<int>(packet.payload_size);
|
||||
if (account_for_unacknowledged_traffic_)
|
||||
acknowledged_estimate += packet.unacknowledged_data;
|
||||
bitrate_estimator_->Update(packet.arrival_time_ms, acknowledged_estimate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
absl::optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const {
|
||||
auto estimated_bitrate = bitrate_estimator_->bitrate_bps();
|
||||
return estimated_bitrate
|
||||
? *estimated_bitrate +
|
||||
allocated_bitrate_without_feedback_bps_.value_or(0)
|
||||
: estimated_bitrate;
|
||||
// If we account for unacknowledged traffic, we should not add the allocated
|
||||
// bitrate for unallocated stream as we expect it to be included already.
|
||||
if (account_for_unacknowledged_traffic_) {
|
||||
return estimated_bitrate;
|
||||
} else {
|
||||
return estimated_bitrate
|
||||
? *estimated_bitrate + allocated_bitrate_without_feedback_bps_
|
||||
: estimated_bitrate;
|
||||
}
|
||||
}
|
||||
|
||||
void AcknowledgedBitrateEstimator::SetAlrEndedTimeMs(
|
||||
@ -62,7 +72,7 @@ void AcknowledgedBitrateEstimator::SetAlrEndedTimeMs(
|
||||
|
||||
void AcknowledgedBitrateEstimator::SetAllocatedBitrateWithoutFeedback(
|
||||
uint32_t bitrate_bps) {
|
||||
allocated_bitrate_without_feedback_bps_.emplace(bitrate_bps);
|
||||
allocated_bitrate_without_feedback_bps_ = bitrate_bps;
|
||||
}
|
||||
|
||||
void AcknowledgedBitrateEstimator::MaybeExpectFastRateChange(
|
||||
|
||||
@ -37,9 +37,10 @@ class AcknowledgedBitrateEstimator {
|
||||
|
||||
private:
|
||||
void MaybeExpectFastRateChange(int64_t packet_arrival_time_ms);
|
||||
const bool account_for_unacknowledged_traffic_;
|
||||
absl::optional<int64_t> alr_ended_time_ms_;
|
||||
std::unique_ptr<BitrateEstimator> bitrate_estimator_;
|
||||
absl::optional<uint32_t> allocated_bitrate_without_feedback_bps_;
|
||||
uint32_t allocated_bitrate_without_feedback_bps_ = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -110,6 +110,7 @@ std::vector<PacketFeedback> ReceivedPacketsFeedbackAsRtp(
|
||||
pf.payload_size = fb.sent_packet->size.bytes();
|
||||
pf.pacing_info = fb.sent_packet->pacing_info;
|
||||
pf.send_time_ms = fb.sent_packet->send_time.ms();
|
||||
pf.unacknowledged_data = fb.sent_packet->prior_unacked_data.bytes();
|
||||
} else {
|
||||
pf.send_time_ms = PacketFeedback::kNoSendTime;
|
||||
}
|
||||
|
||||
@ -27,6 +27,10 @@ TEST(ScenarioTest, StartsAndStopsWithoutErrors) {
|
||||
s.CreateVideoStream(bob, {bob_net}, alice, {alice_net}, video_stream_config);
|
||||
|
||||
AudioStreamConfig audio_stream_config;
|
||||
audio_stream_config.encoder.min_rate = DataRate::kbps(6);
|
||||
audio_stream_config.encoder.max_rate = DataRate::kbps(64);
|
||||
audio_stream_config.encoder.allocate_bitrate = true;
|
||||
audio_stream_config.stream.in_bandwidth_estimation = false;
|
||||
s.CreateAudioStream(alice, {alice_net}, bob, {bob_net}, audio_stream_config);
|
||||
s.CreateAudioStream(bob, {bob_net}, alice, {alice_net}, audio_stream_config);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user