OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 last_delay_plot_ms_(0), | 37 last_delay_plot_ms_(0), |
38 // #2 aligns the plot with the right axis. | 38 // #2 aligns the plot with the right axis. |
39 delay_prefix_("Delay_ms#2"), | 39 delay_prefix_("Delay_ms#2"), |
40 bwe_type_(bwe_type) { | 40 bwe_type_(bwe_type) { |
41 if (metric_recorder_ != nullptr) { | 41 if (metric_recorder_ != nullptr) { |
42 // Setup the prefix std::strings used when logging. | 42 // Setup the prefix std::strings used when logging. |
43 std::vector<std::string> prefixes; | 43 std::vector<std::string> prefixes; |
44 | 44 |
45 // Metric recorder plots them in separated figures, | 45 // Metric recorder plots them in separated figures, |
46 // alignment will take place with the #1 left axis. | 46 // alignment will take place with the #1 left axis. |
47 prefixes.push_back("Throughput_kbps#1"); // Throughput. | 47 prefixes.push_back("Throughput_kbps#1"); |
48 prefixes.push_back("Delay_ms_#1"); // Delay. | 48 prefixes.push_back("Sending_Estimate_kbps#1"); |
49 prefixes.push_back("Packet_Loss_#1"); // Loss. | 49 prefixes.push_back("Delay_ms_#1"); |
50 prefixes.push_back("Objective_function_#1"); // Objective. | 50 prefixes.push_back("Packet_Loss_#1"); |
| 51 prefixes.push_back("Objective_function_#1"); |
51 | 52 |
52 // Plot Total/PerFlow Available capacity together with throughputs. | 53 // Plot Total/PerFlow Available capacity together with throughputs. |
53 prefixes.push_back("Throughput_kbps#1"); // Total Available. | 54 prefixes.push_back("Throughput_kbps#1"); // Total Available. |
54 prefixes.push_back("Throughput_kbps#1"); // Available per flow. | 55 prefixes.push_back("Throughput_kbps#1"); // Available per flow. |
55 | 56 |
56 bool plot_loss = plot_delay; // Plot loss if delay is plotted. | 57 bool plot_loss = plot_delay; // Plot loss if delay is plotted. |
57 metric_recorder_->SetPlotInformation(prefixes, plot_delay, plot_loss); | 58 metric_recorder_->SetPlotInformation(prefixes, plot_delay, plot_loss); |
58 } | 59 } |
59 } | 60 } |
60 | 61 |
(...skipping 25 matching lines...) Expand all Loading... |
86 (*it)->flow_id() == *flow_ids().begin()) { | 87 (*it)->flow_id() == *flow_ids().begin()) { |
87 BWE_TEST_LOGGING_CONTEXT(*flow_ids().begin()); | 88 BWE_TEST_LOGGING_CONTEXT(*flow_ids().begin()); |
88 const MediaPacket* media_packet = static_cast<const MediaPacket*>(*it); | 89 const MediaPacket* media_packet = static_cast<const MediaPacket*>(*it); |
89 // We're treating the send time (from previous filter) as the arrival | 90 // We're treating the send time (from previous filter) as the arrival |
90 // time once packet reaches the estimator. | 91 // time once packet reaches the estimator. |
91 int64_t arrival_time_ms = media_packet->send_time_ms(); | 92 int64_t arrival_time_ms = media_packet->send_time_ms(); |
92 int64_t send_time_ms = media_packet->creation_time_ms(); | 93 int64_t send_time_ms = media_packet->creation_time_ms(); |
93 delay_stats_.Push(arrival_time_ms - send_time_ms); | 94 delay_stats_.Push(arrival_time_ms - send_time_ms); |
94 | 95 |
95 if (metric_recorder_ != nullptr) { | 96 if (metric_recorder_ != nullptr) { |
96 metric_recorder_->UpdateTime(arrival_time_ms); | 97 metric_recorder_->UpdateTimeMs(arrival_time_ms); |
97 UpdateMetrics(arrival_time_ms, send_time_ms, | 98 UpdateMetrics(arrival_time_ms, send_time_ms, |
98 media_packet->payload_size()); | 99 media_packet->payload_size()); |
99 metric_recorder_->PlotAllDynamics(); | 100 metric_recorder_->PlotAllDynamics(); |
100 } else if (plot_delay_) { | 101 } else if (plot_delay_) { |
101 PlotDelay(arrival_time_ms, send_time_ms); | 102 PlotDelay(arrival_time_ms, send_time_ms); |
102 } | 103 } |
103 | 104 |
104 bwe_receiver_->ReceivePacket(arrival_time_ms, *media_packet); | 105 bwe_receiver_->ReceivePacket(arrival_time_ms, *media_packet); |
105 FeedbackPacket* fb = bwe_receiver_->GetFeedback(arrival_time_ms); | 106 FeedbackPacket* fb = bwe_receiver_->GetFeedback(arrival_time_ms); |
106 if (fb) | 107 if (fb) |
107 feedback.push_back(fb); | 108 feedback.push_back(fb); |
108 delete media_packet; | 109 delete media_packet; |
109 it = in_out->erase(it); | 110 it = in_out->erase(it); |
110 } else { | 111 } else { |
111 ++it; | 112 ++it; |
112 } | 113 } |
113 } | 114 } |
114 // Insert feedback packets to be sent back to the sender. | 115 // Insert feedback packets to be sent back to the sender. |
115 in_out->merge(feedback, DereferencingComparator<Packet>); | 116 in_out->merge(feedback, DereferencingComparator<Packet>); |
116 } | 117 } |
117 | 118 |
118 void PacketReceiver::UpdateMetrics(int64_t arrival_time_ms, | 119 void PacketReceiver::UpdateMetrics(int64_t arrival_time_ms, |
119 int64_t send_time_ms, | 120 int64_t send_time_ms, |
120 size_t payload_size) { | 121 size_t payload_size) { |
121 metric_recorder_->UpdateThroughput(bwe_receiver_->RecentKbps(), payload_size); | 122 metric_recorder_->UpdateThroughput(bwe_receiver_->RecentKbps(), payload_size); |
122 metric_recorder_->UpdateDelay(arrival_time_ms - send_time_ms); | 123 metric_recorder_->UpdateDelayMs(arrival_time_ms - send_time_ms); |
123 metric_recorder_->UpdateLoss(bwe_receiver_->RecentPacketLossRatio()); | 124 metric_recorder_->UpdateLoss(bwe_receiver_->RecentPacketLossRatio()); |
124 metric_recorder_->UpdateObjective(); | 125 metric_recorder_->UpdateObjective(); |
125 } | 126 } |
126 | 127 |
127 void PacketReceiver::PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms) { | 128 void PacketReceiver::PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms) { |
128 const int64_t kDelayPlotIntervalMs = 100; | 129 const int64_t kDelayPlotIntervalMs = 100; |
129 if (arrival_time_ms >= last_delay_plot_ms_ + kDelayPlotIntervalMs) { | 130 if (arrival_time_ms >= last_delay_plot_ms_ + kDelayPlotIntervalMs) { |
130 BWE_TEST_LOGGING_PLOT_WITH_NAME(0, delay_prefix_, arrival_time_ms, | 131 BWE_TEST_LOGGING_PLOT_WITH_NAME(0, delay_prefix_, arrival_time_ms, |
131 arrival_time_ms - send_time_ms, | 132 arrival_time_ms - send_time_ms, |
132 bwe_names[bwe_type_]); | 133 bwe_names[bwe_type_]); |
133 last_delay_plot_ms_ = arrival_time_ms; | 134 last_delay_plot_ms_ = arrival_time_ms; |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 float PacketReceiver::GlobalPacketLoss() { | 138 float PacketReceiver::GlobalPacketLoss() { |
138 return bwe_receiver_->GlobalReceiverPacketLossRatio(); | 139 return bwe_receiver_->GlobalReceiverPacketLossRatio(); |
139 } | 140 } |
140 | 141 |
141 Stats<double> PacketReceiver::GetDelayStats() const { | 142 Stats<double> PacketReceiver::GetDelayStats() const { |
142 return delay_stats_; | 143 return delay_stats_; |
143 } | 144 } |
144 } // namespace bwe | 145 } // namespace bwe |
145 } // namespace testing | 146 } // namespace testing |
146 } // namespace webrtc | 147 } // namespace webrtc |
OLD | NEW |