Revert "Inject TickTimeInterface into VCM and tests"

This CL reverts r1220.

Review URL: http://webrtc-codereview.appspot.com/336002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1235 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org
2011-12-19 17:55:45 +00:00
parent e32c08a5a6
commit 303158588b
45 changed files with 295 additions and 329 deletions

View File

@@ -12,14 +12,11 @@
#include "content_metrics_processing.h"
#include "frame_dropper.h"
#include "qm_select.h"
#include "modules/video_coding/main/source/tick_time_interface.h"
namespace webrtc {
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id,
TickTimeInterface* clock):
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id):
_id(id),
_clock(clock),
_maxBitRate(0),
_sendCodecType(kVideoCodecUnknown),
_codecWidth(0),
@@ -45,7 +42,7 @@ _lastChangeTime(0)
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
_frameDropper = new VCMFrameDropper(_id);
_lossProtLogic = new VCMLossProtectionLogic(_clock->MillisecondTimestamp());
_lossProtLogic = new VCMLossProtectionLogic();
_content = new VCMContentMetricsProcessing();
_qmResolution = new VCMQmResolution();
}
@@ -65,12 +62,12 @@ VCMMediaOptimization::Reset()
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
InputFrameRate(); // Resets _incomingFrameRate
_frameDropper->Reset();
_lossProtLogic->Reset(_clock->MillisecondTimestamp());
_lossProtLogic->Reset();
_frameDropper->SetRates(0, 0);
_content->Reset();
_qmResolution->Reset();
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
_lossProtLogic->Reset(_clock->MillisecondTimestamp());
_lossProtLogic->Reset();
_sendStatisticsZeroEncode = 0;
_targetBitRate = 0;
_codecWidth = 0;
@@ -96,7 +93,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
{
VCMProtectionMethod *selectedMethod = _lossProtLogic->SelectedMethod();
_lossProtLogic->UpdateBitRate(static_cast<float>(bitRate));
_lossProtLogic->UpdateLossPr(fractionLost, _clock->MillisecondTimestamp());
_lossProtLogic->UpdateLossPr(fractionLost);
_lossProtLogic->UpdateRtt(roundTripTimeMs);
_lossProtLogic->UpdateResidualPacketLoss(static_cast<float>(fractionLost));
@@ -119,8 +116,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
// average or max filter may be used.
// We should think about which filter is appropriate for low/high bit rates,
// low/high loss rates, etc.
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss(
_clock->MillisecondTimestamp());
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss();
// For now use the filtered loss for computing the robustness settings
_lossProtLogic->UpdateFilteredLossPr(packetLossEnc);
@@ -257,7 +253,7 @@ VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType, WebRtc_Word3
// has changed. If native dimension values have changed, then either user
// initiated change, or QM initiated change. Will be able to determine only
// after the processing of the first frame.
_lastChangeTime = _clock->MillisecondTimestamp();
_lastChangeTime = VCMTickTime::MillisecondTimestamp();
_content->Reset();
_content->UpdateFrameRate(frameRate);
@@ -340,7 +336,7 @@ VCMMediaOptimization::SentFrameRate()
float
VCMMediaOptimization::SentBitRate()
{
UpdateBitRateEstimate(-1, _clock->MillisecondTimestamp());
UpdateBitRateEstimate(-1, VCMTickTime::MillisecondTimestamp());
return _avgSentBitRateBps / 1000.0f;
}
@@ -355,7 +351,7 @@ VCMMediaOptimization::UpdateWithEncodedData(WebRtc_Word32 encodedLength,
FrameType encodedFrameType)
{
// look into the ViE version - debug mode - needs also number of layers.
UpdateBitRateEstimate(encodedLength, _clock->MillisecondTimestamp());
UpdateBitRateEstimate(encodedLength, VCMTickTime::MillisecondTimestamp());
if(encodedLength > 0)
{
const bool deltaFrame = (encodedFrameType != kVideoFrameKey &&
@@ -368,13 +364,11 @@ VCMMediaOptimization::UpdateWithEncodedData(WebRtc_Word32 encodedLength,
static_cast<float>(_maxPayloadSize);
if (deltaFrame)
{
_lossProtLogic->UpdatePacketsPerFrame(
minPacketsPerFrame, _clock->MillisecondTimestamp());
_lossProtLogic->UpdatePacketsPerFrame(minPacketsPerFrame);
}
else
{
_lossProtLogic->UpdatePacketsPerFrameKey(
minPacketsPerFrame, _clock->MillisecondTimestamp());
_lossProtLogic->UpdatePacketsPerFrameKey(minPacketsPerFrame);
}
if (_enableQm)
@@ -525,7 +519,7 @@ VCMMediaOptimization::SelectQuality()
_qmResolution->ResetRates();
// Reset counters
_lastQMUpdateTime = _clock->MillisecondTimestamp();
_lastQMUpdateTime = VCMTickTime::MillisecondTimestamp();
// Reset content metrics
_content->Reset();
@@ -548,7 +542,7 @@ VCMMediaOptimization::checkStatusForQMchange()
// (to sample the metrics) from the event lastChangeTime
// lastChangeTime is the time where user changed the size/rate/frame rate
// (via SetEncodingData)
WebRtc_Word64 now = _clock->MillisecondTimestamp();
WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
(now - _lastChangeTime) < kQmMinIntervalMs)
{
@@ -618,7 +612,7 @@ VCMMediaOptimization::QMUpdate(VCMResolutionScale* qm)
void
VCMMediaOptimization::UpdateIncomingFrameRate()
{
WebRtc_Word64 now = _clock->MillisecondTimestamp();
WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
if (_incomingFrameTimes[0] == 0)
{
// first no shift
@@ -670,7 +664,7 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
WebRtc_UWord32
VCMMediaOptimization::InputFrameRate()
{
ProcessIncomingFrameRate(_clock->MillisecondTimestamp());
ProcessIncomingFrameRate(VCMTickTime::MillisecondTimestamp());
return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
}