Inject TickTimeInterface into VCM and tests
The purpose of this change is to introduce dependency injection of the timer into the video coding module. Review URL: http://webrtc-codereview.appspot.com/332003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1220 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -551,7 +551,7 @@ VCMFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
||||
|
||||
return true;
|
||||
}
|
||||
VCMLossProtectionLogic::VCMLossProtectionLogic():
|
||||
VCMLossProtectionLogic::VCMLossProtectionLogic(int64_t nowMs):
|
||||
_selectedMethod(NULL),
|
||||
_currentParameters(),
|
||||
_rtt(0),
|
||||
@@ -572,7 +572,7 @@ _boostRateKey(2),
|
||||
_codecWidth(0),
|
||||
_codecHeight(0)
|
||||
{
|
||||
Reset();
|
||||
Reset(nowMs);
|
||||
}
|
||||
|
||||
VCMLossProtectionLogic::~VCMLossProtectionLogic()
|
||||
@@ -661,13 +661,13 @@ VCMLossProtectionLogic::UpdateResidualPacketLoss(float residualPacketLoss)
|
||||
}
|
||||
|
||||
void
|
||||
VCMLossProtectionLogic::UpdateLossPr(WebRtc_UWord8 lossPr255)
|
||||
VCMLossProtectionLogic::UpdateLossPr(WebRtc_UWord8 lossPr255,
|
||||
int64_t nowMs)
|
||||
{
|
||||
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||
UpdateMaxLossHistory(lossPr255, now);
|
||||
_lossPr255.Apply(static_cast<float> (now - _lastPrUpdateT),
|
||||
UpdateMaxLossHistory(lossPr255, nowMs);
|
||||
_lossPr255.Apply(static_cast<float> (nowMs - _lastPrUpdateT),
|
||||
static_cast<float> (lossPr255));
|
||||
_lastPrUpdateT = now;
|
||||
_lastPrUpdateT = nowMs;
|
||||
_lossPr = _lossPr255.Value() / 255.0f;
|
||||
}
|
||||
|
||||
@@ -741,14 +741,14 @@ VCMLossProtectionLogic::MaxFilteredLossPr(WebRtc_Word64 nowMs) const
|
||||
}
|
||||
|
||||
WebRtc_UWord8
|
||||
VCMLossProtectionLogic::FilteredLoss() const
|
||||
VCMLossProtectionLogic::FilteredLoss(int64_t nowMs) const
|
||||
{
|
||||
if (_selectedMethod != NULL &&
|
||||
(_selectedMethod->Type() == kFec ||
|
||||
_selectedMethod->Type() == kNackFec))
|
||||
{
|
||||
// Take the windowed max of the received loss.
|
||||
return MaxFilteredLossPr(VCMTickTime::MillisecondTimestamp());
|
||||
return MaxFilteredLossPr(nowMs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -770,21 +770,19 @@ VCMLossProtectionLogic::UpdateBitRate(float bitRate)
|
||||
}
|
||||
|
||||
void
|
||||
VCMLossProtectionLogic::UpdatePacketsPerFrame(float nPackets)
|
||||
VCMLossProtectionLogic::UpdatePacketsPerFrame(float nPackets, int64_t nowMs)
|
||||
{
|
||||
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||
_packetsPerFrame.Apply(static_cast<float>(now - _lastPacketPerFrameUpdateT),
|
||||
_packetsPerFrame.Apply(static_cast<float>(nowMs - _lastPacketPerFrameUpdateT),
|
||||
nPackets);
|
||||
_lastPacketPerFrameUpdateT = now;
|
||||
_lastPacketPerFrameUpdateT = nowMs;
|
||||
}
|
||||
|
||||
void
|
||||
VCMLossProtectionLogic::UpdatePacketsPerFrameKey(float nPackets)
|
||||
VCMLossProtectionLogic::UpdatePacketsPerFrameKey(float nPackets, int64_t nowMs)
|
||||
{
|
||||
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||
_packetsPerFrameKey.Apply(static_cast<float>(now -
|
||||
_packetsPerFrameKey.Apply(static_cast<float>(nowMs -
|
||||
_lastPacketPerFrameUpdateTKey), nPackets);
|
||||
_lastPacketPerFrameUpdateTKey = now;
|
||||
_lastPacketPerFrameUpdateTKey = nowMs;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -836,12 +834,11 @@ VCMLossProtectionLogic::SelectedType() const
|
||||
}
|
||||
|
||||
void
|
||||
VCMLossProtectionLogic::Reset()
|
||||
VCMLossProtectionLogic::Reset(int64_t nowMs)
|
||||
{
|
||||
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||
_lastPrUpdateT = now;
|
||||
_lastPacketPerFrameUpdateT = now;
|
||||
_lastPacketPerFrameUpdateTKey = now;
|
||||
_lastPrUpdateT = nowMs;
|
||||
_lastPacketPerFrameUpdateT = nowMs;
|
||||
_lastPacketPerFrameUpdateTKey = nowMs;
|
||||
_lossPr255.Reset(0.9999f);
|
||||
_packetsPerFrame.Reset(0.9999f);
|
||||
_fecRateDelta = _fecRateKey = 0;
|
||||
|
||||
Reference in New Issue
Block a user