Chromium Code Reviews| Index: webrtc/modules/congestion_controller/delay_based_bandwidth_estimator.h |
| diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h b/webrtc/modules/congestion_controller/delay_based_bandwidth_estimator.h |
| similarity index 67% |
| copy from webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h |
| copy to webrtc/modules/congestion_controller/delay_based_bandwidth_estimator.h |
| index a6119091ce75f965c69e145dd53555aeafd58383..244fb7261212786bd503e1926f6b15b325a0fe34 100644 |
| --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h |
| +++ b/webrtc/modules/congestion_controller/delay_based_bandwidth_estimator.h |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| + * Copyright (c) 2016 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 |
| @@ -8,8 +8,8 @@ |
| * be found in the AUTHORS file in the root of the source tree. |
| */ |
| -#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_BITRATE_ESTIMATOR_ABS_SEND_TIME_H_ |
| -#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_BITRATE_ESTIMATOR_ABS_SEND_TIME_H_ |
| +#ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BANDWIDTH_ESTIMATOR_H_ |
| +#define WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BANDWIDTH_ESTIMATOR_H_ |
| #include <list> |
| #include <map> |
| @@ -30,46 +30,10 @@ |
| namespace webrtc { |
| -struct Probe { |
| - Probe(int64_t send_time_ms, int64_t recv_time_ms, size_t payload_size) |
| - : send_time_ms(send_time_ms), |
| - recv_time_ms(recv_time_ms), |
| - payload_size(payload_size) {} |
| - int64_t send_time_ms; |
| - int64_t recv_time_ms; |
| - size_t payload_size; |
| -}; |
| - |
| -struct Cluster { |
| - Cluster() |
| - : send_mean_ms(0.0f), |
| - recv_mean_ms(0.0f), |
| - mean_size(0), |
| - count(0), |
| - num_above_min_delta(0) {} |
| - |
| - int GetSendBitrateBps() const { |
| - RTC_CHECK_GT(send_mean_ms, 0.0f); |
| - return mean_size * 8 * 1000 / send_mean_ms; |
| - } |
| - |
| - int GetRecvBitrateBps() const { |
| - RTC_CHECK_GT(recv_mean_ms, 0.0f); |
| - return mean_size * 8 * 1000 / recv_mean_ms; |
| - } |
| - |
| - float send_mean_ms; |
| - float recv_mean_ms; |
| - // TODO(holmer): Add some variance metric as well? |
| - size_t mean_size; |
| - int count; |
| - int num_above_min_delta; |
| -}; |
| - |
| -class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { |
| +class DelayBasedBwe : public RemoteBitrateEstimator { |
|
danilchap
2016/06/03 16:25:29
it is easiser to follow code when class name match
philipel
2016/06/08 11:46:38
Renamed files to delay_based_bwe.cc/h.
|
| public: |
| - explicit RemoteBitrateEstimatorAbsSendTime(RemoteBitrateObserver* observer); |
| - virtual ~RemoteBitrateEstimatorAbsSendTime() {} |
| + explicit DelayBasedBwe(RemoteBitrateObserver* observer); |
| + virtual ~DelayBasedBwe() {} |
| void IncomingPacketFeedbackVector( |
| const std::vector<PacketInfo>& packet_feedback_vector) override; |
| @@ -91,19 +55,58 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { |
| void SetMinBitrate(int min_bitrate_bps) override; |
| private: |
| + struct Probe { |
| + Probe(int64_t send_time_ms, |
| + int64_t recv_time_ms, |
| + size_t payload_size, |
| + int probe_cluster_id) |
| + : send_time_ms(send_time_ms), |
| + recv_time_ms(recv_time_ms), |
| + payload_size(payload_size), |
| + probe_cluster_id(probe_cluster_id) {} |
| + int64_t send_time_ms; |
| + int64_t recv_time_ms; |
| + size_t payload_size; |
| + int probe_cluster_id; |
|
danilchap
2016/06/03 16:25:29
this code (specially this struct) already knows it
philipel
2016/06/08 11:46:38
Done.
|
| + }; |
| + |
| + struct Cluster { |
|
danilchap
2016/06/03 16:25:28
Probe can't be easily forward-declared, but Cluste
philipel
2016/06/08 11:46:38
I would keep them grouped rather than to have one
|
| + Cluster() |
| + : send_mean_ms(0.0f), |
| + recv_mean_ms(0.0f), |
| + mean_size(0), |
| + count(0), |
| + num_above_min_delta(0) {} |
| + |
| + int GetSendBitrateBps() const { |
| + RTC_CHECK_GT(send_mean_ms, 0.0f); |
| + return mean_size * 8 * 1000 / send_mean_ms; |
| + } |
| + |
| + int GetRecvBitrateBps() const { |
| + RTC_CHECK_GT(recv_mean_ms, 0.0f); |
| + return mean_size * 8 * 1000 / recv_mean_ms; |
| + } |
| + |
| + float send_mean_ms; |
| + float recv_mean_ms; |
| + // TODO(holmer): Add some variance metric as well? |
| + size_t mean_size; |
| + int count; |
| + int num_above_min_delta; |
| + }; |
| + |
| typedef std::map<uint32_t, int64_t> Ssrcs; |
| enum class ProbeResult { kBitrateUpdated, kNoUpdate }; |
| - static bool IsWithinClusterBounds(int send_delta_ms, |
| - const Cluster& cluster_aggregate); |
| - |
| static void AddCluster(std::list<Cluster>* clusters, Cluster* cluster); |
| void IncomingPacketInfo(int64_t arrival_time_ms, |
| uint32_t send_time_24bits, |
| size_t payload_size, |
| uint32_t ssrc, |
| - bool was_paced); |
| + bool was_paced, |
| + int probe_cluster_id); |
| void ComputeClusters(std::list<Cluster>* clusters) const; |
| @@ -135,9 +138,9 @@ class RemoteBitrateEstimatorAbsSendTime : public RemoteBitrateEstimator { |
| Ssrcs ssrcs_ GUARDED_BY(&crit_); |
| AimdRateControl remote_rate_ GUARDED_BY(&crit_); |
| - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RemoteBitrateEstimatorAbsSendTime); |
| + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); |
| }; |
| } // namespace webrtc |
| -#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_BITRATE_ESTIMATOR_ABS_SEND_TIME_H_ |
| +#endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BANDWIDTH_ESTIMATOR_H_ |