Index: webrtc/modules/remote_bitrate_estimator/test/bwe.h |
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe.h b/webrtc/modules/remote_bitrate_estimator/test/bwe.h |
index d059871488bec092c836bf9692c34bdcc4f2c06f..72840e16cf7a6278d4a8e9c5d727ee9ce875f83c 100644 |
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe.h |
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe.h |
@@ -15,6 +15,7 @@ |
#include "webrtc/modules/remote_bitrate_estimator/test/packet.h" |
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
+#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h" |
namespace webrtc { |
namespace testing { |
@@ -66,9 +67,15 @@ class LinkedSet { |
uint16_t find_min() { return map_.begin()->first; } |
// Gets the lowest saved sequence number that is >= than the input key. |
uint16_t lower_bound(uint16_t key) { return map_.lower_bound(key)->first; } |
- // Gets the highest saved sequence number that is <= than the input key. |
- uint16_t upper_bound(uint16_t key) { return map_.upper_bound(key)->first; } |
+ // Gets the highest saved sequence number that is < than the input key. |
+ uint16_t upper_bound(uint16_t key) { |
stefan-webrtc
2015/06/25 14:44:04
Isn't it very confusing to call this upper_bound n
magalhaesc
2015/07/01 12:48:40
I agree.
For a set containing values {2, 1, 0, 65
|
+ return (--map_.lower_bound(key))->first; |
+ } |
size_t capacity() { return capacity_; } |
+ void Clear() { |
+ map_.clear(); |
+ list_.clear(); |
+ } |
private: |
// Pop oldest element from the back of the list and remove it from the map. |
@@ -80,17 +87,23 @@ class LinkedSet { |
std::list<PacketIdentifierNode*> list_; |
}; |
-const int kMinBitrateKbps = 150; |
-const int kMaxBitrateKbps = 3000; |
+const int kMinBitrateKbps = 50; |
+const int kMaxBitrateKbps = 2500; |
class BweSender : public Module { |
public: |
- BweSender() {} |
+ BweSender() : running_(true) {} |
virtual ~BweSender() {} |
virtual int GetFeedbackIntervalMs() const = 0; |
virtual void GiveFeedback(const FeedbackPacket& feedback) = 0; |
virtual void OnPacketsSent(const Packets& packets) = 0; |
+ virtual void Pause(); |
+ virtual void Resume(); |
+ |
+ protected: |
+ bool running_; |
+ int bitrate_kbps_; |
private: |
DISALLOW_COPY_AND_ASSIGN(BweSender); |
@@ -105,26 +118,42 @@ class BweReceiver { |
const MediaPacket& media_packet) {} |
virtual FeedbackPacket* GetFeedback(int64_t now_ms) { return NULL; } |
- float GlobalPacketLossRatio(); |
+ float GlobalReceiverPacketLossRatio(); |
+ float LinkedSetPacketLossRatio(); |
stefan-webrtc
2015/06/25 14:44:03
It's not clear what this is supposed to be used fo
stefan-webrtc
2015/06/25 14:44:04
Should be private I think? Maybe other methods as
magalhaesc
2015/07/01 12:48:40
The only difference is the amount of packets consi
magalhaesc
2015/07/01 12:48:40
Yes, some methods are private now.
|
float RecentPacketLossRatio(); |
+ size_t RecentReceivingRate(); |
+ uint32_t RecentKbps() { |
+ return (rate_counter_.bits_per_second() + 500) / 1000; |
+ } |
stefan-webrtc
2015/06/25 14:44:03
Do we need both RecentKbps and RecentReceivingRate
magalhaesc
2015/07/01 12:48:39
No, we don't.
RecentReceivingRate will be removed.
|
size_t GetSetCapacity() { return received_packets_.capacity(); } |
+ void UpdateLossAccount(); |
stefan-webrtc
2015/06/25 14:44:04
Just UpdateLoss()
magalhaesc
2015/07/01 12:48:40
Done.
|
+ void ClearSet(); |
static const int64_t kPacketLossTimeWindowMs = 500; |
+ static const int64_t kReceivingRateTimeWindowMs = 1000; |
+ |
+ // Used for calculating global packet loss ratio. |
+ uint32_t num_previous_total_packets_; |
+ uint32_t num_previous_lost_packets_; |
protected: |
int flow_id_; |
// Deals with packets sent more than once. |
LinkedSet received_packets_; |
+ // Used for calculating recent receiving rate. |
+ RateCounter rate_counter_; |
}; |
enum BandwidthEstimatorType { |
- kNullEstimator, |
+ kNullEstimator = 0, |
kNadaEstimator, |
kRembEstimator, |
kFullSendSideEstimator, |
kTcpEstimator |
}; |
+const std::string bwe_names[] = {"Null", "NADA", "REMB", "GCC", "TCP"}; |
+ |
int64_t GetAbsSendTimeInMs(uint32_t abs_send_time); |
BweSender* CreateBweSender(BandwidthEstimatorType estimator, |