2012-06-05 12:25:35 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 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_OVERUSE_DETECTOR_H_
|
|
|
|
|
#define MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_
|
2012-06-05 12:25:35 +00:00
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/include/module_common_types.h"
|
|
|
|
|
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
|
|
|
|
#include "rtc_base/constructormagic.h"
|
2012-06-05 12:25:35 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-02-16 18:22:21 +01:00
|
|
|
bool AdaptiveThresholdExperimentIsDisabled();
|
2015-07-07 04:20:34 -07:00
|
|
|
|
2012-09-21 13:20:21 +00:00
|
|
|
class OveruseDetector {
|
2012-06-05 12:25:35 +00:00
|
|
|
public:
|
2016-12-27 10:43:01 -08:00
|
|
|
OveruseDetector();
|
2015-07-07 04:20:34 -07:00
|
|
|
virtual ~OveruseDetector();
|
2012-06-05 12:25:35 +00:00
|
|
|
|
2014-12-04 15:34:06 +00:00
|
|
|
// Update the detection state based on the estimated inter-arrival time delta
|
|
|
|
|
// offset. |timestamp_delta| is the delta between the last timestamp which the
|
|
|
|
|
// estimated offset is based on and the last timestamp on which the last
|
|
|
|
|
// offset was based on, representing the time between detector updates.
|
|
|
|
|
// |num_of_deltas| is the number of deltas the offset estimate is based on.
|
|
|
|
|
// Returns the state after the detection update.
|
2015-04-10 10:35:30 +02:00
|
|
|
BandwidthUsage Detect(double offset,
|
|
|
|
|
double timestamp_delta,
|
|
|
|
|
int num_of_deltas,
|
|
|
|
|
int64_t now_ms);
|
2012-10-29 16:06:08 +00:00
|
|
|
|
2014-12-04 15:34:06 +00:00
|
|
|
// Returns the current detector state.
|
|
|
|
|
BandwidthUsage State() const;
|
2012-09-21 13:20:21 +00:00
|
|
|
|
2014-12-04 15:34:06 +00:00
|
|
|
private:
|
2015-07-07 04:20:34 -07:00
|
|
|
void UpdateThreshold(double modified_offset, int64_t now_ms);
|
|
|
|
|
void InitializeExperiment();
|
|
|
|
|
|
2016-02-16 18:22:21 +01:00
|
|
|
bool in_experiment_;
|
2015-07-07 04:20:34 -07:00
|
|
|
double k_up_;
|
|
|
|
|
double k_down_;
|
|
|
|
|
double overusing_time_threshold_;
|
2012-06-05 12:25:35 +00:00
|
|
|
double threshold_;
|
2015-07-07 04:20:34 -07:00
|
|
|
int64_t last_update_ms_;
|
2012-06-26 10:47:04 +00:00
|
|
|
double prev_offset_;
|
|
|
|
|
double time_over_using_;
|
2014-12-04 15:34:06 +00:00
|
|
|
int overuse_counter_;
|
2012-06-05 12:25:35 +00:00
|
|
|
BandwidthUsage hypothesis_;
|
2014-12-04 15:34:06 +00:00
|
|
|
|
2015-09-16 05:37:44 -07:00
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(OveruseDetector);
|
2012-06-05 12:25:35 +00:00
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_REMOTE_BITRATE_ESTIMATOR_OVERUSE_DETECTOR_H_
|