Removes debug file writing.

BUG=
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1365 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2012-01-10 11:45:47 +00:00
parent b07aa403b3
commit 727e1611ac
4 changed files with 12 additions and 53 deletions

View File

@ -19,7 +19,7 @@
#include <math.h> #include <math.h>
#include <stdlib.h> //abs #include <stdlib.h> //abs
#ifdef MATLAB #ifdef WEBRTC_BWE_MATLAB
extern MatlabEngine eng; // global variable defined elsewhere extern MatlabEngine eng; // global variable defined elsewhere
#endif #endif
@ -47,10 +47,7 @@ _prevOffset(0.0),
_timeOverUsing(-1), _timeOverUsing(-1),
_overUseCounter(0), _overUseCounter(0),
_hypothesis(kBwNormal) _hypothesis(kBwNormal)
#ifdef DEBUG_FILE #ifdef WEBRTC_BWE_MATLAB
,_debugFile(NULL)
#endif
#ifdef MATLAB
,_plot1(NULL), ,_plot1(NULL),
_plot2(NULL), _plot2(NULL),
_plot3(NULL), _plot3(NULL),
@ -62,22 +59,11 @@ _plot4(NULL)
_E[0][1] = _E[1][0] = 0; _E[0][1] = _E[1][0] = 0;
_processNoise[0] = 1e-10; _processNoise[0] = 1e-10;
_processNoise[1] = 1e-2; _processNoise[1] = 1e-2;
#ifdef DEBUG_FILE
_debugFile = fopen("detectorData.txt", "w");
if (_debugFile)
fprintf(_debugFile, "data = [\n");
#endif
} }
OverUseDetector::~OverUseDetector() OverUseDetector::~OverUseDetector()
{ {
#ifdef DEBUG_FILE #ifdef WEBRTC_BWE_MATLAB
if (_debugFile) {
fprintf(_debugFile, "];\n");
fclose(_debugFile);
}
#endif
#ifdef MATLAB
if (_plot1) if (_plot1)
{ {
eng.DeletePlot(_plot1); eng.DeletePlot(_plot1);
@ -143,7 +129,7 @@ bool OverUseDetector::Update(const WebRtcRTPHeader& rtpHeader,
const WebRtc_UWord16 packetSize, const WebRtc_UWord16 packetSize,
const WebRtc_Word64 nowMS) const WebRtc_Word64 nowMS)
{ {
#ifdef MATLAB #ifdef WEBRTC_BWE_MATLAB
// Create plots // Create plots
const WebRtc_Word64 startTimeMs = nowMS; const WebRtc_Word64 startTimeMs = nowMS;
if (_plot1 == NULL) if (_plot1 == NULL)
@ -281,13 +267,6 @@ void OverUseDetector::UpdateKalman(WebRtc_Word64 tDelta, double tsDelta, WebRtc_
const double tTsDelta = tDelta - tsDelta / drift; const double tTsDelta = tDelta - tsDelta / drift;
double fsDelta = static_cast<double>(frameSize) - prevFrameSize; double fsDelta = static_cast<double>(frameSize) - prevFrameSize;
#ifdef DEBUG_FILE
if (_debugFile) {
fprintf(_debugFile, "%I64i %f %I64i %lu;\n", tDelta, tsDelta, static_cast<WebRtc_Word64>(fsDelta), frameSize);
fflush(_debugFile);
}
#endif
// Update the Kalman filter // Update the Kalman filter
const double scaleFactor = minFramePeriod / (1000.0 / 30.0); const double scaleFactor = minFramePeriod / (1000.0 / 30.0);
_E[0][0] += _processNoise[0] * scaleFactor; _E[0][0] += _processNoise[0] * scaleFactor;
@ -338,7 +317,7 @@ void OverUseDetector::UpdateKalman(WebRtc_Word64 tDelta, double tsDelta, WebRtc_
_E[0][0] * _E[1][1] - _E[0][1] * _E[1][0] >= 0 && _E[0][0] * _E[1][1] - _E[0][1] * _E[1][0] >= 0 &&
_E[0][0] >= 0); _E[0][0] >= 0);
#ifdef MATLAB #ifdef WEBRTC_BWE_MATLAB
//_plot4->Append("p11",_E[0][0]); //_plot4->Append("p11",_E[0][0]);
//_plot4->Append("p12",_E[0][1]); //_plot4->Append("p12",_E[0][1]);
_plot4->Append("p22",_E[1][1]); _plot4->Append("p22",_E[1][1]);
@ -353,7 +332,7 @@ void OverUseDetector::UpdateKalman(WebRtc_Word64 tDelta, double tsDelta, WebRtc_
Detect(tsDelta); Detect(tsDelta);
#ifdef MATLAB #ifdef WEBRTC_BWE_MATLAB
_plot1->Append("scatter", static_cast<double>(_currentFrame._size) - _prevFrame._size, _plot1->Append("scatter", static_cast<double>(_currentFrame._size) - _prevFrame._size,
static_cast<double>(tDelta-tsDelta)); static_cast<double>(tDelta-tsDelta));
_plot1->MakeTrend("scatter", "slope", _slope, _offset, "k-"); _plot1->MakeTrend("scatter", "slope", _slope, _offset, "k-");
@ -450,12 +429,12 @@ BandwidthUsage OverUseDetector::Detect(double tsDelta)
_timeOverUsing = 0; _timeOverUsing = 0;
_overUseCounter = 0; _overUseCounter = 0;
_hypothesis = kBwOverusing; _hypothesis = kBwOverusing;
#ifdef MATLAB #ifdef WEBRTC_BWE_MATLAB
_plot2->Append("detection",_offset); // plot it later _plot2->Append("detection",_offset); // plot it later
#endif #endif
} }
} }
#ifdef MATLAB #ifdef WEBRTC_BWE_MATLAB
_plot2->Append("trigger",_offset); // plot it later _plot2->Append("trigger",_offset); // plot it later
#endif #endif
} }
@ -473,8 +452,8 @@ BandwidthUsage OverUseDetector::Detect(double tsDelta)
else else
{ {
#ifdef _DEBUG #ifdef _DEBUG
if (_hypothesis != kBwNormal) if (_hypothesis != kBwNormal)
WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, "BWE: kBwNormal"); WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, "BWE: kBwNormal");
#endif #endif
_timeOverUsing = -1; _timeOverUsing = -1;
_overUseCounter = 0; _overUseCounter = 0;

