Delay based logging.
BUG=none Review-Url: https://codereview.webrtc.org/2808833002 Cr-Commit-Position: refs/heads/master@{#17641}
This commit is contained in:
@ -491,10 +491,8 @@ void ParsedRtcEventLog::GetLossBasedBweUpdate(size_t index,
|
||||
}
|
||||
}
|
||||
|
||||
void ParsedRtcEventLog::GetDelayBasedBweUpdate(
|
||||
size_t index,
|
||||
int32_t* bitrate_bps,
|
||||
BandwidthUsage* detector_state) const {
|
||||
ParsedRtcEventLog::BweDelayBasedUpdate
|
||||
ParsedRtcEventLog::GetDelayBasedBweUpdate(size_t index) const {
|
||||
RTC_CHECK_LT(index, GetNumberOfEvents());
|
||||
const rtclog::Event& event = events_[index];
|
||||
RTC_CHECK(event.has_type());
|
||||
@ -502,14 +500,14 @@ void ParsedRtcEventLog::GetDelayBasedBweUpdate(
|
||||
RTC_CHECK(event.has_delay_based_bwe_update());
|
||||
const rtclog::DelayBasedBweUpdate& delay_event =
|
||||
event.delay_based_bwe_update();
|
||||
|
||||
BweDelayBasedUpdate res;
|
||||
res.timestamp = GetTimestamp(index);
|
||||
RTC_CHECK(delay_event.has_bitrate_bps());
|
||||
if (bitrate_bps != nullptr) {
|
||||
*bitrate_bps = delay_event.bitrate_bps();
|
||||
}
|
||||
res.bitrate_bps = delay_event.bitrate_bps();
|
||||
RTC_CHECK(delay_event.has_detector_state());
|
||||
if (detector_state != nullptr) {
|
||||
*detector_state = GetRuntimeDetectorState(delay_event.detector_state());
|
||||
}
|
||||
res.detector_state = GetRuntimeDetectorState(delay_event.detector_state());
|
||||
return res;
|
||||
}
|
||||
|
||||
void ParsedRtcEventLog::GetAudioNetworkAdaptation(
|
||||
|
||||
@ -50,6 +50,12 @@ class ParsedRtcEventLog {
|
||||
rtc::Optional<ProbeFailureReason> failure_reason;
|
||||
};
|
||||
|
||||
struct BweDelayBasedUpdate {
|
||||
uint64_t timestamp;
|
||||
int32_t bitrate_bps;
|
||||
BandwidthUsage detector_state;
|
||||
};
|
||||
|
||||
enum EventType {
|
||||
UNKNOWN_EVENT = 0,
|
||||
LOG_START = 1,
|
||||
@ -146,9 +152,7 @@ class ParsedRtcEventLog {
|
||||
// and stores the values in the corresponding output parameters. Each output
|
||||
// parameter can be set to nullptr if that
|
||||
// value isn't needed.
|
||||
void GetDelayBasedBweUpdate(size_t index,
|
||||
int32_t* bitrate_bps,
|
||||
BandwidthUsage* detector_state) const;
|
||||
BweDelayBasedUpdate GetDelayBasedBweUpdate(size_t index) const;
|
||||
|
||||
// Reads a audio network adaptation event to a (non-NULL)
|
||||
// AudioEncoderRuntimeConfig struct. Only the fields that are
|
||||
|
||||
@ -539,12 +539,10 @@ void RtcEventLogTestHelper::VerifyBweDelayEvent(
|
||||
GetRuntimeDetectorState(bwe_event.detector_state()));
|
||||
|
||||
// Check consistency of the parser.
|
||||
int32_t parsed_bitrate;
|
||||
BandwidthUsage parsed_detector_state;
|
||||
parsed_log.GetDelayBasedBweUpdate(index, &parsed_bitrate,
|
||||
&parsed_detector_state);
|
||||
EXPECT_EQ(bitrate, parsed_bitrate);
|
||||
EXPECT_EQ(detector_state, parsed_detector_state);
|
||||
ParsedRtcEventLog::BweDelayBasedUpdate res =
|
||||
parsed_log.GetDelayBasedBweUpdate(index);
|
||||
EXPECT_EQ(res.bitrate_bps, bitrate);
|
||||
EXPECT_EQ(res.detector_state, detector_state);
|
||||
}
|
||||
|
||||
void RtcEventLogTestHelper::VerifyAudioNetworkAdaptation(
|
||||
|
||||
@ -467,6 +467,7 @@ EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log)
|
||||
break;
|
||||
}
|
||||
case ParsedRtcEventLog::DELAY_BASED_BWE_UPDATE: {
|
||||
bwe_delay_updates_.push_back(parsed_log_.GetDelayBasedBweUpdate(i));
|
||||
break;
|
||||
}
|
||||
case ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT: {
|
||||
@ -933,13 +934,22 @@ void EventLogAnalyzer::CreateTotalBitrateGraph(
|
||||
|
||||
// Overlay the send-side bandwidth estimate over the outgoing bitrate.
|
||||
if (desired_direction == kOutgoingPacket) {
|
||||
TimeSeries* time_series =
|
||||
TimeSeries* loss_series =
|
||||
plot->AddTimeSeries("Loss-based estimate", LINE_STEP_GRAPH);
|
||||
for (auto& bwe_update : bwe_loss_updates_) {
|
||||
for (auto& loss_update : bwe_loss_updates_) {
|
||||
float x =
|
||||
static_cast<float>(bwe_update.timestamp - begin_time_) / 1000000;
|
||||
float y = static_cast<float>(bwe_update.new_bitrate) / 1000;
|
||||
time_series->points.emplace_back(x, y);
|
||||
static_cast<float>(loss_update.timestamp - begin_time_) / 1000000;
|
||||
float y = static_cast<float>(loss_update.new_bitrate) / 1000;
|
||||
loss_series->points.emplace_back(x, y);
|
||||
}
|
||||
|
||||
TimeSeries* delay_series =
|
||||
plot->AddTimeSeries("Delay-based estimate", LINE_STEP_GRAPH);
|
||||
for (auto& delay_update : bwe_delay_updates_) {
|
||||
float x =
|
||||
static_cast<float>(delay_update.timestamp - begin_time_) / 1000000;
|
||||
float y = static_cast<float>(delay_update.bitrate_bps) / 1000;
|
||||
delay_series->points.emplace_back(x, y);
|
||||
}
|
||||
|
||||
TimeSeries* created_series =
|
||||
|
||||
@ -173,6 +173,8 @@ class EventLogAnalyzer {
|
||||
|
||||
std::vector<ParsedRtcEventLog::BweProbeResultEvent> bwe_probe_result_events_;
|
||||
|
||||
std::vector<ParsedRtcEventLog::BweDelayBasedUpdate> bwe_delay_updates_;
|
||||
|
||||
// Window and step size used for calculating moving averages, e.g. bitrate.
|
||||
// The generated data points will be |step_| microseconds apart.
|
||||
// Only events occuring at most |window_duration_| microseconds before the
|
||||
|
||||
@ -78,7 +78,7 @@ void PythonPlot::Draw() {
|
||||
} else if (series_list_[i].style == DOT_GRAPH) {
|
||||
printf(
|
||||
"plt.plot(x%zu, y%zu, color=rgb_colors[%zu], label=\'%s\', "
|
||||
"marker='.', ls=' ')\n",
|
||||
"marker='o', ls=' ')\n",
|
||||
i, i, i, series_list_[i].label.c_str());
|
||||
} else {
|
||||
printf("raise Exception(\"Unknown graph type\")\n");
|
||||
|
||||
Reference in New Issue
Block a user