2015-02-16 12:02:20 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_
|
|
|
|
|
#define MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_
|
2015-02-16 12:02:20 +00:00
|
|
|
|
2016-03-01 05:32:29 -08:00
|
|
|
#include <memory>
|
2015-02-16 12:02:20 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/remote_bitrate_estimator/test/bwe.h"
|
|
|
|
|
#include "modules/remote_bitrate_estimator/test/bwe_test_framework.h"
|
|
|
|
|
#include "modules/remote_bitrate_estimator/test/metric_recorder.h"
|
|
|
|
|
#include "rtc_base/constructormagic.h"
|
2015-02-16 12:02:20 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace testing {
|
|
|
|
|
namespace bwe {
|
|
|
|
|
|
|
|
|
|
class PacketReceiver : public PacketProcessor {
|
|
|
|
|
public:
|
|
|
|
|
PacketReceiver(PacketProcessorListener* listener,
|
|
|
|
|
int flow_id,
|
|
|
|
|
BandwidthEstimatorType bwe_type,
|
|
|
|
|
bool plot_delay,
|
|
|
|
|
bool plot_bwe);
|
2015-07-15 16:31:18 +02:00
|
|
|
PacketReceiver(PacketProcessorListener* listener,
|
|
|
|
|
int flow_id,
|
|
|
|
|
BandwidthEstimatorType bwe_type,
|
|
|
|
|
bool plot_delay,
|
|
|
|
|
bool plot_bwe,
|
|
|
|
|
MetricRecorder* metric_recorder);
|
2018-07-18 15:37:01 +02:00
|
|
|
~PacketReceiver() override;
|
2015-02-16 12:02:20 +00:00
|
|
|
|
|
|
|
|
// Implements PacketProcessor.
|
2015-03-04 12:58:35 +00:00
|
|
|
void RunFor(int64_t time_ms, Packets* in_out) override;
|
2015-02-16 12:02:20 +00:00
|
|
|
|
|
|
|
|
void LogStats();
|
|
|
|
|
|
2015-04-29 14:27:35 +02:00
|
|
|
Stats<double> GetDelayStats() const;
|
|
|
|
|
|
2015-07-15 16:31:18 +02:00
|
|
|
float GlobalPacketLoss();
|
|
|
|
|
|
2015-02-16 12:02:20 +00:00
|
|
|
protected:
|
2015-07-15 16:31:18 +02:00
|
|
|
void UpdateMetrics(int64_t arrival_time_ms,
|
|
|
|
|
int64_t send_time_ms,
|
|
|
|
|
size_t payload_size);
|
2015-02-16 12:02:20 +00:00
|
|
|
|
2015-04-29 14:27:35 +02:00
|
|
|
Stats<double> delay_stats_;
|
2016-03-01 05:32:29 -08:00
|
|
|
std::unique_ptr<BweReceiver> bwe_receiver_;
|
2015-02-16 12:02:20 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-07-26 01:44:52 +02:00
|
|
|
void PlotDelay(int64_t arrival_time_ms, int64_t send_time_ms);
|
2015-07-15 16:31:18 +02:00
|
|
|
MetricRecorder* metric_recorder_;
|
2015-07-26 01:44:52 +02:00
|
|
|
bool plot_delay_; // Used in case there isn't a metric recorder.
|
|
|
|
|
int64_t last_delay_plot_ms_;
|
|
|
|
|
std::string delay_prefix_;
|
|
|
|
|
BandwidthEstimatorType bwe_type_;
|
2015-07-15 16:31:18 +02:00
|
|
|
|
2015-09-16 05:37:44 -07:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PacketReceiver);
|
2015-02-16 12:02:20 +00:00
|
|
|
};
|
|
|
|
|
} // namespace bwe
|
|
|
|
|
} // namespace testing
|
|
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_PACKET_RECEIVER_H_
|