Fixes missing initializations in video_coding.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@104 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
holmer@google.com
2011-06-20 14:43:51 +00:00
parent 2f2971c6f3
commit b7a41937ba
4 changed files with 22 additions and 21 deletions

View File

@ -699,8 +699,7 @@ VCMLossProtectionLogic::UpdateFecType(VCMFecTypes fecType)
void void
VCMLossProtectionLogic::UpdateLossPr(WebRtc_UWord8 lossPr255) VCMLossProtectionLogic::UpdateLossPr(WebRtc_UWord8 lossPr255)
{ {
WebRtc_UWord32 now = static_cast<WebRtc_UWord32> const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
(VCMTickTime::MillisecondTimestamp());
UpdateMaxLossHistory(lossPr255, now); UpdateMaxLossHistory(lossPr255, now);
_lossPr255.Apply(static_cast<float> (now - _lastPrUpdateT), _lossPr255.Apply(static_cast<float> (now - _lastPrUpdateT),
static_cast<float> (lossPr255)); static_cast<float> (lossPr255));
@ -787,8 +786,7 @@ VCMLossProtectionLogic::FilteredLoss() const
//take the windowed max of the received loss //take the windowed max of the received loss
if (_selectedMethod != NULL && _selectedMethod->Type() == kFEC) if (_selectedMethod != NULL && _selectedMethod->Type() == kFEC)
{ {
return MaxFilteredLossPr(static_cast<WebRtc_UWord32> return MaxFilteredLossPr(VCMTickTime::MillisecondTimestamp());
(VCMTickTime::MillisecondTimestamp()));
} }
else else
{ {
@ -811,19 +809,17 @@ VCMLossProtectionLogic::UpdateBitRate(float bitRate)
void void
VCMLossProtectionLogic::UpdatePacketsPerFrame(float nPackets) VCMLossProtectionLogic::UpdatePacketsPerFrame(float nPackets)
{ {
WebRtc_UWord32 now = static_cast<WebRtc_UWord32> const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
(VCMTickTime::MillisecondTimestamp()); _packetsPerFrame.Apply(static_cast<float>(now - _lastPacketPerFrameUpdateT),
_packetsPerFrame.Apply(static_cast<float> (now - nPackets);
_lastPacketPerFrameUpdateT), nPackets);
_lastPacketPerFrameUpdateT = now; _lastPacketPerFrameUpdateT = now;
} }
void void
VCMLossProtectionLogic::UpdatePacketsPerFrameKey(float nPackets) VCMLossProtectionLogic::UpdatePacketsPerFrameKey(float nPackets)
{ {
WebRtc_UWord32 now = static_cast<WebRtc_UWord32> const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
(VCMTickTime::MillisecondTimestamp()); _packetsPerFrameKey.Apply(static_cast<float>(now -
_packetsPerFrameKey.Apply(static_cast<float> (now -
_lastPacketPerFrameUpdateTKey), nPackets); _lastPacketPerFrameUpdateTKey), nPackets);
_lastPacketPerFrameUpdateTKey = now; _lastPacketPerFrameUpdateTKey = now;
} }
@ -896,10 +892,10 @@ VCMLossProtectionLogic::SelectedMethod() const
void VCMLossProtectionLogic::Reset() void VCMLossProtectionLogic::Reset()
{ {
_lastPrUpdateT = static_cast<WebRtc_UWord32> const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
(VCMTickTime::MillisecondTimestamp()); _lastPrUpdateT = now;
_lastPacketPerFrameUpdateT = static_cast<WebRtc_UWord32> _lastPacketPerFrameUpdateT = now;
(VCMTickTime::MillisecondTimestamp()); _lastPacketPerFrameUpdateTKey = now;
_lossPr255.Reset(0.9999f); _lossPr255.Reset(0.9999f);
_packetsPerFrame.Reset(0.9999f); _packetsPerFrame.Reset(0.9999f);
_fecRateDelta = _fecRateKey = 0; _fecRateDelta = _fecRateKey = 0;

View File

@ -350,7 +350,7 @@ private:
// Sets the available loss protection methods. // Sets the available loss protection methods.
void UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, WebRtc_Word64 now); void UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, WebRtc_Word64 now);
WebRtc_UWord8 MaxFilteredLossPr(WebRtc_Word64 nowMs) const; WebRtc_UWord8 MaxFilteredLossPr(WebRtc_Word64 nowMs) const;
ListWrapper _availableMethods; ListWrapper _availableMethods;
VCMProtectionMethod* _selectedMethod; VCMProtectionMethod* _selectedMethod;
VCMProtectionMethod* _bestNotOkMethod; VCMProtectionMethod* _bestNotOkMethod;
VCMProtectionParameters _currentParameters; VCMProtectionParameters _currentParameters;
@ -361,9 +361,9 @@ private:
float _keyFrameSize; float _keyFrameSize;
WebRtc_UWord8 _fecRateKey; WebRtc_UWord8 _fecRateKey;
WebRtc_UWord8 _fecRateDelta; WebRtc_UWord8 _fecRateDelta;
WebRtc_UWord32 _lastPrUpdateT; WebRtc_Word64 _lastPrUpdateT;
WebRtc_UWord32 _lastPacketPerFrameUpdateT; WebRtc_Word64 _lastPacketPerFrameUpdateT;
WebRtc_UWord32 _lastPacketPerFrameUpdateTKey; WebRtc_Word64 _lastPacketPerFrameUpdateTKey;
VCMExpFilter _lossPr255; VCMExpFilter _lossPr255;
VCMLossProbabilitySample _lossPrHistory[kLossPrHistorySize]; VCMLossProbabilitySample _lossPrHistory[kLossPrHistorySize];
WebRtc_UWord8 _shortMaxLossPr255; WebRtc_UWord8 _shortMaxLossPr255;

View File

@ -29,6 +29,7 @@ _sendStatisticsZeroEncode(0),
_maxPayloadSize(1460), _maxPayloadSize(1460),
_lastBitRate(0), _lastBitRate(0),
_targetBitRate(0), _targetBitRate(0),
_incomingFrameRate(0),
_enableQm(false), _enableQm(false),
_videoProtectionCallback(NULL), _videoProtectionCallback(NULL),
_videoQMSettingsCallback(NULL), _videoQMSettingsCallback(NULL),
@ -40,6 +41,7 @@ _lastQMUpdateTime(0),
_lastChangeTime(0) _lastChangeTime(0)
{ {
memset(_sendStatistics, 0, sizeof(_sendStatistics)); memset(_sendStatistics, 0, sizeof(_sendStatistics));
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
_frameDropper = new VCMFrameDropper(_id); _frameDropper = new VCMFrameDropper(_id);
_lossProtLogic = new VCMLossProtectionLogic(); _lossProtLogic = new VCMLossProtectionLogic();
@ -59,12 +61,14 @@ VCMMediaOptimization::~VCMMediaOptimization(void)
WebRtc_Word32 WebRtc_Word32
VCMMediaOptimization::Reset() VCMMediaOptimization::Reset()
{ {
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
InputFrameRate(); // Resets _incomingFrameRate
_frameDropper->Reset(); _frameDropper->Reset();
_lossProtLogic->Reset(); _lossProtLogic->Reset();
_frameDropper->SetRates(0, 0); _frameDropper->SetRates(0, 0);
_content->Reset(); _content->Reset();
_qms->Reset(); _qms->Reset();
_lossProtLogic->UpdateFrameRate(static_cast<float>(InputFrameRate())); _lossProtLogic->UpdateFrameRate(_incomingFrameRate);
_lossProtLogic->Reset(); _lossProtLogic->Reset();
_sendStatisticsZeroEncode = 0; _sendStatisticsZeroEncode = 0;
_lastBitRate = 0; _lastBitRate = 0;
@ -659,7 +663,7 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
{ {
WebRtc_Word32 num = 0; WebRtc_Word32 num = 0;
WebRtc_Word32 nrOfFrames = 0; WebRtc_Word32 nrOfFrames = 0;
for(num = 1; num < (kFrameCountHistorySize - 1); num++) for (num = 1; num < (kFrameCountHistorySize - 1); num++)
{ {
if (_incomingFrameTimes[num] <= 0 || if (_incomingFrameTimes[num] <= 0 ||
// don't use data older than 2 s // don't use data older than 2 s

View File

@ -102,6 +102,7 @@ VCMNTEncodeCompleteCallback::SendData(const FrameType frameType,
rtpInfo.header.ssrc = 0; rtpInfo.header.ssrc = 0;
rtpInfo.header.timestamp = timeStamp; rtpInfo.header.timestamp = timeStamp;
rtpInfo.frameType = frameType; rtpInfo.frameType = frameType;
rtpInfo.type.Video.isFirstPacket = true;
// Size should also be received from that table, since the payload type // Size should also be received from that table, since the payload type
// defines the size. // defines the size.