Change all system clock types to int64_t in bitrate_controller.
They are both compared to int64_t types inside the class, and is being called with int64_t types. Could possibly cause bugs. R=pbos@webrtc.org Review URL: https://webrtc-codereview.appspot.com/33529004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7832 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
fcbe36a1d9
commit
edeea91803
@ -27,7 +27,7 @@ class BitrateControllerImpl::RtcpBandwidthObserverImpl
|
|||||||
virtual ~RtcpBandwidthObserverImpl() {
|
virtual ~RtcpBandwidthObserverImpl() {
|
||||||
}
|
}
|
||||||
// Received RTCP REMB or TMMBR.
|
// Received RTCP REMB or TMMBR.
|
||||||
virtual void OnReceivedEstimatedBitrate(const uint32_t bitrate) OVERRIDE {
|
virtual void OnReceivedEstimatedBitrate(uint32_t bitrate) OVERRIDE {
|
||||||
owner_->OnReceivedEstimatedBitrate(bitrate);
|
owner_->OnReceivedEstimatedBitrate(bitrate);
|
||||||
}
|
}
|
||||||
// Received RTCP receiver block.
|
// Received RTCP receiver block.
|
||||||
@ -126,9 +126,9 @@ BitrateControllerImpl::FindObserverConfigurationPair(const BitrateObserver*
|
|||||||
|
|
||||||
void BitrateControllerImpl::SetBitrateObserver(
|
void BitrateControllerImpl::SetBitrateObserver(
|
||||||
BitrateObserver* observer,
|
BitrateObserver* observer,
|
||||||
const uint32_t start_bitrate,
|
uint32_t start_bitrate,
|
||||||
const uint32_t min_bitrate,
|
uint32_t min_bitrate,
|
||||||
const uint32_t max_bitrate) {
|
uint32_t max_bitrate) {
|
||||||
CriticalSectionScoped cs(critsect_);
|
CriticalSectionScoped cs(critsect_);
|
||||||
|
|
||||||
BitrateObserverConfList::iterator it = FindObserverConfigurationPair(
|
BitrateObserverConfList::iterator it = FindObserverConfigurationPair(
|
||||||
@ -217,7 +217,7 @@ void BitrateControllerImpl::SetReservedBitrate(uint32_t reserved_bitrate_bps) {
|
|||||||
MaybeTriggerOnNetworkChanged();
|
MaybeTriggerOnNetworkChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitrateControllerImpl::OnReceivedEstimatedBitrate(const uint32_t bitrate) {
|
void BitrateControllerImpl::OnReceivedEstimatedBitrate(uint32_t bitrate) {
|
||||||
CriticalSectionScoped cs(critsect_);
|
CriticalSectionScoped cs(critsect_);
|
||||||
bandwidth_estimation_.UpdateReceiverEstimate(bitrate);
|
bandwidth_estimation_.UpdateReceiverEstimate(bitrate);
|
||||||
MaybeTriggerOnNetworkChanged();
|
MaybeTriggerOnNetworkChanged();
|
||||||
@ -244,10 +244,10 @@ int32_t BitrateControllerImpl::Process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BitrateControllerImpl::OnReceivedRtcpReceiverReport(
|
void BitrateControllerImpl::OnReceivedRtcpReceiverReport(
|
||||||
const uint8_t fraction_loss,
|
uint8_t fraction_loss,
|
||||||
const uint32_t rtt,
|
uint32_t rtt,
|
||||||
const int number_of_packets,
|
int number_of_packets,
|
||||||
const uint32_t now_ms) {
|
int64_t now_ms) {
|
||||||
CriticalSectionScoped cs(critsect_);
|
CriticalSectionScoped cs(critsect_);
|
||||||
bandwidth_estimation_.UpdateReceiverBlock(
|
bandwidth_estimation_.UpdateReceiverBlock(
|
||||||
fraction_loss, rtt, number_of_packets, now_ms);
|
fraction_loss, rtt, number_of_packets, now_ms);
|
||||||
@ -277,9 +277,9 @@ void BitrateControllerImpl::MaybeTriggerOnNetworkChanged() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitrateControllerImpl::OnNetworkChanged(const uint32_t bitrate,
|
void BitrateControllerImpl::OnNetworkChanged(uint32_t bitrate,
|
||||||
const uint8_t fraction_loss,
|
uint8_t fraction_loss,
|
||||||
const uint32_t rtt) {
|
uint32_t rtt) {
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
if (bitrate_observers_.empty())
|
if (bitrate_observers_.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -37,9 +37,9 @@ class BitrateControllerImpl : public BitrateController {
|
|||||||
virtual RtcpBandwidthObserver* CreateRtcpBandwidthObserver() OVERRIDE;
|
virtual RtcpBandwidthObserver* CreateRtcpBandwidthObserver() OVERRIDE;
|
||||||
|
|
||||||
virtual void SetBitrateObserver(BitrateObserver* observer,
|
virtual void SetBitrateObserver(BitrateObserver* observer,
|
||||||
const uint32_t start_bitrate,
|
uint32_t start_bitrate,
|
||||||
const uint32_t min_bitrate,
|
uint32_t min_bitrate,
|
||||||
const uint32_t max_bitrate) OVERRIDE;
|
uint32_t max_bitrate) OVERRIDE;
|
||||||
|
|
||||||
virtual void RemoveBitrateObserver(BitrateObserver* observer) OVERRIDE;
|
virtual void RemoveBitrateObserver(BitrateObserver* observer) OVERRIDE;
|
||||||
|
|
||||||
@ -80,18 +80,18 @@ class BitrateControllerImpl : public BitrateController {
|
|||||||
void UpdateMinMaxBitrate() EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
void UpdateMinMaxBitrate() EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||||
|
|
||||||
// Called by BitrateObserver's direct from the RTCP module.
|
// Called by BitrateObserver's direct from the RTCP module.
|
||||||
void OnReceivedEstimatedBitrate(const uint32_t bitrate);
|
void OnReceivedEstimatedBitrate(uint32_t bitrate);
|
||||||
|
|
||||||
void OnReceivedRtcpReceiverReport(const uint8_t fraction_loss,
|
void OnReceivedRtcpReceiverReport(uint8_t fraction_loss,
|
||||||
const uint32_t rtt,
|
uint32_t rtt,
|
||||||
const int number_of_packets,
|
int number_of_packets,
|
||||||
const uint32_t now_ms);
|
int64_t now_ms);
|
||||||
|
|
||||||
void MaybeTriggerOnNetworkChanged() EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
void MaybeTriggerOnNetworkChanged() EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||||
|
|
||||||
void OnNetworkChanged(const uint32_t bitrate,
|
void OnNetworkChanged(uint32_t bitrate,
|
||||||
const uint8_t fraction_loss, // 0 - 255.
|
uint8_t fraction_loss, // 0 - 255.
|
||||||
const uint32_t rtt)
|
uint32_t rtt)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
EXCLUSIVE_LOCKS_REQUIRED(*critsect_);
|
||||||
|
|
||||||
void NormalRateAllocation(uint32_t bitrate,
|
void NormalRateAllocation(uint32_t bitrate,
|
||||||
@ -113,7 +113,7 @@ class BitrateControllerImpl : public BitrateController {
|
|||||||
|
|
||||||
// Used by process thread.
|
// Used by process thread.
|
||||||
Clock* clock_;
|
Clock* clock_;
|
||||||
uint32_t last_bitrate_update_ms_;
|
int64_t last_bitrate_update_ms_;
|
||||||
|
|
||||||
CriticalSectionWrapper* critsect_;
|
CriticalSectionWrapper* critsect_;
|
||||||
SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(*critsect_);
|
SendSideBandwidthEstimation bandwidth_estimation_ GUARDED_BY(*critsect_);
|
||||||
|
@ -43,9 +43,9 @@ class TestBitrateObserver: public BitrateObserver {
|
|||||||
last_rtt_(0) {
|
last_rtt_(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnNetworkChanged(const uint32_t bitrate,
|
virtual void OnNetworkChanged(uint32_t bitrate,
|
||||||
const uint8_t fraction_loss,
|
uint8_t fraction_loss,
|
||||||
const uint32_t rtt) {
|
uint32_t rtt) {
|
||||||
last_bitrate_ = bitrate;
|
last_bitrate_ = bitrate;
|
||||||
last_fraction_loss_ = fraction_loss;
|
last_fraction_loss_ = fraction_loss;
|
||||||
last_rtt_ = rtt;
|
last_rtt_ = rtt;
|
||||||
|
@ -29,9 +29,9 @@ class BitrateObserver {
|
|||||||
* per second.
|
* per second.
|
||||||
*/
|
*/
|
||||||
public:
|
public:
|
||||||
virtual void OnNetworkChanged(const uint32_t target_bitrate,
|
virtual void OnNetworkChanged(uint32_t target_bitrate,
|
||||||
const uint8_t fraction_loss, // 0 - 255.
|
uint8_t fraction_loss, // 0 - 255.
|
||||||
const uint32_t rtt) = 0;
|
uint32_t rtt) = 0;
|
||||||
|
|
||||||
virtual ~BitrateObserver() {}
|
virtual ~BitrateObserver() {}
|
||||||
};
|
};
|
||||||
@ -67,9 +67,9 @@ class BitrateController : public Module {
|
|||||||
* max_bitrate_kit = 0 equals no max bitrate.
|
* max_bitrate_kit = 0 equals no max bitrate.
|
||||||
*/
|
*/
|
||||||
virtual void SetBitrateObserver(BitrateObserver* observer,
|
virtual void SetBitrateObserver(BitrateObserver* observer,
|
||||||
const uint32_t start_bitrate,
|
uint32_t start_bitrate,
|
||||||
const uint32_t min_bitrate,
|
uint32_t min_bitrate,
|
||||||
const uint32_t max_bitrate) = 0;
|
uint32_t max_bitrate) = 0;
|
||||||
|
|
||||||
virtual void RemoveBitrateObserver(BitrateObserver* observer) = 0;
|
virtual void RemoveBitrateObserver(BitrateObserver* observer) = 0;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void SendSideBandwidthEstimation::UpdateReceiverEstimate(uint32_t bandwidth) {
|
|||||||
void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
|
void SendSideBandwidthEstimation::UpdateReceiverBlock(uint8_t fraction_loss,
|
||||||
uint32_t rtt,
|
uint32_t rtt,
|
||||||
int number_of_packets,
|
int number_of_packets,
|
||||||
uint32_t now_ms) {
|
int64_t now_ms) {
|
||||||
if (first_report_time_ms_ == -1)
|
if (first_report_time_ms_ == -1)
|
||||||
first_report_time_ms_ = now_ms;
|
first_report_time_ms_ = now_ms;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void SendSideBandwidthEstimation::UpdateUmaStats(int64_t now_ms,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendSideBandwidthEstimation::UpdateEstimate(uint32_t now_ms) {
|
void SendSideBandwidthEstimation::UpdateEstimate(int64_t now_ms) {
|
||||||
// We trust the REMB during the first 2 seconds if we haven't had any
|
// We trust the REMB during the first 2 seconds if we haven't had any
|
||||||
// packet loss reported, to allow startup bitrate probing.
|
// packet loss reported, to allow startup bitrate probing.
|
||||||
if (ProbingExperimentIsEnabled()) {
|
if (ProbingExperimentIsEnabled()) {
|
||||||
@ -230,7 +230,7 @@ bool SendSideBandwidthEstimation::IsInStartPhase(int64_t now_ms) const {
|
|||||||
now_ms - first_report_time_ms_ < kStartPhaseMs;
|
now_ms - first_report_time_ms_ < kStartPhaseMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendSideBandwidthEstimation::UpdateMinHistory(uint32_t now_ms) {
|
void SendSideBandwidthEstimation::UpdateMinHistory(int64_t now_ms) {
|
||||||
// Remove old data points from history.
|
// Remove old data points from history.
|
||||||
// Since history precision is in ms, add one so it is able to increase
|
// Since history precision is in ms, add one so it is able to increase
|
||||||
// bitrate if it is off by as little as 0.5ms.
|
// bitrate if it is off by as little as 0.5ms.
|
||||||
|
@ -27,7 +27,7 @@ class SendSideBandwidthEstimation {
|
|||||||
void CurrentEstimate(uint32_t* bitrate, uint8_t* loss, uint32_t* rtt) const;
|
void CurrentEstimate(uint32_t* bitrate, uint8_t* loss, uint32_t* rtt) const;
|
||||||
|
|
||||||
// Call periodically to update estimate.
|
// Call periodically to update estimate.
|
||||||
void UpdateEstimate(uint32_t now_ms);
|
void UpdateEstimate(int64_t now_ms);
|
||||||
|
|
||||||
// Call when we receive a RTCP message with TMMBR or REMB.
|
// Call when we receive a RTCP message with TMMBR or REMB.
|
||||||
void UpdateReceiverEstimate(uint32_t bandwidth);
|
void UpdateReceiverEstimate(uint32_t bandwidth);
|
||||||
@ -36,7 +36,7 @@ class SendSideBandwidthEstimation {
|
|||||||
void UpdateReceiverBlock(uint8_t fraction_loss,
|
void UpdateReceiverBlock(uint8_t fraction_loss,
|
||||||
uint32_t rtt,
|
uint32_t rtt,
|
||||||
int number_of_packets,
|
int number_of_packets,
|
||||||
uint32_t now_ms);
|
int64_t now_ms);
|
||||||
|
|
||||||
void SetSendBitrate(uint32_t bitrate);
|
void SetSendBitrate(uint32_t bitrate);
|
||||||
void SetMinMaxBitrate(uint32_t min_bitrate, uint32_t max_bitrate);
|
void SetMinMaxBitrate(uint32_t min_bitrate, uint32_t max_bitrate);
|
||||||
@ -59,9 +59,9 @@ class SendSideBandwidthEstimation {
|
|||||||
// Updates history of min bitrates.
|
// Updates history of min bitrates.
|
||||||
// After this method returns min_bitrate_history_.front().second contains the
|
// After this method returns min_bitrate_history_.front().second contains the
|
||||||
// min bitrate used during last kBweIncreaseIntervalMs.
|
// min bitrate used during last kBweIncreaseIntervalMs.
|
||||||
void UpdateMinHistory(uint32_t now_ms);
|
void UpdateMinHistory(int64_t now_ms);
|
||||||
|
|
||||||
std::deque<std::pair<uint32_t, uint32_t> > min_bitrate_history_;
|
std::deque<std::pair<int64_t, uint32_t> > min_bitrate_history_;
|
||||||
|
|
||||||
// incoming filters
|
// incoming filters
|
||||||
int accumulate_lost_packets_Q8_;
|
int accumulate_lost_packets_Q8_;
|
||||||
@ -71,12 +71,12 @@ class SendSideBandwidthEstimation {
|
|||||||
uint32_t min_bitrate_configured_;
|
uint32_t min_bitrate_configured_;
|
||||||
uint32_t max_bitrate_configured_;
|
uint32_t max_bitrate_configured_;
|
||||||
|
|
||||||
uint32_t time_last_receiver_block_ms_;
|
int64_t time_last_receiver_block_ms_;
|
||||||
uint8_t last_fraction_loss_;
|
uint8_t last_fraction_loss_;
|
||||||
uint16_t last_round_trip_time_ms_;
|
uint16_t last_round_trip_time_ms_;
|
||||||
|
|
||||||
uint32_t bwe_incoming_;
|
uint32_t bwe_incoming_;
|
||||||
uint32_t time_last_decrease_ms_;
|
int64_t time_last_decrease_ms_;
|
||||||
int64_t first_report_time_ms_;
|
int64_t first_report_time_ms_;
|
||||||
int initially_lost_packets_;
|
int initially_lost_packets_;
|
||||||
int bitrate_at_2_seconds_kbps_;
|
int bitrate_at_2_seconds_kbps_;
|
||||||
|
@ -96,9 +96,9 @@ class ViEBitrateObserver : public BitrateObserver {
|
|||||||
}
|
}
|
||||||
virtual ~ViEBitrateObserver() {}
|
virtual ~ViEBitrateObserver() {}
|
||||||
// Implements BitrateObserver.
|
// Implements BitrateObserver.
|
||||||
virtual void OnNetworkChanged(const uint32_t bitrate_bps,
|
virtual void OnNetworkChanged(uint32_t bitrate_bps,
|
||||||
const uint8_t fraction_lost,
|
uint8_t fraction_lost,
|
||||||
const uint32_t rtt) {
|
uint32_t rtt) {
|
||||||
owner_->OnNetworkChanged(bitrate_bps, fraction_lost, rtt);
|
owner_->OnNetworkChanged(bitrate_bps, fraction_lost, rtt);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@ -865,9 +865,9 @@ void ViEEncoder::SetMinTransmitBitrate(int min_transmit_bitrate_kbps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called from ViEBitrateObserver.
|
// Called from ViEBitrateObserver.
|
||||||
void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps,
|
void ViEEncoder::OnNetworkChanged(uint32_t bitrate_bps,
|
||||||
const uint8_t fraction_lost,
|
uint8_t fraction_lost,
|
||||||
const uint32_t round_trip_time_ms) {
|
uint32_t round_trip_time_ms) {
|
||||||
LOG(LS_VERBOSE) << "OnNetworkChanged, bitrate" << bitrate_bps
|
LOG(LS_VERBOSE) << "OnNetworkChanged, bitrate" << bitrate_bps
|
||||||
<< " packet loss " << fraction_lost
|
<< " packet loss " << fraction_lost
|
||||||
<< " rtt " << round_trip_time_ms;
|
<< " rtt " << round_trip_time_ms;
|
||||||
|
@ -179,9 +179,9 @@ class ViEEncoder
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called by BitrateObserver.
|
// Called by BitrateObserver.
|
||||||
void OnNetworkChanged(const uint32_t bitrate_bps,
|
void OnNetworkChanged(uint32_t bitrate_bps,
|
||||||
const uint8_t fraction_lost,
|
uint8_t fraction_lost,
|
||||||
const uint32_t round_trip_time_ms);
|
uint32_t round_trip_time_ms);
|
||||||
|
|
||||||
// Called by PacedSender.
|
// Called by PacedSender.
|
||||||
bool TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
|
bool TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
|
||||||
|
Loading…
Reference in New Issue
Block a user