View File

@ -16,9 +16,7 @@
#include "typedefs.h" #include "typedefs.h"
#include "list_wrapper.h" #include "list_wrapper.h"
//#define DEBUG_FILE #ifdef WEBRTC_BWE_MATLAB
#ifdef MATLAB
#include "../test/BWEStandAlone/MatlabPlot.h" #include "../test/BWEStandAlone/MatlabPlot.h"
#endif #endif
@ -76,10 +74,7 @@ private:
WebRtc_UWord16 _overUseCounter; WebRtc_UWord16 _overUseCounter;
BandwidthUsage _hypothesis; BandwidthUsage _hypothesis;
#ifdef DEBUG_FILE #ifdef WEBRTC_BWE_MATLAB
FILE* _debugFile;
#endif
#ifdef MATLAB
MatlabPlot *_plot1; MatlabPlot *_plot1;
MatlabPlot *_plot2; MatlabPlot *_plot2;
MatlabPlot *_plot3; MatlabPlot *_plot3;

View File

@ -41,27 +41,15 @@ _initializedBitRate(false),
_avgChangePeriod(1000.0f), _avgChangePeriod(1000.0f),
_lastChangeMs(-1), _lastChangeMs(-1),
_beta(0.9f) _beta(0.9f)
#ifdef DEBUG_DELAY_SAMPLES
,_delayFile(NULL)
#endif
#ifdef MATLAB #ifdef MATLAB
,_plot1(NULL), ,_plot1(NULL),
_plot2(NULL) _plot2(NULL)
#endif #endif
{ {
#ifdef DEBUG_DELAY_SAMPLES
_delayFile = fopen("delaySamples.m", "w");
fprintf(_delayFile, "delays=[\n");
#endif
} }
RemoteRateControl::~RemoteRateControl() RemoteRateControl::~RemoteRateControl()
{ {
#ifdef DEBUG_DELAY_SAMPLES
fprintf(_delayFile, "];");
fflush(_delayFile);
fclose(_delayFile);
#endif
#ifdef MATLAB #ifdef MATLAB
eng.DeletePlot(_plot1); eng.DeletePlot(_plot1);
eng.DeletePlot(_plot2); eng.DeletePlot(_plot2);

View File

@ -63,9 +63,6 @@ private:
float _avgChangePeriod; float _avgChangePeriod;
WebRtc_Word64 _lastChangeMs; WebRtc_Word64 _lastChangeMs;
float _beta; float _beta;
#ifdef DEBUG_DELAY_SAMPLES
FILE* _delayFile;
#endif
#ifdef MATLAB #ifdef MATLAB
MatlabPlot *_plot1; MatlabPlot *_plot1;
MatlabPlot *_plot2; MatlabPlot *_plot2;