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 14 matching lines...) Expand all Loading... | |
25 namespace bwe { | 25 namespace bwe { |
26 | 26 |
27 PacketReceiver::PacketReceiver(PacketProcessorListener* listener, | 27 PacketReceiver::PacketReceiver(PacketProcessorListener* listener, |
28 int flow_id, | 28 int flow_id, |
29 BandwidthEstimatorType bwe_type, | 29 BandwidthEstimatorType bwe_type, |
30 bool plot_delay, | 30 bool plot_delay, |
31 bool plot_bwe, | 31 bool plot_bwe, |
32 MetricRecorder* metric_recorder) | 32 MetricRecorder* metric_recorder) |
33 : PacketProcessor(listener, flow_id, kReceiver), | 33 : PacketProcessor(listener, flow_id, kReceiver), |
34 bwe_receiver_(CreateBweReceiver(bwe_type, flow_id, plot_bwe)), | 34 bwe_receiver_(CreateBweReceiver(bwe_type, flow_id, plot_bwe)), |
35 metric_recorder_(metric_recorder) { | 35 metric_recorder_(metric_recorder), |
36 plot_delay_(plot_delay), | |
37 last_delay_plot_ms_(0), | |
38 delay_prefix_("Delay_ms#d") { | |
stefan-webrtc
2015/07/24 09:30:43
What is #d?
magalhaesc
2015/07/24 13:51:40
Replaced with #2, alignment with the right axis.
| |
36 if (metric_recorder_ != nullptr) { | 39 if (metric_recorder_ != nullptr) { |
37 // Setup the prefix ststd::rings used when logging. | 40 // Setup the prefix ststd::rings used when logging. |
38 std::vector<std::string> prefixes; | 41 std::vector<std::string> prefixes; |
39 | 42 |
40 std::stringstream ss1; | 43 prefixes.push_back("Throughput_kbps#2"); // Throughput. |
stefan-webrtc
2015/07/24 09:30:42
I find it odd that this is on #2 and not #1. Could
magalhaesc
2015/07/24 13:51:40
Done, Adopting #1 for left axis alignment.
The fl
stefan-webrtc
2015/07/24 14:06:55
Sounds good
| |
41 ss1 << "Throughput_kbps_" << flow_id << "#2"; | 44 prefixes.push_back("Delay_ms_#2"); // Delay. |
stefan-webrtc
2015/07/24 09:30:42
Should Delay_ms_#2 be the same format as Delay_ms#
magalhaesc
2015/07/24 13:51:40
The metric recorder uses separate figure_id for ea
stefan-webrtc
2015/07/24 14:06:55
Sounds good.
| |
42 prefixes.push_back(ss1.str()); // Throughput. | 45 prefixes.push_back("Packet_Loss_#2"); // Loss. |
43 | 46 prefixes.push_back("Objective_function_#2"); // Objective. |
44 std::stringstream ss2; | |
45 ss2 << "Delay_ms_" << flow_id << "#2"; | |
46 prefixes.push_back(ss2.str()); // Delay. | |
47 | |
48 std::stringstream ss3; | |
49 ss3 << "Packet_Loss_" << flow_id << "#2"; | |
50 prefixes.push_back(ss3.str()); // Loss. | |
51 | |
52 std::stringstream ss4; | |
53 ss4 << "Objective_function_" << flow_id << "#2"; | |
54 prefixes.push_back(ss4.str()); // Objective. | |
55 | 47 |
56 // Plot Total/PerFlow Available capacity together with throughputs. | 48 // Plot Total/PerFlow Available capacity together with throughputs. |
57 std::stringstream ss5; | 49 prefixes.push_back("Throughput_kbps#1"); // Total Available. |
58 ss5 << "Throughput_kbps" << flow_id << "#1"; | 50 prefixes.push_back("Throughput_kbps#1"); // Available per flow. |
59 prefixes.push_back(ss5.str()); // Total Available. | |
60 prefixes.push_back(ss5.str()); // Available per flow. | |
61 | 51 |
62 metric_recorder_->SetPlotInformation(prefixes); | 52 metric_recorder_->SetPlotInformation(prefixes); |
63 } | 53 } |
64 } | 54 } |
65 | 55 |
66 PacketReceiver::PacketReceiver(PacketProcessorListener* listener, | 56 PacketReceiver::PacketReceiver(PacketProcessorListener* listener, |
67 int flow_id, | 57 int flow_id, |
68 BandwidthEstimatorType bwe_type, | 58 BandwidthEstimatorType bwe_type, |
69 bool plot_delay, | 59 bool plot_delay, |
70 bool plot_bwe) | 60 bool plot_bwe) |
(...skipping 24 matching lines...) Expand all Loading... | |
95 // time once packet reaches the estimator. | 85 // time once packet reaches the estimator. |
96 int64_t arrival_time_ms = media_packet->send_time_ms(); | 86 int64_t arrival_time_ms = media_packet->send_time_ms(); |
97 int64_t send_time_ms = media_packet->creation_time_ms(); | 87 int64_t send_time_ms = media_packet->creation_time_ms(); |
98 delay_stats_.Push(arrival_time_ms - send_time_ms); | 88 delay_stats_.Push(arrival_time_ms - send_time_ms); |
99 | 89 |
100 if (metric_recorder_ != nullptr) { | 90 if (metric_recorder_ != nullptr) { |
101 metric_recorder_->UpdateTime(arrival_time_ms); | 91 metric_recorder_->UpdateTime(arrival_time_ms); |
102 UpdateMetrics(arrival_time_ms, send_time_ms, | 92 UpdateMetrics(arrival_time_ms, send_time_ms, |
103 media_packet->payload_size()); | 93 media_packet->payload_size()); |
104 metric_recorder_->PlotAllDynamics(); | 94 metric_recorder_->PlotAllDynamics(); |
95 } else if (plot_delay_) { | |
96 PlotDelay(arrival_time_ms, send_time_ms); | |
105 } | 97 } |
106 | 98 |
107 bwe_receiver_->ReceivePacket(arrival_time_ms, *media_packet); | 99 bwe_receiver_->ReceivePacket(arrival_time_ms, *media_packet); |
108 FeedbackPacket* fb = bwe_receiver_->GetFeedback(arrival_time_ms); | 100 FeedbackPacket* fb = bwe_receiver_->GetFeedback(arrival_time_ms); |
109 if (fb) | 101 if (fb) |
110 feedback.push_back(fb); | 102 feedback.push_back(fb); |
111 delete media_packet; | 103 delete media_packet; |
112 it = in_out->erase(it); | 104 it = in_out->erase(it); |
113 } else { | 105 } else { |
114 ++it; | 106 ++it; |
115 } | 107 } |
116 } | 108 } |
117 // Insert feedback packets to be sent back to the sender. | 109 // Insert feedback packets to be sent back to the sender. |
118 in_out->merge(feedback, DereferencingComparator<Packet>); | 110 in_out->merge(feedback, DereferencingComparator<Packet>); |
119 } | 111 } |
120 | 112 |
121 void PacketReceiver::UpdateMetrics(int64_t arrival_time_ms, | 113 void PacketReceiver::UpdateMetrics(int64_t arrival_time_ms, |
122 int64_t send_time_ms, | 114 int64_t send_time_ms, |
123 size_t payload_size) { | 115 size_t payload_size) { |
124 metric_recorder_->UpdateThroughput(bwe_receiver_->RecentKbps(), payload_size); | 116 metric_recorder_->UpdateThroughput(bwe_receiver_->RecentKbps(), payload_size); |
125 metric_recorder_->UpdateDelay(arrival_time_ms - send_time_ms); | 117 metric_recorder_->UpdateDelay(arrival_time_ms - send_time_ms); |
126 metric_recorder_->UpdateLoss(bwe_receiver_->RecentPacketLossRatio()); | 118 metric_recorder_->UpdateLoss(bwe_receiver_->RecentPacketLossRatio()); |
127 metric_recorder_->UpdateObjective(); | 119 metric_recorder_->UpdateObjective(); |
128 } | 120 } |
129 | 121 |
122 void PacketReceiver::PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms) { | |
123 const int64_t kDelayPlotIntervalMs = 100; | |
124 if (arrival_time_ms >= last_delay_plot_ms_ + kDelayPlotIntervalMs) { | |
125 BWE_TEST_LOGGING_PLOT(0, delay_prefix_, arrival_time_ms, | |
126 arrival_time_ms - send_time_ms); | |
127 last_delay_plot_ms_ = arrival_time_ms; | |
128 } | |
129 } | |
130 | |
130 float PacketReceiver::GlobalPacketLoss() { | 131 float PacketReceiver::GlobalPacketLoss() { |
131 return bwe_receiver_->GlobalReceiverPacketLossRatio(); | 132 return bwe_receiver_->GlobalReceiverPacketLossRatio(); |
132 } | 133 } |
133 | 134 |
134 Stats<double> PacketReceiver::GetDelayStats() const { | 135 Stats<double> PacketReceiver::GetDelayStats() const { |
135 return delay_stats_; | 136 return delay_stats_; |
136 } | 137 } |
137 } // namespace bwe | 138 } // namespace bwe |
138 } // namespace testing | 139 } // namespace testing |
139 } // namespace webrtc | 140 } // namespace webrtc |
OLD | NEW |