Add data_in_flight to RTC event log Scream event
Bug: webrtc:447037083
Change-Id: Ibd1372ea8e87beb9e55d869f05501e620a8666c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/418000
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45966}
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
index 762c650..e1e3bc0 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
@@ -1381,6 +1381,7 @@
event_stream->add_scream_bwe_updates();
proto_batch->set_timestamp_ms(base_event->timestamp_ms());
proto_batch->set_ref_window_bytes(base_event->ref_window_bytes());
+ proto_batch->set_data_in_flight_bytes(base_event->data_in_flight_bytes());
proto_batch->set_target_rate_kbps(base_event->target_rate_kbps());
proto_batch->set_smoothed_rtt_ms(base_event->smoothed_rtt_ms());
proto_batch->set_avg_queue_delay_ms(base_event->avg_queue_delay_ms());
@@ -1414,6 +1415,16 @@
proto_batch->set_ref_window_bytes_deltas(encoded_deltas);
}
+ // data_in_flight_bytes
+ for (size_t i = 0; i < values.size(); ++i) {
+ const RtcEventBweUpdateScream* event = batch[i + 1];
+ values[i] = event->data_in_flight_bytes();
+ }
+ encoded_deltas = EncodeDeltas(base_event->data_in_flight_bytes(), values);
+ if (!encoded_deltas.empty()) {
+ proto_batch->set_data_in_flight_bytes_deltas(encoded_deltas);
+ }
+
// target_rate_kbps
for (size_t i = 0; i < values.size(); ++i) {
const RtcEventBweUpdateScream* event = batch[i + 1];
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_scream.cc b/logging/rtc_event_log/events/rtc_event_bwe_update_scream.cc
index 681fb74..74cd2e0 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_scream.cc
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_scream.cc
@@ -21,11 +21,13 @@
namespace webrtc {
RtcEventBweUpdateScream::RtcEventBweUpdateScream(DataSize ref_window,
+ DataSize data_in_flight,
DataRate target_rate,
TimeDelta smoothed_rtt,
TimeDelta avg_queue_delay,
uint32_t l4s_marked_permille)
: ref_window_bytes_(ref_window.bytes()),
+ data_in_flight_bytes_(data_in_flight.bytes()),
target_rate_kbps_(target_rate.kbps()),
smoothed_rtt_ms_(smoothed_rtt.ms()),
avg_queue_delay_ms_(avg_queue_delay.ms()),
diff --git a/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h b/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h
index 73a66c3..538e797 100644
--- a/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h
+++ b/logging/rtc_event_log/events/rtc_event_bwe_update_scream.h
@@ -32,12 +32,14 @@
LoggedBweScreamUpdate() = default;
LoggedBweScreamUpdate(Timestamp timestamp,
uint32_t ref_window_bytes,
+ uint32_t data_in_flight_bytes,
uint32_t target_rate_kbps,
uint32_t smoothed_rtt_ms,
uint32_t avg_queue_delay_ms,
uint32_t l4s_marked_permille)
: timestamp(timestamp),
ref_window(DataSize::Bytes(ref_window_bytes)),
+ data_in_flight(DataSize::Bytes(data_in_flight_bytes)),
target_rate(DataRate::KilobitsPerSec(target_rate_kbps)),
smoothed_rtt(TimeDelta::Millis(smoothed_rtt_ms)),
avg_queue_delay(TimeDelta::Millis(avg_queue_delay_ms)),
@@ -49,6 +51,7 @@
Timestamp timestamp = Timestamp::MinusInfinity();
DataSize ref_window;
+ DataSize data_in_flight;
DataRate target_rate;
TimeDelta smoothed_rtt;
TimeDelta avg_queue_delay;
@@ -60,6 +63,7 @@
static constexpr Type kType = Type::BweUpdateScream;
RtcEventBweUpdateScream(DataSize ref_window,
+ DataSize data_in_flight,
DataRate target_rate,
TimeDelta smoothed_rtt,
TimeDelta avg_queue_delay,
@@ -72,6 +76,7 @@
std::unique_ptr<RtcEventBweUpdateScream> Copy() const;
uint32_t ref_window_bytes() const { return ref_window_bytes_; }
+ uint32_t data_in_flight_bytes() const { return data_in_flight_bytes_; }
uint32_t target_rate_kbps() const { return target_rate_kbps_; }
uint32_t smoothed_rtt_ms() const { return smoothed_rtt_ms_; }
uint32_t avg_queue_delay_ms() const { return avg_queue_delay_ms_; }
@@ -94,6 +99,7 @@
RtcEventBweUpdateScream(const RtcEventBweUpdateScream&) = default;
const uint32_t ref_window_bytes_;
+ const uint32_t data_in_flight_bytes_;
const uint32_t target_rate_kbps_;
const uint32_t smoothed_rtt_ms_;
const uint32_t avg_queue_delay_ms_;
diff --git a/logging/rtc_event_log/rtc_event_log2.proto b/logging/rtc_event_log/rtc_event_log2.proto
index a60af88..3b2dfc6 100644
--- a/logging/rtc_event_log/rtc_event_log2.proto
+++ b/logging/rtc_event_log/rtc_event_log2.proto
@@ -456,9 +456,10 @@
optional uint32 smoothed_rtt_ms = 4;
optional uint32 avg_queue_delay_ms = 5;
optional uint32 l4s_marked_permille = 6;
+ optional uint32 data_in_flight_bytes = 7;
// optional - required if the batch contains delta encoded events.
- optional uint32 number_of_deltas = 7;
+ optional uint32 number_of_deltas = 15;
// Delta encodings.
optional bytes timestamp_ms_deltas = 101;
@@ -467,6 +468,7 @@
optional bytes smoothed_rtt_ms_deltas = 104;
optional bytes avg_queue_delay_ms_deltas = 105;
optional bytes l4s_marked_permille_deltas = 106;
+ optional bytes data_in_flight_bytes_deltas = 107;
}
// Maps RTP header extension names to numerical IDs.
diff --git a/logging/rtc_event_log/rtc_event_log_parser.cc b/logging/rtc_event_log/rtc_event_log_parser.cc
index 1846fe9..60b9a67 100644
--- a/logging/rtc_event_log/rtc_event_log_parser.cc
+++ b/logging/rtc_event_log/rtc_event_log_parser.cc
@@ -3167,6 +3167,7 @@
const rtclog2::ScreamBweUpdates& proto) {
RTC_PARSE_CHECK_OR_RETURN(proto.has_timestamp_ms());
RTC_PARSE_CHECK_OR_RETURN(proto.has_ref_window_bytes());
+ RTC_PARSE_CHECK_OR_RETURN(proto.has_data_in_flight_bytes());
RTC_PARSE_CHECK_OR_RETURN(proto.has_target_rate_kbps());
RTC_PARSE_CHECK_OR_RETURN(proto.has_smoothed_rtt_ms());
RTC_PARSE_CHECK_OR_RETURN(proto.has_avg_queue_delay_ms());
@@ -3175,8 +3176,9 @@
// Base event
bwe_scream_updates_.emplace_back(
Timestamp::Millis(proto.timestamp_ms()), proto.ref_window_bytes(),
- proto.target_rate_kbps(), proto.smoothed_rtt_ms(),
- proto.avg_queue_delay_ms(), proto.l4s_marked_permille());
+ proto.data_in_flight_bytes(), proto.target_rate_kbps(),
+ proto.smoothed_rtt_ms(), proto.avg_queue_delay_ms(),
+ proto.l4s_marked_permille());
const size_t number_of_deltas =
proto.has_number_of_deltas() ? proto.number_of_deltas() : 0u;
@@ -3196,6 +3198,12 @@
number_of_deltas);
RTC_PARSE_CHECK_OR_RETURN_EQ(ref_window_bytes_values.size(),
number_of_deltas);
+ // data_in_flight_bytes
+ std::vector<std::optional<uint64_t>> data_in_flight_bytes_values =
+ DecodeDeltas(proto.data_in_flight_bytes_deltas(),
+ proto.data_in_flight_bytes(), number_of_deltas);
+ RTC_PARSE_CHECK_OR_RETURN_EQ(data_in_flight_bytes_values.size(),
+ number_of_deltas);
// target_rate_kbps
std::vector<std::optional<uint64_t>> target_rate_kbps_values =
@@ -3237,6 +3245,12 @@
const uint32_t ref_window_bytes =
static_cast<uint32_t>(ref_window_bytes_values[i].value());
+ RTC_PARSE_CHECK_OR_RETURN(data_in_flight_bytes_values[i].has_value());
+ RTC_PARSE_CHECK_OR_RETURN_LE(data_in_flight_bytes_values[i].value(),
+ std::numeric_limits<uint32_t>::max());
+ const uint32_t data_in_flight_bytes =
+ static_cast<uint32_t>(data_in_flight_bytes_values[i].value());
+
RTC_PARSE_CHECK_OR_RETURN(target_rate_kbps_values[i].has_value());
RTC_PARSE_CHECK_OR_RETURN_LE(target_rate_kbps_values[i].value(),
std::numeric_limits<uint32_t>::max());
@@ -3261,9 +3275,10 @@
const uint32_t l4s_marked_permille =
static_cast<uint32_t>(l4s_marked_permille_values[i].value());
- bwe_scream_updates_.emplace_back(
- Timestamp::Millis(timestamp_ms), ref_window_bytes, target_rate_kbps,
- smoothed_rtt_ms, avg_queue_delay_ms, l4s_marked_permille);
+ bwe_scream_updates_.emplace_back(Timestamp::Millis(timestamp_ms),
+ ref_window_bytes, data_in_flight_bytes,
+ target_rate_kbps, smoothed_rtt_ms,
+ avg_queue_delay_ms, l4s_marked_permille);
}
return ParseStatus::Success();
}
diff --git a/logging/rtc_event_log/rtc_event_log_unittest_helper.cc b/logging/rtc_event_log/rtc_event_log_unittest_helper.cc
index 9d05e0b..63c6c92 100644
--- a/logging/rtc_event_log/rtc_event_log_unittest_helper.cc
+++ b/logging/rtc_event_log/rtc_event_log_unittest_helper.cc
@@ -202,12 +202,13 @@
std::unique_ptr<RtcEventBweUpdateScream> EventGenerator::NewBweUpdateScream() {
uint32_t ref_window_bytes = prng_.Rand(0u, 100000u);
+ uint32_t data_in_flight_bytes = prng_.Rand(0u, 100000u);
uint32_t target_rate_kbps = prng_.Rand(0u, 40000u);
uint32_t smoothed_rtt_ms = prng_.Rand(0u, 10000u);
uint32_t avg_queue_delay_ms = prng_.Rand(0u, 5000u);
uint32_t l4s_marked_permille = prng_.Rand(0u, 1000u);
return std::make_unique<RtcEventBweUpdateScream>(
- DataSize::Bytes(ref_window_bytes),
+ DataSize::Bytes(ref_window_bytes), DataSize::Bytes(data_in_flight_bytes),
DataRate::KilobitsPerSec(target_rate_kbps),
TimeDelta::Millis(smoothed_rtt_ms), TimeDelta::Millis(avg_queue_delay_ms),
l4s_marked_permille);
@@ -827,6 +828,8 @@
const LoggedBweScreamUpdate& logged_event) const {
EXPECT_EQ(original_event.timestamp_ms(), logged_event.log_time_ms());
EXPECT_EQ(original_event.ref_window_bytes(), logged_event.ref_window.bytes());
+ EXPECT_EQ(original_event.data_in_flight_bytes(),
+ logged_event.data_in_flight.bytes());
EXPECT_EQ(original_event.target_rate_kbps(), logged_event.target_rate.kbps());
EXPECT_EQ(original_event.smoothed_rtt_ms(), logged_event.smoothed_rtt.ms());
EXPECT_EQ(original_event.avg_queue_delay_ms(),
diff --git a/modules/congestion_controller/scream/scream_v2.cc b/modules/congestion_controller/scream/scream_v2.cc
index fc84177..c4f21f4 100644
--- a/modules/congestion_controller/scream/scream_v2.cc
+++ b/modules/congestion_controller/scream/scream_v2.cc
@@ -82,7 +82,7 @@
UpdateL4SAlpha(msg);
UpdateRefWindowAndTargetRate(msg);
env_.event_log().Log(std::make_unique<RtcEventBweUpdateScream>(
- ref_window_, target_rate_, msg.smoothed_rtt,
+ ref_window_, msg.data_in_flight, target_rate_, msg.smoothed_rtt,
delay_based_congestion_control_.queue_delay(),
/*l4s_marked_permille*/ l4s_alpha_ * 1000));
return target_rate_;
diff --git a/rtc_tools/rtc_event_log_to_text/converter.cc b/rtc_tools/rtc_event_log_to_text/converter.cc
index dd6018f..e2fe6be 100644
--- a/rtc_tools/rtc_event_log_to_text/converter.cc
+++ b/rtc_tools/rtc_event_log_to_text/converter.cc
@@ -226,11 +226,13 @@
auto bwe_scream_update_handler = [&](const LoggedBweScreamUpdate& event) {
fprintf(output,
"BWE_SCREAM %" PRId64 "ref_window_bytes=%" PRId64
- " target_rate_kbps=%" PRId64 " smoothed_rtt_ms=%" PRId64
- " avg_queue_delay_ms=%" PRId64 " l4s_marked_permille=%u\n",
+ " data_in_flight_bytes=%" PRId64 " target_rate_kbps=%" PRId64
+ " smoothed_rtt_ms=%" PRId64 " avg_queue_delay_ms=%" PRId64
+ " l4s_marked_permille=%u\n",
event.log_time_ms(), event.ref_window.bytes(),
- event.target_rate.kbps(), event.smoothed_rtt.ms(),
- event.avg_queue_delay.ms(), event.l4s_marked_permille);
+ event.data_in_flight.bytes(), event.target_rate.kbps(),
+ event.smoothed_rtt.ms(), event.avg_queue_delay.ms(),
+ event.l4s_marked_permille);
};
auto dtls_transport_state_handler =
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
index 6599a62..0bf97644 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
@@ -1558,15 +1558,21 @@
void EventLogAnalyzer::CreateScreamRefWindowGraph(Plot* plot) const {
TimeSeries ref_window_series("RefWindow", LineStyle::kStep);
-
for (auto& scream_update : parsed_log_.bwe_scream_updates()) {
float x = config_.GetCallTimeSec(scream_update.log_time());
float y = static_cast<float>(scream_update.ref_window.bytes());
ref_window_series.points.emplace_back(x, y);
}
-
plot->AppendTimeSeries(std::move(ref_window_series));
+ TimeSeries data_in_flight_series("Data in flight", LineStyle::kLine);
+ for (auto& scream_update : parsed_log_.bwe_scream_updates()) {
+ float x = config_.GetCallTimeSec(scream_update.log_time());
+ float y = static_cast<float>(scream_update.data_in_flight.bytes());
+ data_in_flight_series.points.emplace_back(x, y);
+ }
+ plot->AppendTimeSeries(std::move(data_in_flight_series));
+
plot->SetXAxis(config_.CallBeginTimeSec(), config_.CallEndTimeSec(),
"Time (s)", kLeftMargin, kRightMargin);
plot->SetSuggestedYAxis(0, 3000, "Bytes", kBottomMargin, kTopMargin);