Move video_coding to new Clock interface and remove fake clock implementations from RTP module tests.
TEST=video_coding_unittests, video_coding_integrationtests, rtp_rtcp_unittests, trybots Review URL: https://webrtc-codereview.appspot.com/1044004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3393 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
#include "trace.h"
|
||||
#include "../source/event.h"
|
||||
#include "rtp_player.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@ -64,7 +64,7 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
|
||||
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
// TODO(hlundin): This test was not verified after changing to FakeTickTime.
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2, &clock);
|
||||
@ -125,9 +125,9 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
ret = 0;
|
||||
|
||||
// RTP stream main loop
|
||||
while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
|
||||
while ((ret = rtpStream.NextPacket(clock.TimeInMilliseconds())) == 0)
|
||||
{
|
||||
if (clock.MillisecondTimestamp() % 5 == 0)
|
||||
if (clock.TimeInMilliseconds() % 5 == 0)
|
||||
{
|
||||
ret = vcm->Decode();
|
||||
if (ret < 0)
|
||||
@ -139,11 +139,11 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
{
|
||||
vcm->Process();
|
||||
}
|
||||
if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >= MAX_RUNTIME_MS)
|
||||
if (MAX_RUNTIME_MS > -1 && clock.TimeInMilliseconds() >= MAX_RUNTIME_MS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
clock.IncrementDebugClock(1);
|
||||
clock.AdvanceTimeMilliseconds(1);
|
||||
}
|
||||
|
||||
switch (ret)
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include "rtp_rtcp.h"
|
||||
#include "common_video/interface/i420_video_frame.h"
|
||||
#include "test_macros.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@ -27,7 +27,7 @@ int GenericCodecTest::RunTest(CmdArgs& args)
|
||||
printf("\n\nEnable debug events to run this test!\n\n");
|
||||
return -1;
|
||||
#endif
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
|
||||
Trace::CreateTrace();
|
||||
@ -41,7 +41,8 @@ int GenericCodecTest::RunTest(CmdArgs& args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm, FakeTickTime* clock):
|
||||
GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm,
|
||||
SimulatedClock* clock):
|
||||
_clock(clock),
|
||||
_vcm(vcm),
|
||||
_width(0),
|
||||
@ -332,10 +333,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
IncrementDebugClock(_frameRate);
|
||||
// The following should be uncommneted for timing tests. Release tests only include
|
||||
// compliance with full sequence bit rate.
|
||||
|
||||
|
||||
//totalBytes = WaitForEncodedFrame();
|
||||
//currentTime = VCMTickTime::MillisecondTimestamp();//clock()/(double)CLOCKS_PER_SEC;
|
||||
if (_frameCnt == _frameRate)// @ 1sec
|
||||
{
|
||||
totalBytesOneSec = _encodeCompleteCallback->EncodedBytes();//totalBytes;
|
||||
@ -482,8 +479,8 @@ GenericCodecTest::Print()
|
||||
float
|
||||
GenericCodecTest::WaitForEncodedFrame() const
|
||||
{
|
||||
WebRtc_Word64 startTime = _clock->MillisecondTimestamp();
|
||||
while (_clock->MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs*10)
|
||||
WebRtc_Word64 startTime = _clock->TimeInMilliseconds();
|
||||
while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10)
|
||||
{
|
||||
if (_encodeCompleteCallback->EncodeComplete())
|
||||
{
|
||||
@ -496,7 +493,7 @@ GenericCodecTest::WaitForEncodedFrame() const
|
||||
void
|
||||
GenericCodecTest::IncrementDebugClock(float frameRate)
|
||||
{
|
||||
_clock->IncrementDebugClock(1000/frameRate);
|
||||
_clock->AdvanceTimeMilliseconds(1000/frameRate);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@ -31,13 +31,13 @@ namespace webrtc {
|
||||
|
||||
int VCMGenericCodecTest(CmdArgs& args);
|
||||
|
||||
class FakeTickTime;
|
||||
class SimulatedClock;
|
||||
|
||||
class GenericCodecTest
|
||||
{
|
||||
public:
|
||||
GenericCodecTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::FakeTickTime* clock);
|
||||
webrtc::SimulatedClock* clock);
|
||||
~GenericCodecTest();
|
||||
static int RunTest(CmdArgs& args);
|
||||
WebRtc_Word32 Perform(CmdArgs& args);
|
||||
@ -49,7 +49,7 @@ private:
|
||||
WebRtc_Word32 TearDown();
|
||||
void IncrementDebugClock(float frameRate);
|
||||
|
||||
webrtc::FakeTickTime* _clock;
|
||||
webrtc::SimulatedClock* _clock;
|
||||
webrtc::VideoCodingModule* _vcm;
|
||||
webrtc::VideoCodec _sendCodec;
|
||||
webrtc::VideoCodec _receiveCodec;
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
#include "jitter_estimate_test.h"
|
||||
#include "jitter_estimator.h"
|
||||
#include "media_opt_util.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "packet.h"
|
||||
#include "test_util.h"
|
||||
#include "test_macros.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
// TODO(holmer): Get rid of this to conform with style guide.
|
||||
using namespace webrtc;
|
||||
@ -97,7 +97,7 @@ int JitterBufferTest(CmdArgs& args)
|
||||
#if defined(EVENT_DEBUG)
|
||||
return -1;
|
||||
#endif
|
||||
TickTimeBase clock;
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
|
||||
// Start test
|
||||
WebRtc_UWord16 seqNum = 1234;
|
||||
@ -106,7 +106,7 @@ int JitterBufferTest(CmdArgs& args)
|
||||
WebRtc_UWord8 data[1500];
|
||||
VCMPacket packet(data, size, seqNum, timeStamp, true);
|
||||
|
||||
VCMJitterBuffer jb(&clock);
|
||||
VCMJitterBuffer jb(clock);
|
||||
|
||||
seqNum = 1234;
|
||||
timeStamp = 123*90;
|
||||
|
||||
@ -32,9 +32,9 @@ int MediaOptTest::RunTest(int testNum, CmdArgs& args)
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((test::OutputPath() + "mediaOptTestTrace.txt").c_str());
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
TickTimeBase clock;
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
MediaOptTest* mot = new MediaOptTest(vcm, &clock);
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
||||
MediaOptTest* mot = new MediaOptTest(vcm, clock);
|
||||
if (testNum == 0)
|
||||
{ // regular
|
||||
mot->Setup(0, args);
|
||||
@ -65,7 +65,7 @@ int MediaOptTest::RunTest(int testNum, CmdArgs& args)
|
||||
}
|
||||
|
||||
|
||||
MediaOptTest::MediaOptTest(VideoCodingModule* vcm, TickTimeBase* clock)
|
||||
MediaOptTest::MediaOptTest(VideoCodingModule* vcm, Clock* clock)
|
||||
: _vcm(vcm),
|
||||
_rtp(NULL),
|
||||
_outgoingTransport(NULL),
|
||||
|
||||
@ -34,7 +34,7 @@ class MediaOptTest
|
||||
{
|
||||
public:
|
||||
MediaOptTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
~MediaOptTest();
|
||||
|
||||
static int RunTest(int testNum, CmdArgs& args);
|
||||
@ -57,7 +57,7 @@ private:
|
||||
webrtc::RTPSendCompleteCallback* _outgoingTransport;
|
||||
RtpDataCallback* _dataCallback;
|
||||
|
||||
webrtc::TickTimeBase* _clock;
|
||||
webrtc::Clock* _clock;
|
||||
std::string _inname;
|
||||
std::string _outname;
|
||||
std::string _actualSourcename;
|
||||
|
||||
@ -143,12 +143,12 @@ int MTRxTxTest(CmdArgs& args)
|
||||
printf("Cannot read file %s.\n", outname.c_str());
|
||||
return -1;
|
||||
}
|
||||
TickTimeBase clock;
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
|
||||
RTPSendCompleteCallback* outgoingTransport =
|
||||
new RTPSendCompleteCallback(&clock, "dump.rtp");
|
||||
new RTPSendCompleteCallback(clock, "dump.rtp");
|
||||
|
||||
RtpRtcp::Configuration configuration;
|
||||
configuration.id = 1;
|
||||
|
||||
@ -12,12 +12,12 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "rtp_dump.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
TransportCallback::TransportCallback(TickTimeBase* clock, const char* filename)
|
||||
TransportCallback::TransportCallback(Clock* clock, const char* filename)
|
||||
: RTPSendCompleteCallback(clock, filename) {
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
|
||||
transmitPacket = PacketLoss();
|
||||
}
|
||||
|
||||
TickTimeBase clock;
|
||||
int64_t now = clock.MillisecondTimestamp();
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
int64_t now = clock->TimeInMilliseconds();
|
||||
// Insert outgoing packet into list
|
||||
if (transmitPacket)
|
||||
{
|
||||
@ -72,8 +72,8 @@ TransportCallback::TransportPackets()
|
||||
{
|
||||
// Are we ready to send packets to the receiver?
|
||||
RtpPacket* packet = NULL;
|
||||
TickTimeBase clock;
|
||||
int64_t now = clock.MillisecondTimestamp();
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
int64_t now = clock->TimeInMilliseconds();
|
||||
|
||||
while (!_rtpPackets.empty())
|
||||
{
|
||||
|
||||
@ -47,7 +47,7 @@ class TransportCallback:public RTPSendCompleteCallback
|
||||
{
|
||||
public:
|
||||
// constructor input: (receive side) rtp module to send encoded data to
|
||||
TransportCallback(TickTimeBase* clock, const char* filename = NULL);
|
||||
TransportCallback(Clock* clock, const char* filename = NULL);
|
||||
virtual ~TransportCallback();
|
||||
// Add packets to list
|
||||
// Incorporate network conditions - delay and packet loss
|
||||
|
||||
@ -18,12 +18,12 @@
|
||||
#include "../source/event.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "common_types.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "test_callbacks.h"
|
||||
#include "test_macros.h"
|
||||
#include "test_util.h"
|
||||
#include "trace.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@ -31,17 +31,18 @@ int NormalTest::RunTest(const CmdArgs& args)
|
||||
{
|
||||
#if defined(EVENT_DEBUG)
|
||||
printf("SIMULATION TIME\n");
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock sim_clock;
|
||||
SimulatedClock* clock = &sim_clock;
|
||||
#else
|
||||
printf("REAL-TIME\n");
|
||||
TickTimeBase clock;
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
#endif
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile(
|
||||
(test::OutputPath() + "VCMNormalTestTrace.txt").c_str());
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
NormalTest VCMNTest(vcm, &clock);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
||||
NormalTest VCMNTest(vcm, clock);
|
||||
VCMNTest.Perform(args);
|
||||
VideoCodingModule::Destroy(vcm);
|
||||
Trace::ReturnTrace();
|
||||
@ -183,7 +184,7 @@ VCMNTDecodeCompleCallback::DecodedBytes()
|
||||
|
||||
//VCM Normal Test Class implementation
|
||||
|
||||
NormalTest::NormalTest(VideoCodingModule* vcm, TickTimeBase* clock)
|
||||
NormalTest::NormalTest(VideoCodingModule* vcm, Clock* clock)
|
||||
:
|
||||
_clock(clock),
|
||||
_vcm(vcm),
|
||||
@ -289,7 +290,7 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
|
||||
while (feof(_sourceFile) == 0) {
|
||||
#if !defined(EVENT_DEBUG)
|
||||
WebRtc_Word64 processStartTime = _clock->MillisecondTimestamp();
|
||||
WebRtc_Word64 processStartTime = _clock->TimeInMilliseconds();
|
||||
#endif
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
||||
feof(_sourceFile));
|
||||
@ -332,10 +333,10 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
||||
|
||||
#if defined(EVENT_DEBUG)
|
||||
static_cast<FakeTickTime*>(_clock)->IncrementDebugClock(framePeriod);
|
||||
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
|
||||
#else
|
||||
WebRtc_Word64 timeSpent =
|
||||
_clock->MillisecondTimestamp() - processStartTime;
|
||||
_clock->TimeInMilliseconds() - processStartTime;
|
||||
if (timeSpent < framePeriod)
|
||||
{
|
||||
waitEvent->Wait(framePeriod - timeSpent);
|
||||
|
||||
@ -86,7 +86,7 @@ class NormalTest
|
||||
{
|
||||
public:
|
||||
NormalTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
~NormalTest();
|
||||
static int RunTest(const CmdArgs& args);
|
||||
WebRtc_Word32 Perform(const CmdArgs& args);
|
||||
@ -108,7 +108,7 @@ protected:
|
||||
// calculating pipeline delay, and decoding time
|
||||
void FrameDecoded(WebRtc_UWord32 timeStamp);
|
||||
|
||||
webrtc::TickTimeBase* _clock;
|
||||
webrtc::Clock* _clock;
|
||||
webrtc::VideoCodingModule* _vcm;
|
||||
webrtc::VideoCodec _sendCodec;
|
||||
webrtc::VideoCodec _receiveCodec;
|
||||
|
||||
@ -17,20 +17,19 @@
|
||||
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/main/source/event.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "modules/video_coding/main/test/test_callbacks.h"
|
||||
#include "modules/video_coding/main/test/test_macros.h"
|
||||
#include "modules/video_coding/main/test/test_util.h"
|
||||
#include "system_wrappers/interface/data_log.h"
|
||||
#include "system_wrappers/interface/data_log.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
int qualityModeTest(const CmdArgs& args)
|
||||
{
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
QualityModesTest QMTest(vcm, &clock);
|
||||
QMTest.Perform(args);
|
||||
@ -39,7 +38,7 @@ int qualityModeTest(const CmdArgs& args)
|
||||
}
|
||||
|
||||
QualityModesTest::QualityModesTest(VideoCodingModule* vcm,
|
||||
TickTimeBase* clock):
|
||||
Clock* clock):
|
||||
NormalTest(vcm, clock),
|
||||
_vpm()
|
||||
{
|
||||
@ -367,8 +366,8 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
DataLog::InsertCell(feature_table_name_, "frame rate", _nativeFrameRate);
|
||||
DataLog::NextRow(feature_table_name_);
|
||||
|
||||
static_cast<FakeTickTime*>(
|
||||
_clock)->IncrementDebugClock(1000 / _nativeFrameRate);
|
||||
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(
|
||||
1000 / _nativeFrameRate);
|
||||
}
|
||||
|
||||
} while (feof(_sourceFile) == 0);
|
||||
|
||||
@ -22,7 +22,7 @@ class QualityModesTest : public NormalTest
|
||||
{
|
||||
public:
|
||||
QualityModesTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
virtual ~QualityModesTest();
|
||||
WebRtc_Word32 Perform(const CmdArgs& args);
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
// A static random seed
|
||||
srand(0);
|
||||
|
||||
TickTimeBase clock;
|
||||
VCMTiming timing(&clock);
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VCMTiming timing(clock);
|
||||
float clockInMs = 0.0;
|
||||
WebRtc_UWord32 waitTime = 0;
|
||||
WebRtc_UWord32 jitterDelayMs = 0;
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
|
||||
#include "../source/internal_defines.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "rtp_rtcp.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@ -137,7 +137,7 @@ void LostPackets::Print() const {
|
||||
|
||||
RTPPlayer::RTPPlayer(const char* filename,
|
||||
RtpData* callback,
|
||||
TickTimeBase* clock)
|
||||
Clock* clock)
|
||||
:
|
||||
_clock(clock),
|
||||
_rtpModule(NULL),
|
||||
@ -273,7 +273,8 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
|
||||
|
||||
WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const
|
||||
{
|
||||
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - (_clock->MillisecondTimestamp() - _firstPacketTimeMs);
|
||||
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) -
|
||||
(_clock->TimeInMilliseconds() - _firstPacketTimeMs);
|
||||
if (timeLeft < 0)
|
||||
{
|
||||
return 0;
|
||||
@ -293,7 +294,7 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
delete resend_packet;
|
||||
_resendPacketCount++;
|
||||
if (ret > 0) {
|
||||
_lostPackets.SetPacketResent(seqNo, _clock->MillisecondTimestamp());
|
||||
_lostPackets.SetPacketResent(seqNo, _clock->TimeInMilliseconds());
|
||||
} else if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
@ -307,7 +308,7 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
if (_firstPacket)
|
||||
{
|
||||
_firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
|
||||
_firstPacketTimeMs = _clock->MillisecondTimestamp();
|
||||
_firstPacketTimeMs = _clock->TimeInMilliseconds();
|
||||
}
|
||||
if (_reordering && _reorderBuffer == NULL)
|
||||
{
|
||||
@ -428,8 +429,8 @@ WebRtc_Word32 RTPPlayer::ResendPackets(const WebRtc_UWord16* sequenceNumbers, We
|
||||
for (int i=0; i < length; i++)
|
||||
{
|
||||
_lostPackets.SetResendTime(sequenceNumbers[i],
|
||||
_clock->MillisecondTimestamp() + _rttMs,
|
||||
_clock->MillisecondTimestamp());
|
||||
_clock->TimeInMilliseconds() + _rttMs,
|
||||
_clock->TimeInMilliseconds());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include "rtp_rtcp.h"
|
||||
#include "critical_section_wrapper.h"
|
||||
#include "video_coding_defines.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <list>
|
||||
@ -78,7 +78,7 @@ class RTPPlayer : public webrtc::VCMPacketRequestCallback
|
||||
public:
|
||||
RTPPlayer(const char* filename,
|
||||
webrtc::RtpData* callback,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
virtual ~RTPPlayer();
|
||||
|
||||
WebRtc_Word32 Initialize(const PayloadTypeList* payloadList);
|
||||
@ -93,7 +93,7 @@ private:
|
||||
WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
||||
WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset);
|
||||
WebRtc_Word32 ReadHeader();
|
||||
webrtc::TickTimeBase* _clock;
|
||||
webrtc::Clock* _clock;
|
||||
FILE* _rtpFile;
|
||||
webrtc::RtpRtcp* _rtpModule;
|
||||
WebRtc_UWord32 _nextRtpTime;
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "rtp_dump.h"
|
||||
#include "test_macros.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -204,7 +204,7 @@ VCMDecodeCompleteCallback::DecodedBytes()
|
||||
return _decodedBytes;
|
||||
}
|
||||
|
||||
RTPSendCompleteCallback::RTPSendCompleteCallback(TickTimeBase* clock,
|
||||
RTPSendCompleteCallback::RTPSendCompleteCallback(Clock* clock,
|
||||
const char* filename):
|
||||
_clock(clock),
|
||||
_sendCount(0),
|
||||
@ -258,7 +258,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
bool transmitPacket = true;
|
||||
transmitPacket = PacketLoss();
|
||||
|
||||
WebRtc_UWord64 now = _clock->MillisecondTimestamp();
|
||||
int64_t now = _clock->TimeInMilliseconds();
|
||||
// Insert outgoing packet into list
|
||||
if (transmitPacket)
|
||||
{
|
||||
|
||||
@ -157,7 +157,7 @@ class RTPSendCompleteCallback: public Transport
|
||||
{
|
||||
public:
|
||||
// Constructor input: (receive side) rtp module to send encoded data to
|
||||
RTPSendCompleteCallback(TickTimeBase* clock,
|
||||
RTPSendCompleteCallback(Clock* clock,
|
||||
const char* filename = NULL);
|
||||
virtual ~RTPSendCompleteCallback();
|
||||
|
||||
@ -186,7 +186,7 @@ protected:
|
||||
// Random uniform loss model
|
||||
bool UnifomLoss(double lossPct);
|
||||
|
||||
TickTimeBase* _clock;
|
||||
Clock* _clock;
|
||||
WebRtc_UWord32 _sendCount;
|
||||
RtpRtcp* _rtp;
|
||||
double _lossPct;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#include "../source/internal_defines.h"
|
||||
#include "test_macros.h"
|
||||
#include "rtp_player.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -130,7 +130,7 @@ int RtpPlay(CmdArgs& args)
|
||||
if (outFile == "")
|
||||
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
||||
FrameReceiveCallback receiveCallback(outFile);
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback, &clock);
|
||||
@ -198,9 +198,9 @@ int RtpPlay(CmdArgs& args)
|
||||
ret = 0;
|
||||
|
||||
// RTP stream main loop
|
||||
while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
|
||||
while ((ret = rtpStream.NextPacket(clock.TimeInMilliseconds())) == 0)
|
||||
{
|
||||
if (clock.MillisecondTimestamp() % 5 == 0)
|
||||
if (clock.TimeInMilliseconds() % 5 == 0)
|
||||
{
|
||||
ret = vcm->Decode();
|
||||
if (ret < 0)
|
||||
@ -214,12 +214,12 @@ int RtpPlay(CmdArgs& args)
|
||||
{
|
||||
vcm->Process();
|
||||
}
|
||||
if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >=
|
||||
if (MAX_RUNTIME_MS > -1 && clock.TimeInMilliseconds() >=
|
||||
MAX_RUNTIME_MS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
clock.IncrementDebugClock(1);
|
||||
clock.AdvanceTimeMilliseconds(1);
|
||||
}
|
||||
|
||||
// Tear down
|
||||
|
||||
@ -8,17 +8,18 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "receiver_tests.h"
|
||||
#include "video_coding.h"
|
||||
#include "rtp_rtcp.h"
|
||||
#include "trace.h"
|
||||
#include "thread_wrapper.h"
|
||||
#include "../source/event.h"
|
||||
#include "test_macros.h"
|
||||
#include "rtp_player.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||
#include "webrtc/modules/video_coding/main/source/event.h"
|
||||
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||
#include "webrtc/modules/video_coding/main/test/rtp_player.h"
|
||||
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
bool ProcessingThread(void* obj)
|
||||
@ -39,8 +40,8 @@ bool RtpReaderThread(void* obj)
|
||||
SharedState* state = static_cast<SharedState*>(obj);
|
||||
EventWrapper& waitEvent = *EventWrapper::Create();
|
||||
// RTP stream main loop
|
||||
TickTimeBase clock;
|
||||
if (state->_rtpPlayer.NextPacket(clock.MillisecondTimestamp()) < 0)
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
if (state->_rtpPlayer.NextPacket(clock->TimeInMilliseconds()) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -82,9 +83,9 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
(protection == kProtectionDualDecoder ||
|
||||
protection == kProtectionNack ||
|
||||
kProtectionNackFEC));
|
||||
TickTimeBase clock;
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VideoCodingModule* vcm =
|
||||
VideoCodingModule::Create(1, &clock);
|
||||
VideoCodingModule::Create(1, clock);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
std::string rtpFilename;
|
||||
rtpFilename = args.inputFile;
|
||||
@ -137,7 +138,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
}
|
||||
printf("Watch %s to verify that the output is reasonable\n", outFilename.c_str());
|
||||
}
|
||||
RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, &clock);
|
||||
RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, clock);
|
||||
PayloadTypeList payloadTypes;
|
||||
payloadTypes.push_front(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8",
|
||||
kVideoCodecVP8));
|
||||
@ -164,10 +165,10 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
}
|
||||
|
||||
// Create and start all threads
|
||||
ThreadWrapper* processingThread = ThreadWrapper::CreateThread(ProcessingThread,
|
||||
&mtState, kNormalPriority, "ProcessingThread");
|
||||
ThreadWrapper* rtpReaderThread = ThreadWrapper::CreateThread(RtpReaderThread,
|
||||
&mtState, kNormalPriority, "RtpReaderThread");
|
||||
ThreadWrapper* processingThread = ThreadWrapper::CreateThread(
|
||||
ProcessingThread, &mtState, kNormalPriority, "ProcessingThread");
|
||||
ThreadWrapper* rtpReaderThread = ThreadWrapper::CreateThread(
|
||||
RtpReaderThread, &mtState, kNormalPriority, "RtpReaderThread");
|
||||
ThreadWrapper* decodeThread = ThreadWrapper::CreateThread(DecodeThread,
|
||||
&mtState, kNormalPriority, "DecodeThread");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user