| 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 |
| 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ | 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ |
| 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ | 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/base/scoped_ptr.h" | 17 #include "webrtc/base/scoped_ptr.h" |
| 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
| 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" | 19 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" |
| 20 | 21 |
| 21 namespace webrtc { | 22 namespace webrtc { |
| 22 namespace testing { | 23 namespace testing { |
| 23 namespace bwe { | 24 namespace bwe { |
| 24 | 25 |
| 25 class PacketReceiver : public PacketProcessor { | 26 class PacketReceiver : public PacketProcessor { |
| 26 public: | 27 public: |
| 27 PacketReceiver(PacketProcessorListener* listener, | 28 PacketReceiver(PacketProcessorListener* listener, |
| 28 int flow_id, | 29 int flow_id, |
| 29 BandwidthEstimatorType bwe_type, | 30 BandwidthEstimatorType bwe_type, |
| 30 bool plot_delay, | 31 bool plot_delay, |
| 31 bool plot_bwe); | 32 bool plot_bwe); |
| 33 PacketReceiver(PacketProcessorListener* listener, |
| 34 int flow_id, |
| 35 BandwidthEstimatorType bwe_type, |
| 36 bool plot_delay, |
| 37 bool plot_bwe, |
| 38 MetricRecorder* metric_recorder); |
| 32 ~PacketReceiver(); | 39 ~PacketReceiver(); |
| 33 | 40 |
| 34 // Implements PacketProcessor. | 41 // Implements PacketProcessor. |
| 35 void RunFor(int64_t time_ms, Packets* in_out) override; | 42 void RunFor(int64_t time_ms, Packets* in_out) override; |
| 36 | 43 |
| 37 void LogStats(); | 44 void LogStats(); |
| 38 | 45 |
| 39 Stats<double> GetDelayStats() const; | 46 Stats<double> GetDelayStats() const; |
| 40 | 47 |
| 48 float GlobalPacketLoss(); |
| 49 |
| 41 protected: | 50 protected: |
| 42 void PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms); | 51 void UpdateMetrics(int64_t arrival_time_ms, |
| 43 void PlotObjectiveFunction(int64_t arrival_time_ms); | 52 int64_t send_time_ms, |
| 44 void PlotPacketLoss(int64_t arrival_time_ms); | 53 size_t payload_size); |
| 45 double ObjectiveFunction(); | |
| 46 | 54 |
| 47 int64_t now_ms_; | |
| 48 std::string delay_log_prefix_; | |
| 49 std::string metric_log_prefix_; | |
| 50 std::string packet_loss_log_prefix_; | |
| 51 int64_t last_delay_plot_ms_; | |
| 52 int64_t last_metric_plot_ms_; | |
| 53 int64_t last_packet_loss_plot_ms_; | |
| 54 bool plot_delay_; | |
| 55 bool plot_objective_function_; | |
| 56 bool plot_packet_loss_; | |
| 57 Stats<double> delay_stats_; | 55 Stats<double> delay_stats_; |
| 58 rtc::scoped_ptr<BweReceiver> bwe_receiver_; | 56 rtc::scoped_ptr<BweReceiver> bwe_receiver_; |
| 59 | 57 |
| 60 int64_t total_delay_ms_; | 58 private: |
| 61 size_t total_throughput_; | 59 MetricRecorder* metric_recorder_; |
| 62 int number_packets_; | |
| 63 | 60 |
| 64 private: | |
| 65 DISALLOW_IMPLICIT_CONSTRUCTORS(PacketReceiver); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(PacketReceiver); |
| 66 }; | 62 }; |
| 67 } // namespace bwe | 63 } // namespace bwe |
| 68 } // namespace testing | 64 } // namespace testing |
| 69 } // namespace webrtc | 65 } // namespace webrtc |
| 70 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ | 66 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_ |
| OLD | NEW |