aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules
diff options
context:
space:
mode:
authordanilchap <danilchap@webrtc.org>2015-12-14 03:21:47 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-14 11:21:51 +0000
commitb2f80e3a28d37c7c06b7765196b8de925898e0f2 (patch)
treea222333219faf9dfc887c73ada071e9f25f41624 /webrtc/modules
parenta78c0211fd50369a75a962385db6163bd8ded239 (diff)
downloadwebrtc-b2f80e3a28d37c7c06b7765196b8de925898e0f2.tar.gz
rtp_rtcp/test/BWEStandAlone deleted as obsolete
BUG=webrtc:5277 R=stefan@webrtc.org Review URL: https://codereview.webrtc.org/1525573002 Cr-Commit-Position: refs/heads/master@{#11008}
Diffstat (limited to 'webrtc/modules')
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc199
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc1058
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h170
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc432
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h150
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc408
-rw-r--r--webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h150
-rw-r--r--webrtc/modules/rtp_rtcp/test/bwe_standalone.gypi85
8 files changed, 0 insertions, 2652 deletions
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc
deleted file mode 100644
index 2d70289d3a..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-// BWEStandAlone.cpp : Defines the entry point for the console application.
-//
-
-#include <stdio.h>
-#include <string>
-
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
-#include "webrtc/system_wrappers/include/event_wrapper.h"
-#include "webrtc/system_wrappers/include/trace.h"
-#include "webrtc/test/channel_transport/udp_transport.h"
-
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h"
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h"
-
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h"
-
-//#include "vld.h"
-
-class myTransportCB: public UdpTransportData
-{
-public:
- myTransportCB (RtpRtcp *rtpMod) : _rtpMod(rtpMod) {};
-protected:
- // Inherited from UdpTransportData
- void IncomingRTPPacket(const int8_t* incomingRtpPacket,
- const size_t rtpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort) override;
-
- void IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
- const size_t rtcpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort) override;
-
-private:
- RtpRtcp *_rtpMod;
-};
-
-void myTransportCB::IncomingRTPPacket(const int8_t* incomingRtpPacket,
- const size_t rtpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort)
-{
- printf("Receiving RTP from IP %s, port %u\n", fromIP, fromPort);
- _rtpMod->IncomingPacket((uint8_t *) incomingRtpPacket, rtpPacketLength);
-}
-
-void myTransportCB::IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
- const size_t rtcpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort)
-{
- printf("Receiving RTCP from IP %s, port %u\n", fromIP, fromPort);
- _rtpMod->IncomingPacket((uint8_t *) incomingRtcpPacket, rtcpPacketLength);
-}
-
-
-int main(int argc, char* argv[])
-{
- bool isSender = false;
- bool isReceiver = false;
- uint16_t port;
- std::string ip;
- TestSenderReceiver *sendrec = new TestSenderReceiver();
- TestLoadGenerator *gen;
-
- if (argc == 2)
- {
- // receiver only
- isReceiver = true;
-
- // read port
- port = atoi(argv[1]);
- }
- else if (argc == 3)
- {
- // sender and receiver
- isSender = true;
- isReceiver = true;
-
- // read IP
- ip = argv[1];
-
- // read port
- port = atoi(argv[2]);
- }
-
- Trace::CreateTrace();
- Trace::SetTraceFile("BWEStandAloneTrace.txt");
- Trace::set_level_filter(webrtc::kTraceAll);
-
- sendrec->InitReceiver(port);
-
- sendrec->Start();
-
- if (isSender)
- {
- const uint32_t startRateKbps = 1000;
- //gen = new CBRGenerator(sendrec, 1000, 500);
- gen = new CBRFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2);
- //gen = new PeriodicKeyFixFRGenerator(sendrec, startRateKbps, 90000, 30, 0.2, 7, 300);
- //const uint16_t numFrameRates = 5;
- //const uint8_t frameRates[numFrameRates] = {30, 15, 20, 23, 25};
- //gen = new CBRVarFRGenerator(sendrec, 1000, frameRates, numFrameRates, 90000, 4.0, 0.1, 0.2);
- //gen = new CBRFrameDropGenerator(sendrec, startRateKbps, 90000, 0.2);
- sendrec->SetLoadGenerator(gen);
- sendrec->InitSender(startRateKbps, ip.c_str(), port);
- gen->Start();
- }
-
- while (1)
- {
- }
-
- if (isSender)
- {
- gen->Stop();
- delete gen;
- }
-
- delete sendrec;
-
- //uint8_t numberOfSocketThreads = 1;
- //UdpTransport* transport = UdpTransport::Create(0, numberOfSocketThreads);
-
- //RtpRtcp* rtp = RtpRtcp::CreateRtpRtcp(1, false);
- //if (rtp->InitSender() != 0)
- //{
- // exit(1);
- //}
- //if (rtp->RegisterSendTransport(transport) != 0)
- //{
- // exit(1);
- //}
-
-// transport->InitializeSendSockets("192.168.200.39", 8000);
- //transport->InitializeSendSockets("127.0.0.1", 10000);
- //transport->InitializeSourcePorts(8000);
-
-
- return(0);
- // myTransportCB *tp = new myTransportCB(rtp);
- // transport->InitializeReceiveSockets(tp, 10000, "0.0.0.0");
- // transport->StartReceiving(500);
-
- // int8_t data[100];
- // for (int i = 0; i < 100; data[i] = i++);
-
- // for (int i = 0; i < 100; i++)
- // {
- // transport->SendRaw(data, 100, false);
- // }
-
-
-
- // int32_t totTime = 0;
- // while (totTime < 10000)
- // {
- // transport->Process();
- // int32_t wTime = transport->TimeUntilNextProcess();
- // totTime += wTime;
- // Sleep(wTime);
- // }
-
-
- //if (transport)
- //{
- // // Destroy the Socket Transport module
- // transport->StopReceiving();
- // transport->InitializeReceiveSockets(NULL,0);// deregister callback
- // UdpTransport::Destroy(transport);
- // transport = NULL;
- // }
-
- // if (tp)
- // {
- // delete tp;
- // tp = NULL;
- // }
-
- // if (rtp)
- // {
- // RtpRtcp::DestroyRtpRtcp(rtp);
- // rtp = NULL;
- // }
-
-
- //return 0;
-}
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc
deleted file mode 100644
index e81813653b..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.cc
+++ /dev/null
@@ -1,1058 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h"
-
-#include <math.h>
-#include <stdio.h>
-
-#include <algorithm>
-#include <sstream>
-
-#ifdef MATLAB
-#include "engine.h" // NOLINT(build/include)
-#endif
-
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/include/event_wrapper.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
-
-using webrtc::CriticalSectionScoped;
-using webrtc::CriticalSectionWrapper;
-using webrtc::EventWrapper;
-using webrtc::TickTime;
-
-#ifdef MATLAB
-MatlabEngine eng;
-
-MatlabLine::MatlabLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, const char *name /*= NULL*/)
-:
-_xArray(NULL),
-_yArray(NULL),
-_maxLen(maxLen),
-_plotAttribute(),
-_name()
-{
- if (_maxLen > 0)
- {
- _xArray = mxCreateDoubleMatrix(1, _maxLen, mxREAL);
- _yArray = mxCreateDoubleMatrix(1, _maxLen, mxREAL);
- }
-
- if (plotAttrib)
- {
- _plotAttribute = plotAttrib;
- }
-
- if (name)
- {
- _name = name;
- }
-}
-
-MatlabLine::~MatlabLine()
-{
- if (_xArray != NULL)
- {
- mxDestroyArray(_xArray);
- }
- if (_yArray != NULL)
- {
- mxDestroyArray(_yArray);
- }
-}
-
-void MatlabLine::Append(double x, double y)
-{
- if (_maxLen > 0 && _xData.size() > static_cast<uint32_t>(_maxLen))
- {
- _xData.resize(_maxLen);
- _yData.resize(_maxLen);
- }
-
- _xData.push_front(x);
- _yData.push_front(y);
-}
-
-
-// append y-data with running integer index as x-data
-void MatlabLine::Append(double y)
-{
- if (_xData.empty())
- {
- // first element is index 0
- Append(0, y);
- }
- else
- {
- // take last x-value and increment
- double temp = _xData.back(); // last x-value
- Append(temp + 1, y);
- }
-}
-
-
-void MatlabLine::SetMaxLen(int maxLen)
-{
- if (maxLen <= 0)
- {
- // means no maxLen
- _maxLen = -1;
- }
- else
- {
- _maxLen = maxLen;
-
- if (_xArray != NULL)
- {
- mxDestroyArray(_xArray);
- mxDestroyArray(_yArray);
- }
- _xArray = mxCreateDoubleMatrix(1, _maxLen, mxREAL);
- _yArray = mxCreateDoubleMatrix(1, _maxLen, mxREAL);
-
- maxLen = ((unsigned int)maxLen <= _xData.size()) ? maxLen : (int)_xData.size();
- _xData.resize(maxLen);
- _yData.resize(maxLen);
-
- //// reserve the right amount of memory
- //_xData.reserve(_maxLen);
- //_yData.reserve(_maxLen);
- }
-}
-
-void MatlabLine::SetAttribute(char *plotAttrib)
-{
- _plotAttribute = plotAttrib;
-}
-
-void MatlabLine::SetName(char *name)
-{
- _name = name;
-}
-
-void MatlabLine::GetPlotData(mxArray** xData, mxArray** yData)
-{
- // Make sure we have enough Matlab allocated memory.
- // Assuming both arrays (x and y) are of the same size.
- if (_xData.empty())
- {
- return; // No data
- }
- unsigned int size = 0;
- if (_xArray != NULL)
- {
- size = (unsigned int)mxGetNumberOfElements(_xArray);
- }
- if (size < _xData.size())
- {
- if (_xArray != NULL)
- {
- mxDestroyArray(_xArray);
- mxDestroyArray(_yArray);
- }
- _xArray = mxCreateDoubleMatrix(1, _xData.size(), mxREAL);
- _yArray = mxCreateDoubleMatrix(1, _yData.size(), mxREAL);
- }
-
- if (!_xData.empty())
- {
- double* x = mxGetPr(_xArray);
-
- std::list<double>::iterator it = _xData.begin();
-
- for (int i = 0; it != _xData.end(); it++, i++)
- {
- x[i] = *it;
- }
- }
-
- if (!_yData.empty())
- {
- double* y = mxGetPr(_yArray);
-
- std::list<double>::iterator it = _yData.begin();
-
- for (int i = 0; it != _yData.end(); it++, i++)
- {
- y[i] = *it;
- }
- }
- *xData = _xArray;
- *yData = _yArray;
-}
-
-std::string MatlabLine::GetXName()
-{
- std::ostringstream xString;
- xString << "x_" << _name;
- return xString.str();
-}
-
-std::string MatlabLine::GetYName()
-{
- std::ostringstream yString;
- yString << "y_" << _name;
- return yString.str();
-}
-
-std::string MatlabLine::GetPlotString()
-{
-
- std::ostringstream s;
-
- if (_xData.size() == 0)
- {
- s << "[0 1], [0 1]"; // To get an empty plot
- }
- else
- {
- s << GetXName() << "(1:" << _xData.size() << "),";
- s << GetYName() << "(1:" << _yData.size() << ")";
- }
-
- s << ", '";
- s << _plotAttribute;
- s << "'";
-
- return s.str();
-}
-
-std::string MatlabLine::GetRefreshString()
-{
- std::ostringstream s;
-
- if (_xData.size() > 0)
- {
- s << "set(h,'xdata',"<< GetXName() <<"(1:" << _xData.size() << "),'ydata',"<< GetYName() << "(1:" << _yData.size() << "));";
- }
- else
- {
- s << "set(h,'xdata',[NaN],'ydata',[NaN]);";
- }
- return s.str();
-}
-
-std::string MatlabLine::GetLegendString()
-{
- return ("'" + _name + "'");
-}
-
-bool MatlabLine::hasLegend()
-{
- return (!_name.empty());
-}
-
-
-// remove data points, but keep attributes
-void MatlabLine::Reset()
-{
- _xData.clear();
- _yData.clear();
-}
-
-
-void MatlabLine::UpdateTrendLine(MatlabLine * sourceData, double slope, double offset)
-{
- Reset(); // reset data, not attributes and name
-
- double thexMin = sourceData->xMin();
- double thexMax = sourceData->xMax();
- Append(thexMin, thexMin * slope + offset);
- Append(thexMax, thexMax * slope + offset);
-}
-
-double MatlabLine::xMin()
-{
- if (!_xData.empty())
- {
- std::list<double>::iterator theStart = _xData.begin();
- std::list<double>::iterator theEnd = _xData.end();
- return(*min_element(theStart, theEnd));
- }
- return (0.0);
-}
-
-double MatlabLine::xMax()
-{
- if (!_xData.empty())
- {
- std::list<double>::iterator theStart = _xData.begin();
- std::list<double>::iterator theEnd = _xData.end();
- return(*max_element(theStart, theEnd));
- }
- return (0.0);
-}
-
-double MatlabLine::yMin()
-{
- if (!_yData.empty())
- {
- std::list<double>::iterator theStart = _yData.begin();
- std::list<double>::iterator theEnd = _yData.end();
- return(*min_element(theStart, theEnd));
- }
- return (0.0);
-}
-
-double MatlabLine::yMax()
-{
- if (!_yData.empty())
- {
- std::list<double>::iterator theStart = _yData.begin();
- std::list<double>::iterator theEnd = _yData.end();
- return(*max_element(theStart, theEnd));
- }
- return (0.0);
-}
-
-
-
-MatlabTimeLine::MatlabTimeLine(int horizonSeconds /*= -1*/, const char *plotAttrib /*= NULL*/,
- const char *name /*= NULL*/,
- int64_t refTimeMs /* = -1*/)
- :
-_timeHorizon(horizonSeconds),
-MatlabLine(-1, plotAttrib, name) // infinite number of elements
-{
- if (refTimeMs < 0)
- _refTimeMs = TickTime::MillisecondTimestamp();
- else
- _refTimeMs = refTimeMs;
-}
-
-void MatlabTimeLine::Append(double y)
-{
- MatlabLine::Append(static_cast<double>(TickTime::MillisecondTimestamp() - _refTimeMs) / 1000.0, y);
-
- PurgeOldData();
-}
-
-
-void MatlabTimeLine::PurgeOldData()
-{
- if (_timeHorizon > 0)
- {
- // remove old data
- double historyLimit = static_cast<double>(TickTime::MillisecondTimestamp() - _refTimeMs) / 1000.0
- - _timeHorizon; // remove data points older than this
-
- std::list<double>::reverse_iterator ritx = _xData.rbegin();
- uint32_t removeCount = 0;
- while (ritx != _xData.rend())
- {
- if (*ritx >= historyLimit)
- {
- break;
- }
- ritx++;
- removeCount++;
- }
- if (removeCount == 0)
- {
- return;
- }
-
- // remove the range [begin, it).
- //if (removeCount > 10)
- //{
- // printf("Removing %lu elements\n", removeCount);
- //}
- _xData.resize(_xData.size() - removeCount);
- _yData.resize(_yData.size() - removeCount);
- }
-}
-
-
-int64_t MatlabTimeLine::GetRefTime()
-{
- return(_refTimeMs);
-}
-
-
-
-
-MatlabPlot::MatlabPlot()
-:
-_figHandle(-1),
-_smartAxis(false),
-_critSect(CriticalSectionWrapper::CreateCriticalSection()),
-_timeToPlot(false),
-_plotting(false),
-_enabled(true),
-_firstPlot(true),
-_legendEnabled(true),
-_donePlottingEvent(EventWrapper::Create())
-{
- CriticalSectionScoped cs(_critSect);
-
- _xlim[0] = 0;
- _xlim[1] = 0;
- _ylim[0] = 0;
- _ylim[1] = 0;
-
-#ifdef PLOT_TESTING
- _plotStartTime = -1;
- _plotDelay = 0;
-#endif
-
-}
-
-
-MatlabPlot::~MatlabPlot()
-{
- _critSect->Enter();
-
- // delete all line objects
- while (!_line.empty())
- {
- delete *(_line.end() - 1);
- _line.pop_back();
- }
-
- delete _critSect;
- delete _donePlottingEvent;
-}
-
-
-int MatlabPlot::AddLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, const char *name /*= NULL*/)
-{
- CriticalSectionScoped cs(_critSect);
- if (!_enabled)
- {
- return -1;
- }
-
- MatlabLine *newLine = new MatlabLine(maxLen, plotAttrib, name);
- _line.push_back(newLine);
-
- return (static_cast<int>(_line.size() - 1)); // index of newly inserted line
-}
-
-
-int MatlabPlot::AddTimeLine(int maxLen /*= -1*/, const char *plotAttrib /*= NULL*/, const char *name /*= NULL*/,
- int64_t refTimeMs /*= -1*/)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return -1;
- }
-
- MatlabTimeLine *newLine = new MatlabTimeLine(maxLen, plotAttrib, name, refTimeMs);
- _line.push_back(newLine);
-
- return (static_cast<int>(_line.size() - 1)); // index of newly inserted line
-}
-
-
-int MatlabPlot::GetLineIx(const char *name)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return -1;
- }
-
- // search the list for a matching line name
- std::vector<MatlabLine*>::iterator it = _line.begin();
- bool matchFound = false;
- int lineIx = 0;
-
- for (; it != _line.end(); it++, lineIx++)
- {
- if ((*it)->_name == name)
- {
- matchFound = true;
- break;
- }
- }
-
- if (matchFound)
- {
- return (lineIx);
- }
- else
- {
- return (-1);
- }
-}
-
-
-void MatlabPlot::Append(int lineIndex, double x, double y)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return;
- }
-
- // sanity for index
- if (lineIndex < 0 || lineIndex >= static_cast<int>(_line.size()))
- {
- throw "Line index out of range";
- exit(1);
- }
-
- return (_line[lineIndex]->Append(x, y));
-}
-
-
-void MatlabPlot::Append(int lineIndex, double y)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return;
- }
-
- // sanity for index
- if (lineIndex < 0 || lineIndex >= static_cast<int>(_line.size()))
- {
- throw "Line index out of range";
- exit(1);
- }
-
- return (_line[lineIndex]->Append(y));
-}
-
-
-int MatlabPlot::Append(const char *name, double x, double y)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return -1;
- }
-
- // search the list for a matching line name
- int lineIx = GetLineIx(name);
-
- if (lineIx < 0) //(!matchFound)
- {
- // no match; append new line
- lineIx = AddLine(-1, NULL, name);
- }
-
- // append data to line
- Append(lineIx, x, y);
- return (lineIx);
-}
-
-int MatlabPlot::Append(const char *name, double y)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return -1;
- }
-
- // search the list for a matching line name
- int lineIx = GetLineIx(name);
-
- if (lineIx < 0) //(!matchFound)
- {
- // no match; append new line
- lineIx = AddLine(-1, NULL, name);
- }
-
- // append data to line
- Append(lineIx, y);
- return (lineIx);
-}
-
-int MatlabPlot::Length(char *name)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return -1;
- }
-
- int ix = GetLineIx(name);
- if (ix >= 0)
- {
- return (static_cast<int>(_line[ix]->_xData.size()));
- }
- else
- {
- return (-1);
- }
-}
-
-
-void MatlabPlot::SetPlotAttribute(char *name, char *plotAttrib)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (!_enabled)
- {
- return;
- }
-
- int lineIx = GetLineIx(name);
-
- if (lineIx >= 0)
- {
- _line[lineIx]->SetAttribute(plotAttrib);
- }
-}
-
-// Must be called under critical section _critSect
-void MatlabPlot::UpdateData(Engine* ep)
-{
- if (!_enabled)
- {
- return;
- }
-
- for (std::vector<MatlabLine*>::iterator it = _line.begin(); it != _line.end(); it++)
- {
- mxArray* xData = NULL;
- mxArray* yData = NULL;
- (*it)->GetPlotData(&xData, &yData);
- if (xData != NULL)
- {
- std::string xName = (*it)->GetXName();
- std::string yName = (*it)->GetYName();
- _critSect->Leave();
-#ifdef MATLAB6
- mxSetName(xData, xName.c_str());
- mxSetName(yData, yName.c_str());
- engPutArray(ep, xData);
- engPutArray(ep, yData);
-#else
- int ret = engPutVariable(ep, xName.c_str(), xData);
- assert(ret == 0);
- ret = engPutVariable(ep, yName.c_str(), yData);
- assert(ret == 0);
-#endif
- _critSect->Enter();
- }
- }
-}
-
-bool MatlabPlot::GetPlotCmd(std::ostringstream & cmd, Engine* ep)
-{
- _critSect->Enter();
-
- if (!DataAvailable())
- {
- return false;
- }
-
- if (_firstPlot)
- {
- GetPlotCmd(cmd);
- _firstPlot = false;
- }
- else
- {
- GetRefreshCmd(cmd);
- }
-
- UpdateData(ep);
-
- _critSect->Leave();
-
- return true;
-}
-
-// Call inside critsect
-void MatlabPlot::GetPlotCmd(std::ostringstream & cmd)
-{
- // we have something to plot
- // empty the stream
- cmd.str(""); // (this seems to be the only way)
-
- cmd << "figure; h" << _figHandle << "= plot(";
-
- // first line
- std::vector<MatlabLine*>::iterator it = _line.begin();
- cmd << (*it)->GetPlotString();
-
- it++;
-
- // remaining lines
- for (; it != _line.end(); it++)
- {
- cmd << ", ";
- cmd << (*it)->GetPlotString();
- }
-
- cmd << "); ";
-
- if (_legendEnabled)
- {
- GetLegendCmd(cmd);
- }
-
- if (_smartAxis)
- {
- double xMin = _xlim[0];
- double xMax = _xlim[1];
- double yMax = _ylim[1];
- for (std::vector<MatlabLine*>::iterator it = _line.begin(); it != _line.end(); it++)
- {
- xMax = std::max(xMax, (*it)->xMax());
- xMin = std::min(xMin, (*it)->xMin());
-
- yMax = std::max(yMax, (*it)->yMax());
- yMax = std::max(yMax, fabs((*it)->yMin()));
- }
- _xlim[0] = xMin;
- _xlim[1] = xMax;
- _ylim[0] = -yMax;
- _ylim[1] = yMax;
-
- cmd << "axis([" << _xlim[0] << ", " << _xlim[1] << ", " << _ylim[0] << ", " << _ylim[1] << "]);";
- }
-
- int i=1;
- for (it = _line.begin(); it != _line.end(); i++, it++)
- {
- cmd << "set(h" << _figHandle << "(" << i << "), 'Tag', " << (*it)->GetLegendString() << ");";
- }
-}
-
-// Call inside critsect
-void MatlabPlot::GetRefreshCmd(std::ostringstream & cmd)
-{
- cmd.str(""); // (this seems to be the only way)
- std::vector<MatlabLine*>::iterator it = _line.begin();
- for (it = _line.begin(); it != _line.end(); it++)
- {
- cmd << "h = findobj(0, 'Tag', " << (*it)->GetLegendString() << ");";
- cmd << (*it)->GetRefreshString();
- }
- //if (_legendEnabled)
- //{
- // GetLegendCmd(cmd);
- //}
-}
-
-void MatlabPlot::GetLegendCmd(std::ostringstream & cmd)
-{
- std::vector<MatlabLine*>::iterator it = _line.begin();
- bool anyLegend = false;
- for (; it != _line.end(); it++)
- {
- anyLegend = anyLegend || (*it)->hasLegend();
- }
- if (anyLegend)
- {
- // create the legend
-
- cmd << "legend(h" << _figHandle << ",{";
-
-
- // iterate lines
- int i = 0;
- for (std::vector<MatlabLine*>::iterator it = _line.begin(); it != _line.end(); it++)
- {
- if (i > 0)
- {
- cmd << ", ";
- }
- cmd << (*it)->GetLegendString();
- i++;
- }
-
- cmd << "}, 2); "; // place legend in upper-left corner
- }
-}
-
-// Call inside critsect
-bool MatlabPlot::DataAvailable()
-{
- if (!_enabled)
- {
- return false;
- }
-
- for (std::vector<MatlabLine*>::iterator it = _line.begin(); it != _line.end(); it++)
- {
- (*it)->PurgeOldData();
- }
-
- return true;
-}
-
-void MatlabPlot::Plot()
-{
- CriticalSectionScoped cs(_critSect);
-
- _timeToPlot = true;
-
-#ifdef PLOT_TESTING
- _plotStartTime = TickTime::MillisecondTimestamp();
-#endif
-}
-
-
-void MatlabPlot::Reset()
-{
- CriticalSectionScoped cs(_critSect);
-
- _enabled = true;
-
- for (std::vector<MatlabLine*>::iterator it = _line.begin(); it != _line.end(); it++)
- {
- (*it)->Reset();
- }
-
-}
-
-void MatlabPlot::SetFigHandle(int handle)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (handle > 0)
- _figHandle = handle;
-}
-
-bool
-MatlabPlot::TimeToPlot()
-{
- CriticalSectionScoped cs(_critSect);
- return _enabled && _timeToPlot;
-}
-
-void
-MatlabPlot::Plotting()
-{
- CriticalSectionScoped cs(_critSect);
- _plotting = true;
-}
-
-void
-MatlabPlot::DonePlotting()
-{
- CriticalSectionScoped cs(_critSect);
- _timeToPlot = false;
- _plotting = false;
- _donePlottingEvent->Set();
-}
-
-void
-MatlabPlot::DisablePlot()
-{
- _critSect->Enter();
- while (_plotting)
- {
- _critSect->Leave();
- _donePlottingEvent->Wait(WEBRTC_EVENT_INFINITE);
- _critSect->Enter();
- }
- _enabled = false;
-}
-
-int MatlabPlot::MakeTrend(const char *sourceName, const char *trendName, double slope, double offset, const char *plotAttrib)
-{
- CriticalSectionScoped cs(_critSect);
-
- int sourceIx;
- int trendIx;
-
- sourceIx = GetLineIx(sourceName);
- if (sourceIx < 0)
- {
- // could not find source
- return (-1);
- }
-
- trendIx = GetLineIx(trendName);
- if (trendIx < 0)
- {
- // no trend found; add new line
- trendIx = AddLine(2 /*maxLen*/, plotAttrib, trendName);
- }
-
- _line[trendIx]->UpdateTrendLine(_line[sourceIx], slope, offset);
-
- return (trendIx);
-
-}
-
-
-MatlabEngine::MatlabEngine()
-:
-_critSect(CriticalSectionWrapper::CreateCriticalSection()),
-_eventPtr(NULL),
-_running(false),
-_numPlots(0)
-{
- _eventPtr = EventWrapper::Create();
-
- _plotThread(MatlabEngine::PlotThread, this,
- kLowPriority, "MatlabPlot");
- _running = true;
- _plotThread->Start();
-}
-
-MatlabEngine::~MatlabEngine()
-{
- _critSect->Enter();
-
- if (_plotThread)
- {
- _running = false;
- _eventPtr->Set();
-
- _plotThread->Stop();
- }
-
- _plots.clear();
-
- delete _eventPtr;
- _eventPtr = NULL;
-
- _critSect->Leave();
- delete _critSect;
-
-}
-
-MatlabPlot * MatlabEngine::NewPlot(MatlabPlot *newPlot)
-{
- CriticalSectionScoped cs(_critSect);
-
- //MatlabPlot *newPlot = new MatlabPlot();
-
- if (newPlot)
- {
- newPlot->SetFigHandle(++_numPlots); // first plot is number 1
- _plots.push_back(newPlot);
- }
-
- return (newPlot);
-
-}
-
-
-void MatlabEngine::DeletePlot(MatlabPlot *plot)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (plot == NULL)
- {
- return;
- }
-
- std::vector<MatlabPlot *>::iterator it;
- for (it = _plots.begin(); it < _plots.end(); it++)
- {
- if (plot == *it)
- {
- break;
- }
- }
-
- assert (plot == *it);
-
- (*it)->DisablePlot();
-
- _plots.erase(it);
- --_numPlots;
-
- delete plot;
-}
-
-
-bool MatlabEngine::PlotThread(void *obj)
-{
- if (!obj)
- {
- return (false);
- }
-
- MatlabEngine *eng = (MatlabEngine *) obj;
-
- Engine *ep = engOpen(NULL);
- if (!ep)
- {
- throw "Cannot open Matlab engine";
- return (false);
- }
-
- engSetVisible(ep, true);
- engEvalString(ep, "close all;");
-
- while (eng->_running)
- {
- eng->_critSect->Enter();
-
- // iterate through all plots
- for (unsigned int ix = 0; ix < eng->_plots.size(); ix++)
- {
- MatlabPlot *plot = eng->_plots[ix];
- if (plot->TimeToPlot())
- {
- plot->Plotting();
- eng->_critSect->Leave();
- std::ostringstream cmd;
-
- if (engEvalString(ep, cmd.str().c_str()))
- {
- // engine dead
- return (false);
- }
-
- // empty the stream
- cmd.str(""); // (this seems to be the only way)
- if (plot->GetPlotCmd(cmd, ep))
- {
- // things to plot, we have already accessed what we need in the plot
- plot->DonePlotting();
-
- int64_t start = TickTime::MillisecondTimestamp();
- // plot it
- int ret = engEvalString(ep, cmd.str().c_str());
- printf("time=%I64i\n", TickTime::MillisecondTimestamp() - start);
- if (ret)
- {
- // engine dead
- return (false);
- }
-
-#ifdef PLOT_TESTING
- if(plot->_plotStartTime >= 0)
- {
- plot->_plotDelay = TickTime::MillisecondTimestamp() - plot->_plotStartTime;
- plot->_plotStartTime = -1;
- }
-#endif
- }
- eng->_critSect->Enter();
- }
- }
-
- eng->_critSect->Leave();
- // wait a while
- eng->_eventPtr->Wait(66); // 33 ms
- }
-
- if (ep)
- {
- engClose(ep);
- ep = NULL;
- }
-
- return (true);
-
-}
-
-#endif // MATLAB
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h
deleted file mode 100644
index 7ded42d732..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_MATLABPLOT_H_
-#define WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_MATLABPLOT_H_
-
-#include <list>
-#include <string>
-#include <vector>
-
-#include "webrtc/base/platform_thread.h"
-#include "webrtc/typedefs.h"
-
-namespace webrtc {
-class CriticalSectionWrapper;
-class EventWrapper;
-}
-
-//#define PLOT_TESTING
-
-#ifdef MATLAB
-
-typedef struct engine Engine;
-typedef struct mxArray_tag mxArray;
-
-class MatlabLine
-{
- friend class MatlabPlot;
-
-public:
- MatlabLine(int maxLen = -1, const char *plotAttrib = NULL, const char *name = NULL);
- ~MatlabLine();
- virtual void Append(double x, double y);
- virtual void Append(double y);
- void SetMaxLen(int maxLen);
- void SetAttribute(char *plotAttrib);
- void SetName(char *name);
- void Reset();
- virtual void PurgeOldData() {};
-
- void UpdateTrendLine(MatlabLine * sourceData, double slope, double offset);
-
- double xMin();
- double xMax();
- double yMin();
- double yMax();
-
-protected:
- void GetPlotData(mxArray** xData, mxArray** yData);
- std::string GetXName();
- std::string GetYName();
- std::string GetPlotString();
- std::string GetRefreshString();
- std::string GetLegendString();
- bool hasLegend();
- std::list<double> _xData;
- std::list<double> _yData;
- mxArray* _xArray;
- mxArray* _yArray;
- int _maxLen;
- std::string _plotAttribute;
- std::string _name;
-};
-
-
-class MatlabTimeLine : public MatlabLine
-{
-public:
- MatlabTimeLine(int horizonSeconds = -1, const char *plotAttrib = NULL, const char *name = NULL,
- int64_t refTimeMs = -1);
- ~MatlabTimeLine() {};
- void Append(double y);
- void PurgeOldData();
- int64_t GetRefTime();
-
-private:
- int64_t _refTimeMs;
- int _timeHorizon;
-};
-
-
-class MatlabPlot
-{
- friend class MatlabEngine;
-
-public:
- MatlabPlot();
- ~MatlabPlot();
-
- int AddLine(int maxLen = -1, const char *plotAttrib = NULL, const char *name = NULL);
- int AddTimeLine(int maxLen = -1, const char *plotAttrib = NULL, const char *name = NULL,
- int64_t refTimeMs = -1);
- int GetLineIx(const char *name);
- void Append(int lineIndex, double x, double y);
- void Append(int lineIndex, double y);
- int Append(const char *name, double x, double y);
- int Append(const char *name, double y);
- int Length(char *name);
- void SetPlotAttribute(char *name, char *plotAttrib);
- void Plot();
- void Reset();
- void SmartAxis(bool status = true) { _smartAxis = status; };
- void SetFigHandle(int handle);
- void EnableLegend(bool enable) { _legendEnabled = enable; };
-
- bool TimeToPlot();
- void Plotting();
- void DonePlotting();
- void DisablePlot();
-
- int MakeTrend(const char *sourceName, const char *trendName, double slope, double offset, const char *plotAttrib = NULL);
-
-#ifdef PLOT_TESTING
- int64_t _plotStartTime;
- int64_t _plotDelay;
-#endif
-
-private:
- void UpdateData(Engine* ep);
- bool GetPlotCmd(std::ostringstream & cmd, Engine* ep);
- void GetPlotCmd(std::ostringstream & cmd); // call inside crit sect
- void GetRefreshCmd(std::ostringstream & cmd); // call inside crit sect
- void GetLegendCmd(std::ostringstream & cmd);
- bool DataAvailable();
-
- std::vector<MatlabLine *> _line;
- int _figHandle;
- bool _smartAxis;
- double _xlim[2];
- double _ylim[2];
- webrtc::CriticalSectionWrapper *_critSect;
- bool _timeToPlot;
- bool _plotting;
- bool _enabled;
- bool _firstPlot;
- bool _legendEnabled;
- webrtc::EventWrapper* _donePlottingEvent;
-};
-
-
-class MatlabEngine
-{
-public:
- MatlabEngine();
- ~MatlabEngine();
-
- MatlabPlot * NewPlot(MatlabPlot *newPlot);
- void DeletePlot(MatlabPlot *plot);
-
-private:
- static bool PlotThread(void *obj);
-
- std::vector<MatlabPlot *> _plots;
- webrtc::CriticalSectionWrapper *_critSect;
- webrtc::EventWrapper *_eventPtr;
- rtc::scoped_ptr<rtc::PlatformThread> _plotThread;
- bool _running;
- int _numPlots;
-};
-
-#endif //MATLAB
-
-#endif // WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_MATLABPLOT_H_
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc
deleted file mode 100644
index a48ad2e6e4..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.cc
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h"
-
-#include <stdio.h>
-
-#include <algorithm>
-
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h"
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/include/event_wrapper.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
-
-
-bool SenderThreadFunction(void *obj)
-{
- if (obj == NULL)
- {
- return false;
- }
- TestLoadGenerator *_genObj = static_cast<TestLoadGenerator *>(obj);
-
- return _genObj->GeneratorLoop();
-}
-
-
-TestLoadGenerator::TestLoadGenerator(TestSenderReceiver *sender, int32_t rtpSampleRate)
-:
-_critSect(CriticalSectionWrapper::CreateCriticalSection()),
-_eventPtr(NULL),
-_bitrateKbps(0),
-_sender(sender),
-_running(false),
-_rtpSampleRate(rtpSampleRate)
-{
-}
-
-TestLoadGenerator::~TestLoadGenerator ()
-{
- if (_running)
- {
- Stop();
- }
-
- delete _critSect;
-}
-
-int32_t TestLoadGenerator::SetBitrate (int32_t newBitrateKbps)
-{
- CriticalSectionScoped cs(_critSect);
-
- if (newBitrateKbps < 0)
- {
- return -1;
- }
-
- _bitrateKbps = newBitrateKbps;
-
- printf("New bitrate = %i kbps\n", _bitrateKbps);
-
- return _bitrateKbps;
-}
-
-
-int32_t TestLoadGenerator::Start (const char *threadName)
-{
- CriticalSectionScoped cs(_critSect);
-
- _eventPtr = EventWrapper::Create();
-
- _genThread.reset(
- new rtc::PlatformThread(SenderThreadFunction, this, threadName));
- _running = true;
-
- _genThread->Start();
- _genThread->SetPriority(rtc::kRealtimePriority);
-
- return 0;
-}
-
-
-int32_t TestLoadGenerator::Stop ()
-{
- _critSect.Enter();
-
- if (_genThread)
- {
- _running = false;
- _eventPtr->Set();
-
- _genThread->Stop();
- _genThread.reset();
-
- delete _eventPtr;
- _eventPtr = NULL;
- }
-
- _critSect.Leave();
- return (0);
-}
-
-
-int TestLoadGenerator::generatePayload ()
-{
- return(generatePayload( static_cast<uint32_t>( TickTime::MillisecondTimestamp() * _rtpSampleRate / 1000 )));
-}
-
-
-int TestLoadGenerator::sendPayload (const uint32_t timeStamp,
- const uint8_t* payloadData,
- const size_t payloadSize,
- const webrtc::FrameType frameType /*= webrtc::kVideoFrameDelta*/)
-{
-
- return (_sender->SendOutgoingData(timeStamp, payloadData, payloadSize, frameType));
-}
-
-
-CBRGenerator::CBRGenerator (TestSenderReceiver *sender,
- size_t payloadSizeBytes,
- int32_t bitrateKbps,
- int32_t rtpSampleRate)
-:
-//_eventPtr(NULL),
-_payloadSizeBytes(payloadSizeBytes),
-_payload(new uint8_t[payloadSizeBytes]),
-TestLoadGenerator(sender, rtpSampleRate)
-{
- SetBitrate (bitrateKbps);
-}
-
-CBRGenerator::~CBRGenerator ()
-{
- if (_running)
- {
- Stop();
- }
-
- if (_payload)
- {
- delete [] _payload;
- }
-
-}
-
-bool CBRGenerator::GeneratorLoop ()
-{
- double periodMs;
- int64_t nextSendTime = TickTime::MillisecondTimestamp();
-
-
- // no critSect
- while (_running)
- {
- // send data (critSect inside)
- generatePayload( static_cast<uint32_t>(nextSendTime * _rtpSampleRate / 1000) );
-
- // calculate wait time
- periodMs = 8.0 * _payloadSizeBytes / ( _bitrateKbps );
-
- nextSendTime = static_cast<int64_t>(nextSendTime + periodMs);
-
- int32_t waitTime = static_cast<int32_t>(nextSendTime - TickTime::MillisecondTimestamp());
- if (waitTime < 0)
- {
- waitTime = 0;
- }
- // wait
- _eventPtr->Wait(static_cast<int32_t>(waitTime));
- }
-
- return true;
-}
-
-int CBRGenerator::generatePayload ( uint32_t timestamp )
-{
- CriticalSectionScoped cs(_critSect);
-
- //uint8_t *payload = new uint8_t[_payloadSizeBytes];
-
- int ret = sendPayload(timestamp, _payload, _payloadSizeBytes);
-
- //delete [] payload;
- return ret;
-}
-
-
-
-
-/////////////////////
-
-CBRFixFRGenerator::CBRFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps,
- int32_t rtpSampleRate, int32_t frameRateFps /*= 30*/,
- double spread /*= 0.0*/)
-:
-//_eventPtr(NULL),
-_payloadSizeBytes(0),
-_payload(NULL),
-_payloadAllocLen(0),
-_frameRateFps(frameRateFps),
-_spreadFactor(spread),
-TestLoadGenerator(sender, rtpSampleRate)
-{
- SetBitrate (bitrateKbps);
-}
-
-CBRFixFRGenerator::~CBRFixFRGenerator ()
-{
- if (_running)
- {
- Stop();
- }
-
- if (_payload)
- {
- delete [] _payload;
- _payloadAllocLen = 0;
- }
-
-}
-
-bool CBRFixFRGenerator::GeneratorLoop ()
-{
- double periodMs;
- int64_t nextSendTime = TickTime::MillisecondTimestamp();
-
- _critSect.Enter();
-
- if (_frameRateFps <= 0)
- {
- return false;
- }
-
- _critSect.Leave();
-
- // no critSect
- while (_running)
- {
- _critSect.Enter();
-
- // calculate payload size
- _payloadSizeBytes = nextPayloadSize();
-
- if (_payloadSizeBytes > 0)
- {
-
- if (_payloadAllocLen < _payloadSizeBytes * (1 + _spreadFactor))
- {
- // re-allocate _payload
- if (_payload)
- {
- delete [] _payload;
- _payload = NULL;
- }
-
- _payloadAllocLen = static_cast<int32_t>((_payloadSizeBytes * (1 + _spreadFactor) * 3) / 2 + .5); // 50% extra to avoid frequent re-alloc
- _payload = new uint8_t[_payloadAllocLen];
- }
-
-
- // send data (critSect inside)
- generatePayload( static_cast<uint32_t>(nextSendTime * _rtpSampleRate / 1000) );
- }
-
- _critSect.Leave();
-
- // calculate wait time
- periodMs = 1000.0 / _frameRateFps;
- nextSendTime = static_cast<int64_t>(nextSendTime + periodMs + 0.5);
-
- int32_t waitTime = static_cast<int32_t>(nextSendTime - TickTime::MillisecondTimestamp());
- if (waitTime < 0)
- {
- waitTime = 0;
- }
- // wait
- _eventPtr->Wait(waitTime);
- }
-
- return true;
-}
-
-size_t CBRFixFRGenerator::nextPayloadSize()
-{
- const double periodMs = 1000.0 / _frameRateFps;
- return static_cast<size_t>(_bitrateKbps * periodMs / 8 + 0.5);
-}
-
-int CBRFixFRGenerator::generatePayload ( uint32_t timestamp )
-{
- CriticalSectionScoped cs(_critSect);
-
- double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5]
- factor = 1 + 2 * _spreadFactor * factor; // [1 - _spreadFactor ; 1 + _spreadFactor]
-
- size_t thisPayloadBytes = static_cast<size_t>(_payloadSizeBytes * factor);
- // sanity
- if (thisPayloadBytes > _payloadAllocLen)
- {
- thisPayloadBytes = _payloadAllocLen;
- }
-
- int ret = sendPayload(timestamp, _payload, thisPayloadBytes);
- return ret;
-}
-
-
-/////////////////////
-
-PeriodicKeyFixFRGenerator::PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps,
- int32_t rtpSampleRate, int32_t frameRateFps /*= 30*/,
- double spread /*= 0.0*/, double keyFactor /*= 4.0*/, uint32_t keyPeriod /*= 300*/)
-:
-_keyFactor(keyFactor),
-_keyPeriod(keyPeriod),
-_frameCount(0),
-CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, frameRateFps, spread)
-{
-}
-
-size_t PeriodicKeyFixFRGenerator::nextPayloadSize()
-{
- // calculate payload size for a delta frame
- size_t payloadSizeBytes = static_cast<size_t>(1000 * _bitrateKbps /
- (8.0 * _frameRateFps * (1.0 + (_keyFactor - 1.0) / _keyPeriod)) + 0.5);
-
- if (_frameCount % _keyPeriod == 0)
- {
- // this is a key frame, scale the payload size
- payloadSizeBytes =
- static_cast<size_t>(_keyFactor * _payloadSizeBytes + 0.5);
- }
- _frameCount++;
-
- return payloadSizeBytes;
-}
-
-////////////////////
-
-CBRVarFRGenerator::CBRVarFRGenerator(TestSenderReceiver *sender, int32_t bitrateKbps, const uint8_t* frameRates,
- uint16_t numFrameRates, int32_t rtpSampleRate, double avgFrPeriodMs,
- double frSpreadFactor, double spreadFactor)
-:
-_avgFrPeriodMs(avgFrPeriodMs),
-_frSpreadFactor(frSpreadFactor),
-_frameRates(NULL),
-_numFrameRates(numFrameRates),
-_frChangeTimeMs(TickTime::MillisecondTimestamp() + _avgFrPeriodMs),
-CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, frameRates[0], spreadFactor)
-{
- _frameRates = new uint8_t[_numFrameRates];
- memcpy(_frameRates, frameRates, _numFrameRates);
-}
-
-CBRVarFRGenerator::~CBRVarFRGenerator()
-{
- delete [] _frameRates;
-}
-
-void CBRVarFRGenerator::ChangeFrameRate()
-{
- const int64_t nowMs = TickTime::MillisecondTimestamp();
- if (nowMs < _frChangeTimeMs)
- {
- return;
- }
- // Time to change frame rate
- uint16_t frIndex = static_cast<uint16_t>(static_cast<double>(rand()) / RAND_MAX
- * (_numFrameRates - 1) + 0.5) ;
- assert(frIndex < _numFrameRates);
- _frameRateFps = _frameRates[frIndex];
- // Update the next frame rate change time
- double factor = ((double) rand() - RAND_MAX/2) / RAND_MAX; // [-0.5; 0.5]
- factor = 1 + 2 * _frSpreadFactor * factor; // [1 - _frSpreadFactor ; 1 + _frSpreadFactor]
- _frChangeTimeMs = nowMs + static_cast<int64_t>(1000.0 * factor *
- _avgFrPeriodMs + 0.5);
-
- printf("New frame rate: %d\n", _frameRateFps);
-}
-
-size_t CBRVarFRGenerator::nextPayloadSize()
-{
- ChangeFrameRate();
- return CBRFixFRGenerator::nextPayloadSize();
-}
-
-////////////////////
-
-CBRFrameDropGenerator::CBRFrameDropGenerator(TestSenderReceiver *sender, int32_t bitrateKbps,
- int32_t rtpSampleRate, double spreadFactor)
-:
-_accBits(0),
-CBRFixFRGenerator(sender, bitrateKbps, rtpSampleRate, 30, spreadFactor)
-{
-}
-
-CBRFrameDropGenerator::~CBRFrameDropGenerator()
-{
-}
-
-size_t CBRFrameDropGenerator::nextPayloadSize()
-{
- _accBits -= 1000 * _bitrateKbps / _frameRateFps;
- if (_accBits < 0)
- {
- _accBits = 0;
- }
- if (_accBits > 0.3 * _bitrateKbps * 1000)
- {
- //printf("drop\n");
- return 0;
- }
- else
- {
- //printf("keep\n");
- const double periodMs = 1000.0 / _frameRateFps;
- size_t frameSize =
- static_cast<size_t>(_bitrateKbps * periodMs / 8 + 0.5);
- frameSize =
- std::max(frameSize, static_cast<size_t>(300 * periodMs / 8 + 0.5));
- _accBits += frameSize * 8;
- return frameSize;
- }
-}
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h
deleted file mode 100644
index de92b96c72..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTLOADGENERATOR_H_
-#define WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTLOADGENERATOR_H_
-
-#include <stdlib.h>
-
-#include "webrtc/base/platform_thread.h"
-#include "webrtc/modules/include/module_common_types.h"
-#include "webrtc/typedefs.h"
-
-class TestSenderReceiver;
-namespace webrtc {
-class CriticalSectionWrapper;
-class EventWrapper;
-}
-
-class TestLoadGenerator
-{
-public:
- TestLoadGenerator (TestSenderReceiver *sender, int32_t rtpSampleRate = 90000);
- virtual ~TestLoadGenerator ();
-
- int32_t SetBitrate (int32_t newBitrateKbps);
- virtual int32_t Start (const char *threadName = NULL);
- virtual int32_t Stop ();
- virtual bool GeneratorLoop () = 0;
-
-protected:
- virtual int generatePayload ( uint32_t timestamp ) = 0;
- int generatePayload ();
- int sendPayload (const uint32_t timeStamp,
- const uint8_t* payloadData,
- const size_t payloadSize,
- const webrtc::FrameType frameType = webrtc::kVideoFrameDelta);
-
- webrtc::CriticalSectionWrapper* _critSect;
- webrtc::EventWrapper *_eventPtr;
- // TODO(pbos): Replace without pointer usage.
- rtc::scoped_ptr<rtc::PlatformThread> _genThread;
- int32_t _bitrateKbps;
- TestSenderReceiver *_sender;
- bool _running;
- int32_t _rtpSampleRate;
-};
-
-
-class CBRGenerator : public TestLoadGenerator
-{
-public:
- CBRGenerator (TestSenderReceiver *sender,
- size_t payloadSizeBytes,
- int32_t bitrateKbps,
- int32_t rtpSampleRate = 90000);
- virtual ~CBRGenerator ();
-
- virtual int32_t Start () {return (TestLoadGenerator::Start("CBRGenerator"));};
-
- virtual bool GeneratorLoop ();
-
-protected:
- virtual int generatePayload ( uint32_t timestamp );
-
- size_t _payloadSizeBytes;
- uint8_t *_payload;
-};
-
-
-class CBRFixFRGenerator : public TestLoadGenerator // constant bitrate and fixed frame rate
-{
-public:
- CBRFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps, int32_t rtpSampleRate = 90000,
- int32_t frameRateFps = 30, double spread = 0.0);
- virtual ~CBRFixFRGenerator ();
-
- virtual int32_t Start () {return (TestLoadGenerator::Start("CBRFixFRGenerator"));};
-
- virtual bool GeneratorLoop ();
-
-protected:
- virtual size_t nextPayloadSize ();
- virtual int generatePayload ( uint32_t timestamp );
-
- size_t _payloadSizeBytes;
- uint8_t *_payload;
- size_t _payloadAllocLen;
- int32_t _frameRateFps;
- double _spreadFactor;
-};
-
-class PeriodicKeyFixFRGenerator : public CBRFixFRGenerator // constant bitrate and fixed frame rate with periodically large frames
-{
-public:
- PeriodicKeyFixFRGenerator (TestSenderReceiver *sender, int32_t bitrateKbps, int32_t rtpSampleRate = 90000,
- int32_t frameRateFps = 30, double spread = 0.0, double keyFactor = 4.0, uint32_t keyPeriod = 300);
- virtual ~PeriodicKeyFixFRGenerator () {}
-
-protected:
- virtual size_t nextPayloadSize ();
-
- double _keyFactor;
- uint32_t _keyPeriod;
- uint32_t _frameCount;
-};
-
-// Probably better to inherit CBRFixFRGenerator from CBRVarFRGenerator, but since
-// the fix FR version already existed this was easier.
-class CBRVarFRGenerator : public CBRFixFRGenerator // constant bitrate and variable frame rate
-{
-public:
- CBRVarFRGenerator(TestSenderReceiver *sender, int32_t bitrateKbps, const uint8_t* frameRates,
- uint16_t numFrameRates, int32_t rtpSampleRate = 90000, double avgFrPeriodMs = 5.0,
- double frSpreadFactor = 0.05, double spreadFactor = 0.0);
-
- ~CBRVarFRGenerator();
-
-protected:
- virtual void ChangeFrameRate();
- virtual size_t nextPayloadSize ();
-
- double _avgFrPeriodMs;
- double _frSpreadFactor;
- uint8_t* _frameRates;
- uint16_t _numFrameRates;
- int64_t _frChangeTimeMs;
-};
-
-class CBRFrameDropGenerator : public CBRFixFRGenerator // constant bitrate and variable frame rate
-{
-public:
- CBRFrameDropGenerator(TestSenderReceiver *sender, int32_t bitrateKbps,
- int32_t rtpSampleRate = 90000, double spreadFactor = 0.0);
-
- ~CBRFrameDropGenerator();
-
-protected:
- virtual size_t nextPayloadSize();
-
- double _accBits;
-};
-
-#endif // WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTLOADGENERATOR_H_
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc
deleted file mode 100644
index 34dcfc4299..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.cc
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
-#include "webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.h"
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/include/event_wrapper.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
-#include "webrtc/test/channel_transport/udp_transport.h"
-
-#define NR_OF_SOCKET_BUFFERS 500
-
-
-bool ProcThreadFunction(void *obj)
-{
- if (obj == NULL)
- {
- return false;
- }
- TestSenderReceiver *theObj = static_cast<TestSenderReceiver *>(obj);
-
- return theObj->ProcLoop();
-}
-
-
-TestSenderReceiver::TestSenderReceiver (void)
-:
-_critSect(CriticalSectionWrapper::CreateCriticalSection()),
-_eventPtr(NULL),
-_procThread(ProcThreadFunction, this, "TestSenderReceiver"),
-_running(false),
-_payloadType(0),
-_loadGenerator(NULL),
-_isSender(false),
-_isReceiver(false),
-_sendRecCB(NULL),
-_lastBytesReceived(0),
-_lastTime(-1)
-{
- // RTP/RTCP module
- _rtp = RtpRtcp::CreateRtpRtcp(0, false);
- if (!_rtp)
- {
- throw "Could not create RTP/RTCP module";
- exit(1);
- }
-
- if (_rtp->InitReceiver() != 0)
- {
- throw "_rtp->InitReceiver()";
- exit(1);
- }
-
- if (_rtp->InitSender() != 0)
- {
- throw "_rtp->InitSender()";
- exit(1);
- }
-
- // SocketTransport module
- uint8_t numberOfThreads = 1;
- _transport = UdpTransport::Create(0, numberOfThreads);
- if (!_transport)
- {
- throw "Could not create transport module";
- exit(1);
- }
-}
-
-TestSenderReceiver::~TestSenderReceiver (void)
-{
-
- Stop(); // N.B. without critSect
-
- _critSect->Enter();
-
- if (_rtp)
- {
- RtpRtcp::DestroyRtpRtcp(_rtp);
- _rtp = NULL;
- }
-
- if (_transport)
- {
- UdpTransport::Destroy(_transport);
- _transport = NULL;
- }
-
- delete _critSect;
-
-}
-
-
-int32_t TestSenderReceiver::InitReceiver (const uint16_t rtpPort,
- const uint16_t rtcpPort,
- const int8_t payloadType /*= 127*/)
-{
- CriticalSectionScoped cs(_critSect);
-
- // init transport
- if (_transport->InitializeReceiveSockets(this, rtpPort/*, 0, NULL, 0, true*/) != 0)
- {
- throw "_transport->InitializeReceiveSockets";
- exit(1);
- }
-
- if (_rtp->RegisterIncomingRTPCallback(this) != 0)
- {
- throw "_rtp->RegisterIncomingRTPCallback";
- exit(1);
- }
-
- if (_rtp->RegisterIncomingDataCallback(this) != 0)
- {
- throw "_rtp->RegisterIncomingRTPCallback";
- exit(1);
- }
-
- if (_rtp->SetRTCPStatus(RtcpMode::kReducedSize) != 0) {
- throw "_rtp->SetRTCPStatus";
- exit(1);
- }
-
- if (_rtp->SetTMMBRStatus(true) != 0)
- {
- throw "_rtp->SetTMMBRStatus";
- exit(1);
- }
-
- if (_rtp->RegisterReceivePayload("I420", payloadType, 90000) != 0)
- {
- throw "_rtp->RegisterReceivePayload";
- exit(1);
- }
-
- _isReceiver = true;
-
- return (0);
-}
-
-
-int32_t TestSenderReceiver::Start()
-{
- CriticalSectionScoped cs(_critSect);
-
- _eventPtr = EventWrapper::Create();
-
- if (_rtp->SetSendingStatus(true) != 0)
- {
- throw "_rtp->SetSendingStatus";
- exit(1);
- }
-
- _running = true;
-
- if (_isReceiver)
- {
- if (_transport->StartReceiving(NR_OF_SOCKET_BUFFERS) != 0)
- {
- throw "_transport->StartReceiving";
- exit(1);
- }
- }
-
- _procThread.Start();
- _procThread.SetPriority(rtc::kRealtimePriority);
-
- return 0;
-
-}
-
-
-int32_t TestSenderReceiver::Stop ()
-{
- CriticalSectionScoped cs(_critSect);
-
- _transport->StopReceiving();
-
- if (_running)
- {
- _running = false;
- _eventPtr->Set();
-
- _procThread.Stop();
-
- delete _eventPtr;
- }
-
- return (0);
-}
-
-
-bool TestSenderReceiver::ProcLoop(void)
-{
-
- // process RTP/RTCP module
- _rtp->Process();
-
- // process SocketTransport module
- _transport->Process();
-
- // no critSect
- while (_running)
- {
- // ask RTP/RTCP module for wait time
- int32_t rtpWait = _rtp->TimeUntilNextProcess();
-
- // ask SocketTransport module for wait time
- int32_t tpWait = _transport->TimeUntilNextProcess();
-
- int32_t minWait = (rtpWait < tpWait) ? rtpWait: tpWait;
- minWait = (minWait > 0) ? minWait : 0;
- // wait
- _eventPtr->Wait(minWait);
-
- // process RTP/RTCP module
- _rtp->Process();
-
- // process SocketTransport module
- _transport->Process();
-
- }
-
- return true;
-}
-
-
-int32_t TestSenderReceiver::ReceiveBitrateKbps ()
-{
- size_t bytesSent;
- uint32_t packetsSent;
- size_t bytesReceived;
- uint32_t packetsReceived;
-
- if (_rtp->DataCountersRTP(&bytesSent, &packetsSent, &bytesReceived, &packetsReceived) == 0)
- {
- int64_t now = TickTime::MillisecondTimestamp();
- int32_t kbps = 0;
- if (now > _lastTime)
- {
- if (_lastTime > 0)
- {
- // 8 * bytes / ms = kbps
- kbps = static_cast<int32_t>(
- (8 * (bytesReceived - _lastBytesReceived)) / (now - _lastTime));
- }
- _lastTime = now;
- _lastBytesReceived = bytesReceived;
- }
- return (kbps);
- }
-
- return (-1);
-}
-
-
-int32_t TestSenderReceiver::SetPacketTimeout(const uint32_t timeoutMS)
-{
- return (_rtp->SetPacketTimeout(timeoutMS, 0 /* RTCP timeout */));
-}
-
-
-int32_t TestSenderReceiver::OnReceivedPayloadData(const uint8_t* payloadData,
- const size_t payloadSize,
- const webrtc::WebRtcRTPHeader* rtpHeader)
-{
- //printf("OnReceivedPayloadData\n");
- return (0);
-}
-
-
-void TestSenderReceiver::IncomingRTPPacket(const int8_t* incomingRtpPacket,
- const size_t rtpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort)
-{
- _rtp->IncomingPacket((uint8_t *) incomingRtpPacket, rtpPacketLength);
-}
-
-
-
-void TestSenderReceiver::IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
- const size_t rtcpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort)
-{
- _rtp->IncomingPacket((uint8_t *) incomingRtcpPacket, rtcpPacketLength);
-}
-
-
-
-
-
-///////////////////
-
-
-int32_t TestSenderReceiver::InitSender (const uint32_t startBitrateKbps,
- const int8_t* ipAddr,
- const uint16_t rtpPort,
- const uint16_t rtcpPort /*= 0*/,
- const int8_t payloadType /*= 127*/)
-{
- CriticalSectionScoped cs(_critSect);
-
- _payloadType = payloadType;
-
- // check load generator valid
- if (_loadGenerator)
- {
- _loadGenerator->SetBitrate(startBitrateKbps);
- }
-
- if (_rtp->RegisterSendTransport(_transport) != 0)
- {
- throw "_rtp->RegisterSendTransport";
- exit(1);
- }
- if (_rtp->RegisterSendPayload("I420", _payloadType, 90000) != 0)
- {
- throw "_rtp->RegisterSendPayload";
- exit(1);
- }
-
- if (_rtp->RegisterIncomingVideoCallback(this) != 0)
- {
- throw "_rtp->RegisterIncomingVideoCallback";
- exit(1);
- }
-
- if (_rtp->SetRTCPStatus(RtcpMode::kReducedSize) != 0) {
- throw "_rtp->SetRTCPStatus";
- exit(1);
- }
-
- if (_rtp->SetSendBitrate(startBitrateKbps*1000, 0, MAX_BITRATE_KBPS) != 0)
- {
- throw "_rtp->SetSendBitrate";
- exit(1);
- }
-
-
- // SocketTransport
- if (_transport->InitializeSendSockets(ipAddr, rtpPort, rtcpPort))
- {
- throw "_transport->InitializeSendSockets";
- exit(1);
- }
-
- _isSender = true;
-
- return (0);
-}
-
-
-
-int32_t
-TestSenderReceiver::SendOutgoingData(const uint32_t timeStamp,
- const uint8_t* payloadData,
- const size_t payloadSize,
- const webrtc::FrameType frameType /*= webrtc::kVideoFrameDelta*/)
-{
- return (_rtp->SendOutgoingData(frameType, _payloadType, timeStamp, payloadData, payloadSize));
-}
-
-
-int32_t TestSenderReceiver::SetLoadGenerator(TestLoadGenerator *generator)
-{
- CriticalSectionScoped cs(_critSect);
-
- _loadGenerator = generator;
- return(0);
-
-}
-
-void TestSenderReceiver::OnNetworkChanged(const int32_t id,
- const uint32_t minBitrateBps,
- const uint32_t maxBitrateBps,
- const uint8_t fractionLost,
- const uint16_t roundTripTimeMs,
- const uint16_t bwEstimateKbitMin,
- const uint16_t bwEstimateKbitMax)
-{
- if (_loadGenerator)
- {
- _loadGenerator->SetBitrate(maxBitrateBps/1000);
- }
-
- if (_sendRecCB)
- {
- _sendRecCB->OnOnNetworkChanged(maxBitrateBps,
- fractionLost,
- roundTripTimeMs,
- bwEstimateKbitMin,
- bwEstimateKbitMax);
- }
-}
diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h
deleted file mode 100644
index 7e3513403c..0000000000
--- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTSENDERRECEIVER_H_
-#define WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTSENDERRECEIVER_H_
-
-#include "webrtc/base/platform_thread.h"
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
-#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "webrtc/test/channel_transport/udp_transport.h"
-#include "webrtc/typedefs.h"
-
-class TestLoadGenerator;
-namespace webrtc {
-class CriticalSectionWrapper;
-class EventWrapper;
-
-#define MAX_BITRATE_KBPS 50000
-
-
-class SendRecCB
-{
-public:
- virtual void OnOnNetworkChanged(const uint32_t bitrateTarget,
- const uint8_t fractionLost,
- const uint16_t roundTripTimeMs,
- const uint16_t bwEstimateKbitMin,
- const uint16_t bwEstimateKbitMax) = 0;
-
- virtual ~SendRecCB() {};
-};
-
-
-class TestSenderReceiver : public RtpFeedback, public RtpData, public UdpTransportData, public RtpVideoFeedback
-{
-
-public:
- TestSenderReceiver (void);
-
- ~TestSenderReceiver (void);
-
- void SetCallback (SendRecCB *cb) { _sendRecCB = cb; };
-
- int32_t Start();
-
- int32_t Stop();
-
- bool ProcLoop();
-
- /////////////////////////////////////////////
- // Receiver methods
-
- int32_t InitReceiver (const uint16_t rtpPort,
- const uint16_t rtcpPort = 0,
- const int8_t payloadType = 127);
-
- int32_t ReceiveBitrateKbps ();
-
- int32_t SetPacketTimeout(const uint32_t timeoutMS);
-
- // Inherited from RtpFeedback
- int32_t OnInitializeDecoder(const int32_t id,
- const int8_t payloadType,
- const int8_t payloadName[RTP_PAYLOAD_NAME_SIZE],
- const uint32_t frequency,
- const uint8_t channels,
- const uint32_t rate) override {
- return 0;
- }
-
- void OnIncomingSSRCChanged(const int32_t id, const uint32_t SSRC) override {
- }
-
- void OnIncomingCSRCChanged(const int32_t id,
- const uint32_t CSRC,
- const bool added) override {}
-
- // Inherited from RtpData
- int32_t OnReceivedPayloadData(
- const uint8_t* payloadData,
- const size_t payloadSize,
- const webrtc::WebRtcRTPHeader* rtpHeader) override;
-
- // Inherited from UdpTransportData
- void IncomingRTPPacket(const int8_t* incomingRtpPacket,
- const size_t rtpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort) override;
-
- void IncomingRTCPPacket(const int8_t* incomingRtcpPacket,
- const size_t rtcpPacketLength,
- const int8_t* fromIP,
- const uint16_t fromPort) override;
-
- /////////////////////////////////
- // Sender methods
-
- int32_t InitSender (const uint32_t startBitrateKbps,
- const int8_t* ipAddr,
- const uint16_t rtpPort,
- const uint16_t rtcpPort = 0,
- const int8_t payloadType = 127);
-
- int32_t SendOutgoingData(const uint32_t timeStamp,
- const uint8_t* payloadData,
- const size_t payloadSize,
- const webrtc::FrameType frameType = webrtc::kVideoFrameDelta);
-
- int32_t SetLoadGenerator(TestLoadGenerator *generator);
-
- uint32_t BitrateSent() { return (_rtp->BitrateSent()); };
-
-
- // Inherited from RtpVideoFeedback
- virtual void OnReceivedIntraFrameRequest(const int32_t id,
- const uint8_t message = 0) {};
-
- virtual void OnNetworkChanged(const int32_t id,
- const uint32_t minBitrateBps,
- const uint32_t maxBitrateBps,
- const uint8_t fractionLost,
- const uint16_t roundTripTimeMs,
- const uint16_t bwEstimateKbitMin,
- const uint16_t bwEstimateKbitMax);
-
-private:
- RtpRtcp* _rtp;
- UdpTransport* _transport;
- webrtc::CriticalSectionWrapper* _critSect;
- webrtc::EventWrapper *_eventPtr;
- rtc::PlatformThread _procThread;
- bool _running;
- int8_t _payloadType;
- TestLoadGenerator* _loadGenerator;
- bool _isSender;
- bool _isReceiver;
- SendRecCB * _sendRecCB;
- size_t _lastBytesReceived;
- int64_t _lastTime;
-
-};
-} // namespace webrtc
-#endif // WEBRTC_MODULES_RTP_RTCP_TEST_BWESTANDALONE_TESTSENDERRECEIVER_H_
diff --git a/webrtc/modules/rtp_rtcp/test/bwe_standalone.gypi b/webrtc/modules/rtp_rtcp/test/bwe_standalone.gypi
deleted file mode 100644
index e45daec77d..0000000000
--- a/webrtc/modules/rtp_rtcp/test/bwe_standalone.gypi
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS. All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-{
- 'targets': [
- {
- 'target_name': 'bwe_standalone',
- 'type': 'executable',
- 'dependencies': [
- 'matlab_plotting',
- 'rtp_rtcp',
- 'udp_transport',
- '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
- ],
- 'sources': [
- 'BWEStandAlone/BWEStandAlone.cc',
- 'BWEStandAlone/TestLoadGenerator.cc',
- 'BWEStandAlone/TestLoadGenerator.h',
- 'BWEStandAlone/TestSenderReceiver.cc',
- 'BWEStandAlone/TestSenderReceiver.h',
- ], # source
- 'conditions': [
- ['OS=="linux"', {
- 'cflags': [
- '-fexceptions', # enable exceptions
- ],
- },
- ],
- ],
- },
-
- {
- 'target_name': 'matlab_plotting',
- 'type': 'static_library',
- 'dependencies': [
- 'matlab_plotting_include',
- '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
- ],
- 'include_dirs': [
- '/opt/matlab2010a/extern/include',
- ],
- 'export_dependent_settings': [
- 'matlab_plotting_include',
- ],
- 'sources': [
- 'BWEStandAlone/MatlabPlot.cc',
- 'BWEStandAlone/MatlabPlot.h',
- ],
- 'link_settings': {
- 'ldflags' : [
- '-L/opt/matlab2010a/bin/glnxa64',
- '-leng',
- '-lmx',
- '-Wl,-rpath,/opt/matlab2010a/bin/glnxa64',
- ],
- },
- 'defines': [
- 'MATLAB',
- ],
- 'conditions': [
- ['OS=="linux"', {
- 'cflags': [
- '-fexceptions', # enable exceptions
- ],
- },
- ],
- ],
- },
-
- {
- 'target_name': 'matlab_plotting_include',
- 'type': 'none',
- 'direct_dependent_settings': {
- 'include_dirs': [
- 'BWEStandAlone',
- ],
- },
- },
- ],
-}