Revert "Inject TickTimeInterface into VCM and tests"
This CL reverts r1220. Review URL: http://webrtc-codereview.appspot.com/336002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1235 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e32c08a5a6
commit
303158588b
@ -18,7 +18,6 @@
|
|||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
class TickTimeInterface;
|
|
||||||
class VideoEncoder;
|
class VideoEncoder;
|
||||||
class VideoDecoder;
|
class VideoDecoder;
|
||||||
struct CodecSpecificInfo;
|
struct CodecSpecificInfo;
|
||||||
@ -28,9 +27,6 @@ class VideoCodingModule : public Module
|
|||||||
public:
|
public:
|
||||||
static VideoCodingModule* Create(const WebRtc_Word32 id);
|
static VideoCodingModule* Create(const WebRtc_Word32 id);
|
||||||
|
|
||||||
static VideoCodingModule* Create(const WebRtc_Word32 id,
|
|
||||||
TickTimeInterface* clock);
|
|
||||||
|
|
||||||
static void Destroy(VideoCodingModule* module);
|
static void Destroy(VideoCodingModule* module);
|
||||||
|
|
||||||
// Get number of supported codecs
|
// Get number of supported codecs
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "content_metrics_processing.h"
|
#include "content_metrics_processing.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
#include "video_coding_defines.h"
|
#include "video_coding_defines.h"
|
||||||
|
|
||||||
|
@ -12,15 +12,13 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "generic_decoder.h"
|
#include "generic_decoder.h"
|
||||||
#include "internal_defines.h"
|
#include "internal_defines.h"
|
||||||
#include "tick_time_interface.h"
|
#include "tick_time.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing,
|
VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing)
|
||||||
TickTimeInterface* clock)
|
|
||||||
:
|
:
|
||||||
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_clock(clock),
|
|
||||||
_receiveCallback(NULL),
|
_receiveCallback(NULL),
|
||||||
_timing(timing),
|
_timing(timing),
|
||||||
_timestampMap(kDecoderFrameMemoryLength)
|
_timestampMap(kDecoderFrameMemoryLength)
|
||||||
@ -55,7 +53,7 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(RawImage& decodedImage)
|
|||||||
_timing.StopDecodeTimer(
|
_timing.StopDecodeTimer(
|
||||||
decodedImage._timeStamp,
|
decodedImage._timeStamp,
|
||||||
frameInfo->decodeStartTimeMs,
|
frameInfo->decodeStartTimeMs,
|
||||||
_clock->MillisecondTimestamp());
|
VCMTickTime::MillisecondTimestamp());
|
||||||
|
|
||||||
if (_receiveCallback != NULL)
|
if (_receiveCallback != NULL)
|
||||||
{
|
{
|
||||||
@ -148,8 +146,7 @@ WebRtc_Word32 VCMGenericDecoder::InitDecode(const VideoCodec* settings,
|
|||||||
return _decoder.InitDecode(settings, numberOfCores);
|
return _decoder.InitDecode(settings, numberOfCores);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame,
|
WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame)
|
||||||
int64_t nowMs)
|
|
||||||
{
|
{
|
||||||
if (_requireKeyFrame &&
|
if (_requireKeyFrame &&
|
||||||
!_keyFrameDecoded &&
|
!_keyFrameDecoded &&
|
||||||
@ -160,7 +157,7 @@ WebRtc_Word32 VCMGenericDecoder::Decode(const VCMEncodedFrame& frame,
|
|||||||
// before we can decode delta frames.
|
// before we can decode delta frames.
|
||||||
return VCM_CODEC_ERROR;
|
return VCM_CODEC_ERROR;
|
||||||
}
|
}
|
||||||
_frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = nowMs;
|
_frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = VCMTickTime::MillisecondTimestamp();
|
||||||
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
|
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
|
||||||
_callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
|
_callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ struct VCMFrameInformation
|
|||||||
class VCMDecodedFrameCallback : public DecodedImageCallback
|
class VCMDecodedFrameCallback : public DecodedImageCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMDecodedFrameCallback(VCMTiming& timing, TickTimeInterface* clock);
|
VCMDecodedFrameCallback(VCMTiming& timing);
|
||||||
virtual ~VCMDecodedFrameCallback();
|
virtual ~VCMDecodedFrameCallback();
|
||||||
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
|
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
|
||||||
|
|
||||||
@ -49,7 +49,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CriticalSectionWrapper* _critSect;
|
CriticalSectionWrapper* _critSect;
|
||||||
TickTimeInterface* _clock;
|
|
||||||
VideoFrame _frame;
|
VideoFrame _frame;
|
||||||
VCMReceiveCallback* _receiveCallback;
|
VCMReceiveCallback* _receiveCallback;
|
||||||
VCMTiming& _timing;
|
VCMTiming& _timing;
|
||||||
@ -77,7 +76,7 @@ public:
|
|||||||
*
|
*
|
||||||
* inputVideoBuffer reference to encoded video frame
|
* inputVideoBuffer reference to encoded video frame
|
||||||
*/
|
*/
|
||||||
WebRtc_Word32 Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs);
|
WebRtc_Word32 Decode(const VCMEncodedFrame& inputFrame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the decoder memory
|
* Free the decoder memory
|
||||||
|
@ -9,19 +9,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "inter_frame_delay.h"
|
#include "inter_frame_delay.h"
|
||||||
|
#include "tick_time.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMInterFrameDelay::VCMInterFrameDelay(int64_t currentWallClock)
|
VCMInterFrameDelay::VCMInterFrameDelay()
|
||||||
{
|
{
|
||||||
Reset(currentWallClock);
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets the delay estimate
|
// Resets the delay estimate
|
||||||
void
|
void
|
||||||
VCMInterFrameDelay::Reset(int64_t currentWallClock)
|
VCMInterFrameDelay::Reset()
|
||||||
{
|
{
|
||||||
_zeroWallClock = currentWallClock;
|
_zeroWallClock = VCMTickTime::MillisecondTimestamp();
|
||||||
_wrapArounds = 0;
|
_wrapArounds = 0;
|
||||||
_prevWallClock = 0;
|
_prevWallClock = 0;
|
||||||
_prevTimestamp = 0;
|
_prevTimestamp = 0;
|
||||||
@ -33,8 +34,13 @@ VCMInterFrameDelay::Reset(int64_t currentWallClock)
|
|||||||
bool
|
bool
|
||||||
VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
|
VCMInterFrameDelay::CalculateDelay(WebRtc_UWord32 timestamp,
|
||||||
WebRtc_Word64 *delay,
|
WebRtc_Word64 *delay,
|
||||||
int64_t currentWallClock)
|
WebRtc_Word64 currentWallClock /* = -1 */)
|
||||||
{
|
{
|
||||||
|
if (currentWallClock <= -1)
|
||||||
|
{
|
||||||
|
currentWallClock = VCMTickTime::MillisecondTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
if (_prevWallClock == 0)
|
if (_prevWallClock == 0)
|
||||||
{
|
{
|
||||||
// First set of data, initialization, wait for next frame
|
// First set of data, initialization, wait for next frame
|
||||||
|
@ -19,10 +19,10 @@ namespace webrtc
|
|||||||
class VCMInterFrameDelay
|
class VCMInterFrameDelay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMInterFrameDelay(int64_t currentWallClock);
|
VCMInterFrameDelay();
|
||||||
|
|
||||||
// Resets the estimate. Zeros are given as parameters.
|
// Resets the estimate. Zeros are given as parameters.
|
||||||
void Reset(int64_t currentWallClock);
|
void Reset();
|
||||||
|
|
||||||
// Calculates the delay of a frame with the given timestamp.
|
// Calculates the delay of a frame with the given timestamp.
|
||||||
// This method is called when the frame is complete.
|
// This method is called when the frame is complete.
|
||||||
@ -35,7 +35,7 @@ public:
|
|||||||
// Return value : true if OK, false when reordered timestamps
|
// Return value : true if OK, false when reordered timestamps
|
||||||
bool CalculateDelay(WebRtc_UWord32 timestamp,
|
bool CalculateDelay(WebRtc_UWord32 timestamp,
|
||||||
WebRtc_Word64 *delay,
|
WebRtc_Word64 *delay,
|
||||||
int64_t currentWallClock);
|
WebRtc_Word64 currentWallClock = -1);
|
||||||
|
|
||||||
// Returns the current difference between incoming timestamps
|
// Returns the current difference between incoming timestamps
|
||||||
//
|
//
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
#include "tick_time.h"
|
||||||
#include "list_wrapper.h"
|
#include "list_wrapper.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -57,13 +57,10 @@ VCMJitterBuffer::CompleteDecodableKeyFrameCriteria(VCMFrameBuffer* frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
VCMJitterBuffer::VCMJitterBuffer(TickTimeInterface* clock,
|
VCMJitterBuffer::VCMJitterBuffer(WebRtc_Word32 vcmId, WebRtc_Word32 receiverId,
|
||||||
WebRtc_Word32 vcmId,
|
|
||||||
WebRtc_Word32 receiverId,
|
|
||||||
bool master) :
|
bool master) :
|
||||||
_vcmId(vcmId),
|
_vcmId(vcmId),
|
||||||
_receiverId(receiverId),
|
_receiverId(receiverId),
|
||||||
_clock(clock),
|
|
||||||
_running(false),
|
_running(false),
|
||||||
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_master(master),
|
_master(master),
|
||||||
@ -84,7 +81,6 @@ VCMJitterBuffer::VCMJitterBuffer(TickTimeInterface* clock,
|
|||||||
_numConsecutiveOldPackets(0),
|
_numConsecutiveOldPackets(0),
|
||||||
_discardedPackets(0),
|
_discardedPackets(0),
|
||||||
_jitterEstimate(vcmId, receiverId),
|
_jitterEstimate(vcmId, receiverId),
|
||||||
_delayEstimate(_clock->MillisecondTimestamp()),
|
|
||||||
_rttMs(0),
|
_rttMs(0),
|
||||||
_nackMode(kNoNack),
|
_nackMode(kNoNack),
|
||||||
_lowRttNackThresholdMs(-1),
|
_lowRttNackThresholdMs(-1),
|
||||||
@ -184,7 +180,7 @@ VCMJitterBuffer::Start()
|
|||||||
_incomingFrameCount = 0;
|
_incomingFrameCount = 0;
|
||||||
_incomingFrameRate = 0;
|
_incomingFrameRate = 0;
|
||||||
_incomingBitCount = 0;
|
_incomingBitCount = 0;
|
||||||
_timeLastIncomingFrameCount = _clock->MillisecondTimestamp();
|
_timeLastIncomingFrameCount = VCMTickTime::MillisecondTimestamp();
|
||||||
memset(_receiveStatistics, 0, sizeof(_receiveStatistics));
|
memset(_receiveStatistics, 0, sizeof(_receiveStatistics));
|
||||||
|
|
||||||
_numConsecutiveOldFrames = 0;
|
_numConsecutiveOldFrames = 0;
|
||||||
@ -266,7 +262,7 @@ VCMJitterBuffer::FlushInternal()
|
|||||||
|
|
||||||
// Also reset the jitter and delay estimates
|
// Also reset the jitter and delay estimates
|
||||||
_jitterEstimate.Reset();
|
_jitterEstimate.Reset();
|
||||||
_delayEstimate.Reset(_clock->MillisecondTimestamp());
|
_delayEstimate.Reset();
|
||||||
|
|
||||||
_waitingForCompletion.frameSize = 0;
|
_waitingForCompletion.frameSize = 0;
|
||||||
_waitingForCompletion.timestamp = 0;
|
_waitingForCompletion.timestamp = 0;
|
||||||
@ -606,7 +602,7 @@ WebRtc_Word32
|
|||||||
VCMJitterBuffer::GetUpdate(WebRtc_UWord32& frameRate, WebRtc_UWord32& bitRate)
|
VCMJitterBuffer::GetUpdate(WebRtc_UWord32& frameRate, WebRtc_UWord32& bitRate)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_critSect);
|
CriticalSectionScoped cs(_critSect);
|
||||||
const WebRtc_Word64 now = _clock->MillisecondTimestamp();
|
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
WebRtc_Word64 diff = now - _timeLastIncomingFrameCount;
|
WebRtc_Word64 diff = now - _timeLastIncomingFrameCount;
|
||||||
if (diff < 1000 && _incomingFrameRate > 0 && _incomingBitRate > 0)
|
if (diff < 1000 && _incomingFrameRate > 0 && _incomingBitRate > 0)
|
||||||
{
|
{
|
||||||
@ -661,7 +657,7 @@ VCMJitterBuffer::GetUpdate(WebRtc_UWord32& frameRate, WebRtc_UWord32& bitRate)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No frames since last call
|
// No frames since last call
|
||||||
_timeLastIncomingFrameCount = _clock->MillisecondTimestamp();
|
_timeLastIncomingFrameCount = VCMTickTime::MillisecondTimestamp();
|
||||||
frameRate = 0;
|
frameRate = 0;
|
||||||
bitRate = 0;
|
bitRate = 0;
|
||||||
_incomingBitRate = 0;
|
_incomingBitRate = 0;
|
||||||
@ -702,7 +698,7 @@ VCMJitterBuffer::GetCompleteFrameForDecoding(WebRtc_UWord32 maxWaitTimeMS)
|
|||||||
_critSect->Leave();
|
_critSect->Leave();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
const WebRtc_Word64 endWaitTimeMs = _clock->MillisecondTimestamp()
|
const WebRtc_Word64 endWaitTimeMs = VCMTickTime::MillisecondTimestamp()
|
||||||
+ maxWaitTimeMS;
|
+ maxWaitTimeMS;
|
||||||
WebRtc_Word64 waitTimeMs = maxWaitTimeMS;
|
WebRtc_Word64 waitTimeMs = maxWaitTimeMS;
|
||||||
while (waitTimeMs > 0)
|
while (waitTimeMs > 0)
|
||||||
@ -731,7 +727,7 @@ VCMJitterBuffer::GetCompleteFrameForDecoding(WebRtc_UWord32 maxWaitTimeMS)
|
|||||||
if (oldestFrame == NULL)
|
if (oldestFrame == NULL)
|
||||||
{
|
{
|
||||||
waitTimeMs = endWaitTimeMs -
|
waitTimeMs = endWaitTimeMs -
|
||||||
_clock->MillisecondTimestamp();
|
VCMTickTime::MillisecondTimestamp();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1518,7 +1514,7 @@ VCMFrameBufferEnum
|
|||||||
VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
|
VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_critSect);
|
CriticalSectionScoped cs(_critSect);
|
||||||
WebRtc_Word64 nowMs = _clock->MillisecondTimestamp();
|
WebRtc_Word64 nowMs = VCMTickTime::MillisecondTimestamp();
|
||||||
VCMFrameBufferEnum bufferReturn = kSizeError;
|
VCMFrameBufferEnum bufferReturn = kSizeError;
|
||||||
VCMFrameBufferEnum ret = kSizeError;
|
VCMFrameBufferEnum ret = kSizeError;
|
||||||
VCMFrameBuffer* frame = static_cast<VCMFrameBuffer*>(buffer);
|
VCMFrameBuffer* frame = static_cast<VCMFrameBuffer*>(buffer);
|
||||||
@ -1529,7 +1525,7 @@ VCMJitterBuffer::InsertPacket(VCMEncodedFrame* buffer, const VCMPacket& packet)
|
|||||||
{
|
{
|
||||||
// Now it's time to start estimating jitter
|
// Now it's time to start estimating jitter
|
||||||
// reset the delay estimate.
|
// reset the delay estimate.
|
||||||
_delayEstimate.Reset(_clock->MillisecondTimestamp());
|
_delayEstimate.Reset();
|
||||||
_firstPacket = false;
|
_firstPacket = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ enum VCMNackMode
|
|||||||
};
|
};
|
||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
class TickTimeInterface;
|
|
||||||
class VCMFrameBuffer;
|
class VCMFrameBuffer;
|
||||||
class VCMPacket;
|
class VCMPacket;
|
||||||
class VCMEncodedFrame;
|
class VCMEncodedFrame;
|
||||||
@ -50,8 +49,7 @@ public:
|
|||||||
class VCMJitterBuffer
|
class VCMJitterBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMJitterBuffer(TickTimeInterface* clock,
|
VCMJitterBuffer(WebRtc_Word32 vcmId = -1,
|
||||||
WebRtc_Word32 vcmId = -1,
|
|
||||||
WebRtc_Word32 receiverId = -1,
|
WebRtc_Word32 receiverId = -1,
|
||||||
bool master = true);
|
bool master = true);
|
||||||
virtual ~VCMJitterBuffer();
|
virtual ~VCMJitterBuffer();
|
||||||
@ -193,7 +191,6 @@ private:
|
|||||||
|
|
||||||
WebRtc_Word32 _vcmId;
|
WebRtc_Word32 _vcmId;
|
||||||
WebRtc_Word32 _receiverId;
|
WebRtc_Word32 _receiverId;
|
||||||
TickTimeInterface* _clock;
|
|
||||||
// If we are running (have started) or not
|
// If we are running (have started) or not
|
||||||
bool _running;
|
bool _running;
|
||||||
CriticalSectionWrapper* _critSect;
|
CriticalSectionWrapper* _critSect;
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
#include "internal_defines.h"
|
#include "internal_defines.h"
|
||||||
#include "jitter_estimator.h"
|
#include "jitter_estimator.h"
|
||||||
#include "rtt_filter.h"
|
#include "rtt_filter.h"
|
||||||
|
#include "tick_time.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -551,7 +551,7 @@ VCMFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
VCMLossProtectionLogic::VCMLossProtectionLogic(int64_t nowMs):
|
VCMLossProtectionLogic::VCMLossProtectionLogic():
|
||||||
_selectedMethod(NULL),
|
_selectedMethod(NULL),
|
||||||
_currentParameters(),
|
_currentParameters(),
|
||||||
_rtt(0),
|
_rtt(0),
|
||||||
@ -572,7 +572,7 @@ _boostRateKey(2),
|
|||||||
_codecWidth(0),
|
_codecWidth(0),
|
||||||
_codecHeight(0)
|
_codecHeight(0)
|
||||||
{
|
{
|
||||||
Reset(nowMs);
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMLossProtectionLogic::~VCMLossProtectionLogic()
|
VCMLossProtectionLogic::~VCMLossProtectionLogic()
|
||||||
@ -661,13 +661,13 @@ VCMLossProtectionLogic::UpdateResidualPacketLoss(float residualPacketLoss)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMLossProtectionLogic::UpdateLossPr(WebRtc_UWord8 lossPr255,
|
VCMLossProtectionLogic::UpdateLossPr(WebRtc_UWord8 lossPr255)
|
||||||
int64_t nowMs)
|
|
||||||
{
|
{
|
||||||
UpdateMaxLossHistory(lossPr255, nowMs);
|
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
_lossPr255.Apply(static_cast<float> (nowMs - _lastPrUpdateT),
|
UpdateMaxLossHistory(lossPr255, now);
|
||||||
|
_lossPr255.Apply(static_cast<float> (now - _lastPrUpdateT),
|
||||||
static_cast<float> (lossPr255));
|
static_cast<float> (lossPr255));
|
||||||
_lastPrUpdateT = nowMs;
|
_lastPrUpdateT = now;
|
||||||
_lossPr = _lossPr255.Value() / 255.0f;
|
_lossPr = _lossPr255.Value() / 255.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,14 +741,14 @@ VCMLossProtectionLogic::MaxFilteredLossPr(WebRtc_Word64 nowMs) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord8
|
WebRtc_UWord8
|
||||||
VCMLossProtectionLogic::FilteredLoss(int64_t nowMs) const
|
VCMLossProtectionLogic::FilteredLoss() const
|
||||||
{
|
{
|
||||||
if (_selectedMethod != NULL &&
|
if (_selectedMethod != NULL &&
|
||||||
(_selectedMethod->Type() == kFec ||
|
(_selectedMethod->Type() == kFec ||
|
||||||
_selectedMethod->Type() == kNackFec))
|
_selectedMethod->Type() == kNackFec))
|
||||||
{
|
{
|
||||||
// Take the windowed max of the received loss.
|
// Take the windowed max of the received loss.
|
||||||
return MaxFilteredLossPr(nowMs);
|
return MaxFilteredLossPr(VCMTickTime::MillisecondTimestamp());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -770,19 +770,21 @@ VCMLossProtectionLogic::UpdateBitRate(float bitRate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMLossProtectionLogic::UpdatePacketsPerFrame(float nPackets, int64_t nowMs)
|
VCMLossProtectionLogic::UpdatePacketsPerFrame(float nPackets)
|
||||||
{
|
{
|
||||||
_packetsPerFrame.Apply(static_cast<float>(nowMs - _lastPacketPerFrameUpdateT),
|
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
|
_packetsPerFrame.Apply(static_cast<float>(now - _lastPacketPerFrameUpdateT),
|
||||||
nPackets);
|
nPackets);
|
||||||
_lastPacketPerFrameUpdateT = nowMs;
|
_lastPacketPerFrameUpdateT = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMLossProtectionLogic::UpdatePacketsPerFrameKey(float nPackets, int64_t nowMs)
|
VCMLossProtectionLogic::UpdatePacketsPerFrameKey(float nPackets)
|
||||||
{
|
{
|
||||||
_packetsPerFrameKey.Apply(static_cast<float>(nowMs -
|
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
|
_packetsPerFrameKey.Apply(static_cast<float>(now -
|
||||||
_lastPacketPerFrameUpdateTKey), nPackets);
|
_lastPacketPerFrameUpdateTKey), nPackets);
|
||||||
_lastPacketPerFrameUpdateTKey = nowMs;
|
_lastPacketPerFrameUpdateTKey = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -834,11 +836,12 @@ VCMLossProtectionLogic::SelectedType() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMLossProtectionLogic::Reset(int64_t nowMs)
|
VCMLossProtectionLogic::Reset()
|
||||||
{
|
{
|
||||||
_lastPrUpdateT = nowMs;
|
const WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
_lastPacketPerFrameUpdateT = nowMs;
|
_lastPrUpdateT = now;
|
||||||
_lastPacketPerFrameUpdateTKey = nowMs;
|
_lastPacketPerFrameUpdateT = now;
|
||||||
|
_lastPacketPerFrameUpdateTKey = now;
|
||||||
_lossPr255.Reset(0.9999f);
|
_lossPr255.Reset(0.9999f);
|
||||||
_packetsPerFrame.Reset(0.9999f);
|
_packetsPerFrame.Reset(0.9999f);
|
||||||
_fecRateDelta = _fecRateKey = 0;
|
_fecRateDelta = _fecRateKey = 0;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "exp_filter.h"
|
#include "exp_filter.h"
|
||||||
#include "internal_defines.h"
|
#include "internal_defines.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "qm_select.h"
|
#include "qm_select.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -211,7 +212,7 @@ private:
|
|||||||
class VCMLossProtectionLogic
|
class VCMLossProtectionLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMLossProtectionLogic(int64_t nowMs);
|
VCMLossProtectionLogic();
|
||||||
~VCMLossProtectionLogic();
|
~VCMLossProtectionLogic();
|
||||||
|
|
||||||
// Set the protection method to be used
|
// Set the protection method to be used
|
||||||
@ -250,7 +251,7 @@ public:
|
|||||||
// Input:
|
// Input:
|
||||||
// - lossPr255 : The packet loss probability [0, 255],
|
// - lossPr255 : The packet loss probability [0, 255],
|
||||||
// reported by RTCP.
|
// reported by RTCP.
|
||||||
void UpdateLossPr(WebRtc_UWord8 lossPr255, int64_t nowMs);
|
void UpdateLossPr(WebRtc_UWord8 lossPr255);
|
||||||
|
|
||||||
// Update the filtered packet loss.
|
// Update the filtered packet loss.
|
||||||
//
|
//
|
||||||
@ -269,13 +270,13 @@ public:
|
|||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - nPackets : Number of packets in the latest sent frame.
|
// - nPackets : Number of packets in the latest sent frame.
|
||||||
void UpdatePacketsPerFrame(float nPackets, int64_t nowMs);
|
void UpdatePacketsPerFrame(float nPackets);
|
||||||
|
|
||||||
// Update the number of packets per frame estimate, for key frames
|
// Update the number of packets per frame estimate, for key frames
|
||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - nPackets : umber of packets in the latest sent frame.
|
// - nPackets : umber of packets in the latest sent frame.
|
||||||
void UpdatePacketsPerFrameKey(float nPackets, int64_t nowMs);
|
void UpdatePacketsPerFrameKey(float nPackets);
|
||||||
|
|
||||||
// Update the keyFrameSize estimate
|
// Update the keyFrameSize estimate
|
||||||
//
|
//
|
||||||
@ -323,9 +324,9 @@ public:
|
|||||||
// Returns the filtered loss probability in the interval [0, 255].
|
// Returns the filtered loss probability in the interval [0, 255].
|
||||||
//
|
//
|
||||||
// Return value : The filtered loss probability
|
// Return value : The filtered loss probability
|
||||||
WebRtc_UWord8 FilteredLoss(int64_t nowMs) const;
|
WebRtc_UWord8 FilteredLoss() const;
|
||||||
|
|
||||||
void Reset(int64_t nowMs);
|
void Reset();
|
||||||
|
|
||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
|
@ -12,14 +12,11 @@
|
|||||||
#include "content_metrics_processing.h"
|
#include "content_metrics_processing.h"
|
||||||
#include "frame_dropper.h"
|
#include "frame_dropper.h"
|
||||||
#include "qm_select.h"
|
#include "qm_select.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id,
|
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id):
|
||||||
TickTimeInterface* clock):
|
|
||||||
_id(id),
|
_id(id),
|
||||||
_clock(clock),
|
|
||||||
_maxBitRate(0),
|
_maxBitRate(0),
|
||||||
_sendCodecType(kVideoCodecUnknown),
|
_sendCodecType(kVideoCodecUnknown),
|
||||||
_codecWidth(0),
|
_codecWidth(0),
|
||||||
@ -45,7 +42,7 @@ _lastChangeTime(0)
|
|||||||
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
|
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
|
||||||
|
|
||||||
_frameDropper = new VCMFrameDropper(_id);
|
_frameDropper = new VCMFrameDropper(_id);
|
||||||
_lossProtLogic = new VCMLossProtectionLogic(_clock->MillisecondTimestamp());
|
_lossProtLogic = new VCMLossProtectionLogic();
|
||||||
_content = new VCMContentMetricsProcessing();
|
_content = new VCMContentMetricsProcessing();
|
||||||
_qmResolution = new VCMQmResolution();
|
_qmResolution = new VCMQmResolution();
|
||||||
}
|
}
|
||||||
@ -65,12 +62,12 @@ VCMMediaOptimization::Reset()
|
|||||||
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
|
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
|
||||||
InputFrameRate(); // Resets _incomingFrameRate
|
InputFrameRate(); // Resets _incomingFrameRate
|
||||||
_frameDropper->Reset();
|
_frameDropper->Reset();
|
||||||
_lossProtLogic->Reset(_clock->MillisecondTimestamp());
|
_lossProtLogic->Reset();
|
||||||
_frameDropper->SetRates(0, 0);
|
_frameDropper->SetRates(0, 0);
|
||||||
_content->Reset();
|
_content->Reset();
|
||||||
_qmResolution->Reset();
|
_qmResolution->Reset();
|
||||||
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
|
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
|
||||||
_lossProtLogic->Reset(_clock->MillisecondTimestamp());
|
_lossProtLogic->Reset();
|
||||||
_sendStatisticsZeroEncode = 0;
|
_sendStatisticsZeroEncode = 0;
|
||||||
_targetBitRate = 0;
|
_targetBitRate = 0;
|
||||||
_codecWidth = 0;
|
_codecWidth = 0;
|
||||||
@ -96,7 +93,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
|
|||||||
{
|
{
|
||||||
VCMProtectionMethod *selectedMethod = _lossProtLogic->SelectedMethod();
|
VCMProtectionMethod *selectedMethod = _lossProtLogic->SelectedMethod();
|
||||||
_lossProtLogic->UpdateBitRate(static_cast<float>(bitRate));
|
_lossProtLogic->UpdateBitRate(static_cast<float>(bitRate));
|
||||||
_lossProtLogic->UpdateLossPr(fractionLost, _clock->MillisecondTimestamp());
|
_lossProtLogic->UpdateLossPr(fractionLost);
|
||||||
_lossProtLogic->UpdateRtt(roundTripTimeMs);
|
_lossProtLogic->UpdateRtt(roundTripTimeMs);
|
||||||
_lossProtLogic->UpdateResidualPacketLoss(static_cast<float>(fractionLost));
|
_lossProtLogic->UpdateResidualPacketLoss(static_cast<float>(fractionLost));
|
||||||
|
|
||||||
@ -119,8 +116,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
|
|||||||
// average or max filter may be used.
|
// average or max filter may be used.
|
||||||
// We should think about which filter is appropriate for low/high bit rates,
|
// We should think about which filter is appropriate for low/high bit rates,
|
||||||
// low/high loss rates, etc.
|
// low/high loss rates, etc.
|
||||||
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss(
|
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss();
|
||||||
_clock->MillisecondTimestamp());
|
|
||||||
|
|
||||||
// For now use the filtered loss for computing the robustness settings
|
// For now use the filtered loss for computing the robustness settings
|
||||||
_lossProtLogic->UpdateFilteredLossPr(packetLossEnc);
|
_lossProtLogic->UpdateFilteredLossPr(packetLossEnc);
|
||||||
@ -257,7 +253,7 @@ VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType, WebRtc_Word3
|
|||||||
// has changed. If native dimension values have changed, then either user
|
// has changed. If native dimension values have changed, then either user
|
||||||
// initiated change, or QM initiated change. Will be able to determine only
|
// initiated change, or QM initiated change. Will be able to determine only
|
||||||
// after the processing of the first frame.
|
// after the processing of the first frame.
|
||||||
_lastChangeTime = _clock->MillisecondTimestamp();
|
_lastChangeTime = VCMTickTime::MillisecondTimestamp();
|
||||||
_content->Reset();
|
_content->Reset();
|
||||||
_content->UpdateFrameRate(frameRate);
|
_content->UpdateFrameRate(frameRate);
|
||||||
|
|
||||||
@ -340,7 +336,7 @@ VCMMediaOptimization::SentFrameRate()
|
|||||||
float
|
float
|
||||||
VCMMediaOptimization::SentBitRate()
|
VCMMediaOptimization::SentBitRate()
|
||||||
{
|
{
|
||||||
UpdateBitRateEstimate(-1, _clock->MillisecondTimestamp());
|
UpdateBitRateEstimate(-1, VCMTickTime::MillisecondTimestamp());
|
||||||
return _avgSentBitRateBps / 1000.0f;
|
return _avgSentBitRateBps / 1000.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +351,7 @@ VCMMediaOptimization::UpdateWithEncodedData(WebRtc_Word32 encodedLength,
|
|||||||
FrameType encodedFrameType)
|
FrameType encodedFrameType)
|
||||||
{
|
{
|
||||||
// look into the ViE version - debug mode - needs also number of layers.
|
// look into the ViE version - debug mode - needs also number of layers.
|
||||||
UpdateBitRateEstimate(encodedLength, _clock->MillisecondTimestamp());
|
UpdateBitRateEstimate(encodedLength, VCMTickTime::MillisecondTimestamp());
|
||||||
if(encodedLength > 0)
|
if(encodedLength > 0)
|
||||||
{
|
{
|
||||||
const bool deltaFrame = (encodedFrameType != kVideoFrameKey &&
|
const bool deltaFrame = (encodedFrameType != kVideoFrameKey &&
|
||||||
@ -368,13 +364,11 @@ VCMMediaOptimization::UpdateWithEncodedData(WebRtc_Word32 encodedLength,
|
|||||||
static_cast<float>(_maxPayloadSize);
|
static_cast<float>(_maxPayloadSize);
|
||||||
if (deltaFrame)
|
if (deltaFrame)
|
||||||
{
|
{
|
||||||
_lossProtLogic->UpdatePacketsPerFrame(
|
_lossProtLogic->UpdatePacketsPerFrame(minPacketsPerFrame);
|
||||||
minPacketsPerFrame, _clock->MillisecondTimestamp());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_lossProtLogic->UpdatePacketsPerFrameKey(
|
_lossProtLogic->UpdatePacketsPerFrameKey(minPacketsPerFrame);
|
||||||
minPacketsPerFrame, _clock->MillisecondTimestamp());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_enableQm)
|
if (_enableQm)
|
||||||
@ -525,7 +519,7 @@ VCMMediaOptimization::SelectQuality()
|
|||||||
_qmResolution->ResetRates();
|
_qmResolution->ResetRates();
|
||||||
|
|
||||||
// Reset counters
|
// Reset counters
|
||||||
_lastQMUpdateTime = _clock->MillisecondTimestamp();
|
_lastQMUpdateTime = VCMTickTime::MillisecondTimestamp();
|
||||||
|
|
||||||
// Reset content metrics
|
// Reset content metrics
|
||||||
_content->Reset();
|
_content->Reset();
|
||||||
@ -548,7 +542,7 @@ VCMMediaOptimization::checkStatusForQMchange()
|
|||||||
// (to sample the metrics) from the event lastChangeTime
|
// (to sample the metrics) from the event lastChangeTime
|
||||||
// lastChangeTime is the time where user changed the size/rate/frame rate
|
// lastChangeTime is the time where user changed the size/rate/frame rate
|
||||||
// (via SetEncodingData)
|
// (via SetEncodingData)
|
||||||
WebRtc_Word64 now = _clock->MillisecondTimestamp();
|
WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
|
if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
|
||||||
(now - _lastChangeTime) < kQmMinIntervalMs)
|
(now - _lastChangeTime) < kQmMinIntervalMs)
|
||||||
{
|
{
|
||||||
@ -618,7 +612,7 @@ VCMMediaOptimization::QMUpdate(VCMResolutionScale* qm)
|
|||||||
void
|
void
|
||||||
VCMMediaOptimization::UpdateIncomingFrameRate()
|
VCMMediaOptimization::UpdateIncomingFrameRate()
|
||||||
{
|
{
|
||||||
WebRtc_Word64 now = _clock->MillisecondTimestamp();
|
WebRtc_Word64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
if (_incomingFrameTimes[0] == 0)
|
if (_incomingFrameTimes[0] == 0)
|
||||||
{
|
{
|
||||||
// first no shift
|
// first no shift
|
||||||
@ -670,7 +664,7 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
|
|||||||
WebRtc_UWord32
|
WebRtc_UWord32
|
||||||
VCMMediaOptimization::InputFrameRate()
|
VCMMediaOptimization::InputFrameRate()
|
||||||
{
|
{
|
||||||
ProcessIncomingFrameRate(_clock->MillisecondTimestamp());
|
ProcessIncomingFrameRate(VCMTickTime::MillisecondTimestamp());
|
||||||
return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
|
return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ namespace webrtc
|
|||||||
enum { kBitrateMaxFrameSamples = 60 };
|
enum { kBitrateMaxFrameSamples = 60 };
|
||||||
enum { kBitrateAverageWinMs = 1000 };
|
enum { kBitrateAverageWinMs = 1000 };
|
||||||
|
|
||||||
class TickTimeInterface;
|
|
||||||
class VCMContentMetricsProcessing;
|
class VCMContentMetricsProcessing;
|
||||||
class VCMFrameDropper;
|
class VCMFrameDropper;
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ struct VCMEncodedFrameSample
|
|||||||
class VCMMediaOptimization
|
class VCMMediaOptimization
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMMediaOptimization(WebRtc_Word32 id, TickTimeInterface* clock);
|
VCMMediaOptimization(WebRtc_Word32 id);
|
||||||
~VCMMediaOptimization(void);
|
~VCMMediaOptimization(void);
|
||||||
/*
|
/*
|
||||||
* Reset the Media Optimization module
|
* Reset the Media Optimization module
|
||||||
@ -163,7 +162,7 @@ private:
|
|||||||
enum { kFrameHistoryWinMs = 2000};
|
enum { kFrameHistoryWinMs = 2000};
|
||||||
|
|
||||||
WebRtc_Word32 _id;
|
WebRtc_Word32 _id;
|
||||||
TickTimeInterface* _clock;
|
|
||||||
WebRtc_Word32 _maxBitRate;
|
WebRtc_Word32 _maxBitRate;
|
||||||
VideoCodecType _sendCodecType;
|
VideoCodecType _sendCodecType;
|
||||||
WebRtc_UWord16 _codecWidth;
|
WebRtc_UWord16 _codecWidth;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "encoded_frame.h"
|
#include "encoded_frame.h"
|
||||||
#include "internal_defines.h"
|
#include "internal_defines.h"
|
||||||
#include "media_opt_util.h"
|
#include "media_opt_util.h"
|
||||||
#include "tick_time_interface.h"
|
#include "tick_time.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "video_coding.h"
|
#include "video_coding.h"
|
||||||
|
|
||||||
@ -22,17 +22,15 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMReceiver::VCMReceiver(VCMTiming& timing,
|
VCMReceiver::VCMReceiver(VCMTiming& timing,
|
||||||
TickTimeInterface* clock,
|
|
||||||
WebRtc_Word32 vcmId,
|
WebRtc_Word32 vcmId,
|
||||||
WebRtc_Word32 receiverId,
|
WebRtc_Word32 receiverId,
|
||||||
bool master)
|
bool master)
|
||||||
:
|
:
|
||||||
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_vcmId(vcmId),
|
_vcmId(vcmId),
|
||||||
_clock(clock),
|
|
||||||
_receiverId(receiverId),
|
_receiverId(receiverId),
|
||||||
_master(master),
|
_master(master),
|
||||||
_jitterBuffer(_clock, vcmId, receiverId, master),
|
_jitterBuffer(vcmId, receiverId, master),
|
||||||
_timing(timing),
|
_timing(timing),
|
||||||
_renderWaitEvent(*new VCMEvent()),
|
_renderWaitEvent(*new VCMEvent()),
|
||||||
_state(kPassive)
|
_state(kPassive)
|
||||||
@ -120,10 +118,10 @@ VCMReceiver::InsertPacket(const VCMPacket& packet,
|
|||||||
VCMId(_vcmId, _receiverId),
|
VCMId(_vcmId, _receiverId),
|
||||||
"Packet seqNo %u of frame %u at %u",
|
"Packet seqNo %u of frame %u at %u",
|
||||||
packet.seqNum, packet.timestamp,
|
packet.seqNum, packet.timestamp,
|
||||||
MaskWord64ToUWord32(_clock->MillisecondTimestamp()));
|
MaskWord64ToUWord32(VCMTickTime::MillisecondTimestamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
const WebRtc_Word64 nowMs = _clock->MillisecondTimestamp();
|
const WebRtc_Word64 nowMs = VCMTickTime::MillisecondTimestamp();
|
||||||
|
|
||||||
WebRtc_Word64 renderTimeMs = _timing.RenderTimeMs(packet.timestamp, nowMs);
|
WebRtc_Word64 renderTimeMs = _timing.RenderTimeMs(packet.timestamp, nowMs);
|
||||||
|
|
||||||
@ -132,7 +130,7 @@ VCMReceiver::InsertPacket(const VCMPacket& packet,
|
|||||||
// Render time error. Assume that this is due to some change in
|
// Render time error. Assume that this is due to some change in
|
||||||
// the incoming video stream and reset the JB and the timing.
|
// the incoming video stream and reset the JB and the timing.
|
||||||
_jitterBuffer.Flush();
|
_jitterBuffer.Flush();
|
||||||
_timing.Reset(_clock->MillisecondTimestamp());
|
_timing.Reset();
|
||||||
return VCM_FLUSH_INDICATOR;
|
return VCM_FLUSH_INDICATOR;
|
||||||
}
|
}
|
||||||
else if (renderTimeMs < nowMs - kMaxVideoDelayMs)
|
else if (renderTimeMs < nowMs - kMaxVideoDelayMs)
|
||||||
@ -141,7 +139,7 @@ VCMReceiver::InsertPacket(const VCMPacket& packet,
|
|||||||
"This frame should have been rendered more than %u ms ago."
|
"This frame should have been rendered more than %u ms ago."
|
||||||
"Flushing jitter buffer and resetting timing.", kMaxVideoDelayMs);
|
"Flushing jitter buffer and resetting timing.", kMaxVideoDelayMs);
|
||||||
_jitterBuffer.Flush();
|
_jitterBuffer.Flush();
|
||||||
_timing.Reset(_clock->MillisecondTimestamp());
|
_timing.Reset();
|
||||||
return VCM_FLUSH_INDICATOR;
|
return VCM_FLUSH_INDICATOR;
|
||||||
}
|
}
|
||||||
else if (_timing.TargetVideoDelay() > kMaxVideoDelayMs)
|
else if (_timing.TargetVideoDelay() > kMaxVideoDelayMs)
|
||||||
@ -150,14 +148,14 @@ VCMReceiver::InsertPacket(const VCMPacket& packet,
|
|||||||
"More than %u ms target delay. Flushing jitter buffer and resetting timing.",
|
"More than %u ms target delay. Flushing jitter buffer and resetting timing.",
|
||||||
kMaxVideoDelayMs);
|
kMaxVideoDelayMs);
|
||||||
_jitterBuffer.Flush();
|
_jitterBuffer.Flush();
|
||||||
_timing.Reset(_clock->MillisecondTimestamp());
|
_timing.Reset();
|
||||||
return VCM_FLUSH_INDICATOR;
|
return VCM_FLUSH_INDICATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First packet received belonging to this frame.
|
// First packet received belonging to this frame.
|
||||||
if (buffer->Length() == 0)
|
if (buffer->Length() == 0)
|
||||||
{
|
{
|
||||||
const WebRtc_Word64 nowMs = _clock->MillisecondTimestamp();
|
const WebRtc_Word64 nowMs = VCMTickTime::MillisecondTimestamp();
|
||||||
if (_master)
|
if (_master)
|
||||||
{
|
{
|
||||||
// Only trace the primary receiver to make it possible to parse and plot the trace file.
|
// Only trace the primary receiver to make it possible to parse and plot the trace file.
|
||||||
@ -201,7 +199,7 @@ VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs, WebRtc_Word64& nextR
|
|||||||
// is thread-safe.
|
// is thread-safe.
|
||||||
FrameType incomingFrameType = kVideoFrameDelta;
|
FrameType incomingFrameType = kVideoFrameDelta;
|
||||||
nextRenderTimeMs = -1;
|
nextRenderTimeMs = -1;
|
||||||
const WebRtc_Word64 startTimeMs = _clock->MillisecondTimestamp();
|
const WebRtc_Word64 startTimeMs = VCMTickTime::MillisecondTimestamp();
|
||||||
WebRtc_Word64 ret = _jitterBuffer.GetNextTimeStamp(maxWaitTimeMs,
|
WebRtc_Word64 ret = _jitterBuffer.GetNextTimeStamp(maxWaitTimeMs,
|
||||||
incomingFrameType,
|
incomingFrameType,
|
||||||
nextRenderTimeMs);
|
nextRenderTimeMs);
|
||||||
@ -217,7 +215,7 @@ VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs, WebRtc_Word64& nextR
|
|||||||
_timing.UpdateCurrentDelay(timeStamp);
|
_timing.UpdateCurrentDelay(timeStamp);
|
||||||
|
|
||||||
const WebRtc_Word32 tempWaitTime = maxWaitTimeMs -
|
const WebRtc_Word32 tempWaitTime = maxWaitTimeMs -
|
||||||
static_cast<WebRtc_Word32>(_clock->MillisecondTimestamp() - startTimeMs);
|
static_cast<WebRtc_Word32>(VCMTickTime::MillisecondTimestamp() - startTimeMs);
|
||||||
WebRtc_UWord16 newMaxWaitTime = static_cast<WebRtc_UWord16>(VCM_MAX(tempWaitTime, 0));
|
WebRtc_UWord16 newMaxWaitTime = static_cast<WebRtc_UWord16>(VCM_MAX(tempWaitTime, 0));
|
||||||
|
|
||||||
VCMEncodedFrame* frame = NULL;
|
VCMEncodedFrame* frame = NULL;
|
||||||
@ -258,7 +256,7 @@ VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
|
|||||||
{
|
{
|
||||||
// How long can we wait until we must decode the next frame
|
// How long can we wait until we must decode the next frame
|
||||||
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
|
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
|
||||||
_clock->MillisecondTimestamp());
|
VCMTickTime::MillisecondTimestamp());
|
||||||
|
|
||||||
// Try to get a complete frame from the jitter buffer
|
// Try to get a complete frame from the jitter buffer
|
||||||
VCMEncodedFrame* frame = _jitterBuffer.GetCompleteFrameForDecoding(0);
|
VCMEncodedFrame* frame = _jitterBuffer.GetCompleteFrameForDecoding(0);
|
||||||
@ -298,7 +296,7 @@ VCMReceiver::FrameForDecoding(WebRtc_UWord16 maxWaitTimeMs,
|
|||||||
{
|
{
|
||||||
// Get an incomplete frame
|
// Get an incomplete frame
|
||||||
if (_timing.MaxWaitingTime(nextRenderTimeMs,
|
if (_timing.MaxWaitingTime(nextRenderTimeMs,
|
||||||
_clock->MillisecondTimestamp()) > 0)
|
VCMTickTime::MillisecondTimestamp()) > 0)
|
||||||
{
|
{
|
||||||
// Still time to wait for a complete frame
|
// Still time to wait for a complete frame
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -330,7 +328,7 @@ VCMReceiver::FrameForRendering(WebRtc_UWord16 maxWaitTimeMs,
|
|||||||
// as possible before giving the frame to the decoder, which will render the frame as soon
|
// as possible before giving the frame to the decoder, which will render the frame as soon
|
||||||
// as it has been decoded.
|
// as it has been decoded.
|
||||||
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
|
WebRtc_UWord32 waitTimeMs = _timing.MaxWaitingTime(nextRenderTimeMs,
|
||||||
_clock->MillisecondTimestamp());
|
VCMTickTime::MillisecondTimestamp());
|
||||||
if (maxWaitTimeMs < waitTimeMs)
|
if (maxWaitTimeMs < waitTimeMs)
|
||||||
{
|
{
|
||||||
// If we're not allowed to wait until the frame is supposed to be rendered
|
// If we're not allowed to wait until the frame is supposed to be rendered
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "critical_section_wrapper.h"
|
#include "critical_section_wrapper.h"
|
||||||
#include "jitter_buffer.h"
|
#include "jitter_buffer.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
|
||||||
@ -41,7 +40,6 @@ class VCMReceiver
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMReceiver(VCMTiming& timing,
|
VCMReceiver(VCMTiming& timing,
|
||||||
TickTimeInterface* clock,
|
|
||||||
WebRtc_Word32 vcmId = -1,
|
WebRtc_Word32 vcmId = -1,
|
||||||
WebRtc_Word32 receiverId = -1,
|
WebRtc_Word32 receiverId = -1,
|
||||||
bool master = true);
|
bool master = true);
|
||||||
@ -85,7 +83,6 @@ private:
|
|||||||
|
|
||||||
CriticalSectionWrapper* _critSect;
|
CriticalSectionWrapper* _critSect;
|
||||||
WebRtc_Word32 _vcmId;
|
WebRtc_Word32 _vcmId;
|
||||||
TickTimeInterface* _clock;
|
|
||||||
WebRtc_Word32 _receiverId;
|
WebRtc_Word32 _receiverId;
|
||||||
bool _master;
|
bool _master;
|
||||||
VCMJitterBuffer _jitterBuffer;
|
VCMJitterBuffer _jitterBuffer;
|
||||||
|
55
src/modules/video_coding/main/source/tick_time.h
Normal file
55
src/modules/video_coding/main/source/tick_time.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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_VIDEO_CODING_TICK_TIME_H_
|
||||||
|
#define WEBRTC_MODULES_VIDEO_CODING_TICK_TIME_H_
|
||||||
|
|
||||||
|
#include "tick_util.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
namespace webrtc
|
||||||
|
{
|
||||||
|
|
||||||
|
//#define TICK_TIME_DEBUG
|
||||||
|
|
||||||
|
class VCMTickTime : public TickTime
|
||||||
|
{
|
||||||
|
#ifdef TICK_TIME_DEBUG
|
||||||
|
public:
|
||||||
|
/*
|
||||||
|
* Get current time
|
||||||
|
*/
|
||||||
|
static TickTime Now() { assert(false); };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get time in milli seconds
|
||||||
|
*/
|
||||||
|
static WebRtc_Word64 MillisecondTimestamp() { return _timeNowDebug; };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get time in micro seconds
|
||||||
|
*/
|
||||||
|
static WebRtc_Word64 MicrosecondTimestamp() { return _timeNowDebug * 1000LL; };
|
||||||
|
|
||||||
|
static void IncrementDebugClock() { _timeNowDebug++; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
static WebRtc_Word64 _timeNowDebug;
|
||||||
|
|
||||||
|
#else
|
||||||
|
public:
|
||||||
|
static void IncrementDebugClock() { assert(false); };
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
#endif // WEBRTC_MODULES_VIDEO_CODING_TICK_TIME_H_
|
@ -9,20 +9,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "internal_defines.h"
|
#include "internal_defines.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "timestamp_extrapolator.h"
|
#include "timestamp_extrapolator.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMTimestampExtrapolator::VCMTimestampExtrapolator(TickTimeInterface* clock,
|
VCMTimestampExtrapolator::VCMTimestampExtrapolator(WebRtc_Word32 vcmId, WebRtc_Word32 id)
|
||||||
WebRtc_Word32 vcmId,
|
|
||||||
WebRtc_Word32 id)
|
|
||||||
:
|
:
|
||||||
_rwLock(RWLockWrapper::CreateRWLock()),
|
_rwLock(RWLockWrapper::CreateRWLock()),
|
||||||
_vcmId(vcmId),
|
_vcmId(vcmId),
|
||||||
_id(id),
|
_id(id),
|
||||||
_clock(clock),
|
|
||||||
_startMs(0),
|
_startMs(0),
|
||||||
_firstTimestamp(0),
|
_firstTimestamp(0),
|
||||||
_wrapArounds(0),
|
_wrapArounds(0),
|
||||||
@ -38,7 +35,7 @@ _accDrift(6600), // in timestamp ticks, i.e. 15 ms
|
|||||||
_accMaxError(7000),
|
_accMaxError(7000),
|
||||||
_P11(1e10)
|
_P11(1e10)
|
||||||
{
|
{
|
||||||
Reset(_clock->MillisecondTimestamp());
|
Reset(VCMTickTime::MillisecondTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMTimestampExtrapolator::~VCMTimestampExtrapolator()
|
VCMTimestampExtrapolator::~VCMTimestampExtrapolator()
|
||||||
@ -56,7 +53,7 @@ VCMTimestampExtrapolator::Reset(const WebRtc_Word64 nowMs /* = -1 */)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_startMs = _clock->MillisecondTimestamp();
|
_startMs = VCMTickTime::MillisecondTimestamp();
|
||||||
}
|
}
|
||||||
_prevMs = _startMs;
|
_prevMs = _startMs;
|
||||||
_firstTimestamp = 0;
|
_firstTimestamp = 0;
|
||||||
|
@ -17,14 +17,10 @@
|
|||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
class TickTimeInterface;
|
|
||||||
|
|
||||||
class VCMTimestampExtrapolator
|
class VCMTimestampExtrapolator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMTimestampExtrapolator(TickTimeInterface* clock,
|
VCMTimestampExtrapolator(WebRtc_Word32 vcmId = 0, WebRtc_Word32 receiverId = 0);
|
||||||
WebRtc_Word32 vcmId = 0,
|
|
||||||
WebRtc_Word32 receiverId = 0);
|
|
||||||
~VCMTimestampExtrapolator();
|
~VCMTimestampExtrapolator();
|
||||||
void Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool trace = true);
|
void Update(WebRtc_Word64 tMs, WebRtc_UWord32 ts90khz, bool trace = true);
|
||||||
WebRtc_UWord32 ExtrapolateTimestamp(WebRtc_Word64 tMs) const;
|
WebRtc_UWord32 ExtrapolateTimestamp(WebRtc_Word64 tMs) const;
|
||||||
@ -37,7 +33,6 @@ private:
|
|||||||
RWLockWrapper* _rwLock;
|
RWLockWrapper* _rwLock;
|
||||||
WebRtc_Word32 _vcmId;
|
WebRtc_Word32 _vcmId;
|
||||||
WebRtc_Word32 _id;
|
WebRtc_Word32 _id;
|
||||||
TickTimeInterface* _clock;
|
|
||||||
bool _trace;
|
bool _trace;
|
||||||
double _w[2];
|
double _w[2];
|
||||||
double _P[2][2];
|
double _P[2][2];
|
||||||
|
@ -16,14 +16,10 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
VCMTiming::VCMTiming(TickTimeInterface* clock,
|
VCMTiming::VCMTiming(WebRtc_Word32 vcmId, WebRtc_Word32 timingId, VCMTiming* masterTiming)
|
||||||
WebRtc_Word32 vcmId,
|
|
||||||
WebRtc_Word32 timingId,
|
|
||||||
VCMTiming* masterTiming)
|
|
||||||
:
|
:
|
||||||
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_vcmId(vcmId),
|
_vcmId(vcmId),
|
||||||
_clock(clock),
|
|
||||||
_timingId(timingId),
|
_timingId(timingId),
|
||||||
_master(false),
|
_master(false),
|
||||||
_tsExtrapolator(),
|
_tsExtrapolator(),
|
||||||
@ -37,7 +33,7 @@ _prevFrameTimestamp(0)
|
|||||||
if (masterTiming == NULL)
|
if (masterTiming == NULL)
|
||||||
{
|
{
|
||||||
_master = true;
|
_master = true;
|
||||||
_tsExtrapolator = new VCMTimestampExtrapolator(_clock, vcmId, timingId);
|
_tsExtrapolator = new VCMTimestampExtrapolator(vcmId, timingId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
|
|
||||||
class TickTimeInterface;
|
|
||||||
class VCMTimestampExtrapolator;
|
class VCMTimestampExtrapolator;
|
||||||
|
|
||||||
class VCMTiming
|
class VCMTiming
|
||||||
@ -26,8 +25,7 @@ class VCMTiming
|
|||||||
public:
|
public:
|
||||||
// The primary timing component should be passed
|
// The primary timing component should be passed
|
||||||
// if this is the dual timing component.
|
// if this is the dual timing component.
|
||||||
VCMTiming(TickTimeInterface* clock,
|
VCMTiming(WebRtc_Word32 vcmId = 0,
|
||||||
WebRtc_Word32 vcmId = 0,
|
|
||||||
WebRtc_Word32 timingId = 0,
|
WebRtc_Word32 timingId = 0,
|
||||||
VCMTiming* masterTiming = NULL);
|
VCMTiming* masterTiming = NULL);
|
||||||
~VCMTiming();
|
~VCMTiming();
|
||||||
@ -94,7 +92,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
CriticalSectionWrapper* _critSect;
|
CriticalSectionWrapper* _critSect;
|
||||||
WebRtc_Word32 _vcmId;
|
WebRtc_Word32 _vcmId;
|
||||||
TickTimeInterface* _clock;
|
|
||||||
WebRtc_Word32 _timingId;
|
WebRtc_Word32 _timingId;
|
||||||
bool _master;
|
bool _master;
|
||||||
VCMTimestampExtrapolator* _tsExtrapolator;
|
VCMTimestampExtrapolator* _tsExtrapolator;
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
'receiver.h',
|
'receiver.h',
|
||||||
'rtt_filter.h',
|
'rtt_filter.h',
|
||||||
'session_info.h',
|
'session_info.h',
|
||||||
|
'tick_time.h',
|
||||||
'tick_time_interface.h',
|
'tick_time_interface.h',
|
||||||
'timestamp_extrapolator.h',
|
'timestamp_extrapolator.h',
|
||||||
'timestamp_map.h',
|
'timestamp_map.h',
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "video_codec_interface.h"
|
#include "video_codec_interface.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
@ -34,30 +33,26 @@ VCMProcessTimer::TimeUntilProcess() const
|
|||||||
{
|
{
|
||||||
return static_cast<WebRtc_UWord32>(
|
return static_cast<WebRtc_UWord32>(
|
||||||
VCM_MAX(static_cast<WebRtc_Word64>(_periodMs) -
|
VCM_MAX(static_cast<WebRtc_Word64>(_periodMs) -
|
||||||
(_clock->MillisecondTimestamp() - _latestMs), 0));
|
(VCMTickTime::MillisecondTimestamp() - _latestMs), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMProcessTimer::Processed()
|
VCMProcessTimer::Processed()
|
||||||
{
|
{
|
||||||
_latestMs = _clock->MillisecondTimestamp();
|
_latestMs = VCMTickTime::MillisecondTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
|
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id)
|
||||||
TickTimeInterface* clock,
|
|
||||||
bool delete_clock_on_destroy)
|
|
||||||
:
|
:
|
||||||
_id(id),
|
_id(id),
|
||||||
clock_(clock),
|
|
||||||
delete_clock_on_destroy_(delete_clock_on_destroy),
|
|
||||||
_receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_receiverInited(false),
|
_receiverInited(false),
|
||||||
_timing(clock_, id, 1),
|
_timing(id, 1),
|
||||||
_dualTiming(clock_, id, 2, &_timing),
|
_dualTiming(id, 2, &_timing),
|
||||||
_receiver(_timing, clock_, id, 1),
|
_receiver(_timing, id, 1),
|
||||||
_dualReceiver(_dualTiming, clock_, id, 2, false),
|
_dualReceiver(_dualTiming, id, 2, false),
|
||||||
_decodedFrameCallback(_timing, clock_),
|
_decodedFrameCallback(_timing),
|
||||||
_dualDecodedFrameCallback(_dualTiming, clock_),
|
_dualDecodedFrameCallback(_dualTiming),
|
||||||
_frameTypeCallback(NULL),
|
_frameTypeCallback(NULL),
|
||||||
_frameStorageCallback(NULL),
|
_frameStorageCallback(NULL),
|
||||||
_receiveStatsCallback(NULL),
|
_receiveStatsCallback(NULL),
|
||||||
@ -72,18 +67,17 @@ _scheduleKeyRequest(false),
|
|||||||
_sendCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
_sendCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
_encoder(),
|
_encoder(),
|
||||||
_encodedFrameCallback(),
|
_encodedFrameCallback(),
|
||||||
_mediaOpt(id, clock_),
|
_mediaOpt(id),
|
||||||
_sendCodecType(kVideoCodecUnknown),
|
_sendCodecType(kVideoCodecUnknown),
|
||||||
_sendStatsCallback(NULL),
|
_sendStatsCallback(NULL),
|
||||||
_encoderInputFile(NULL),
|
_encoderInputFile(NULL),
|
||||||
|
|
||||||
_codecDataBase(id),
|
_codecDataBase(id),
|
||||||
_receiveStatsTimer(1000, clock_),
|
_receiveStatsTimer(1000),
|
||||||
_sendStatsTimer(1000, clock_),
|
_sendStatsTimer(1000),
|
||||||
_retransmissionTimer(10, clock_),
|
_retransmissionTimer(10),
|
||||||
_keyRequestTimer(500, clock_)
|
_keyRequestTimer(500)
|
||||||
{
|
{
|
||||||
assert(clock_);
|
|
||||||
for (int i = 0; i < kMaxSimulcastStreams; i++)
|
for (int i = 0; i < kMaxSimulcastStreams; i++)
|
||||||
{
|
{
|
||||||
_nextFrameType[i] = kVideoFrameDelta;
|
_nextFrameType[i] = kVideoFrameDelta;
|
||||||
@ -104,7 +98,6 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl()
|
|||||||
}
|
}
|
||||||
delete _receiveCritSect;
|
delete _receiveCritSect;
|
||||||
delete _sendCritSect;
|
delete _sendCritSect;
|
||||||
if (delete_clock_on_destroy_) delete clock_;
|
|
||||||
#ifdef DEBUG_DECODER_BIT_STREAM
|
#ifdef DEBUG_DECODER_BIT_STREAM
|
||||||
fclose(_bitStreamBeforeDecoder);
|
fclose(_bitStreamBeforeDecoder);
|
||||||
#endif
|
#endif
|
||||||
@ -120,18 +113,7 @@ VideoCodingModule::Create(const WebRtc_Word32 id)
|
|||||||
webrtc::kTraceVideoCoding,
|
webrtc::kTraceVideoCoding,
|
||||||
VCMId(id),
|
VCMId(id),
|
||||||
"VideoCodingModule::Create()");
|
"VideoCodingModule::Create()");
|
||||||
return new VideoCodingModuleImpl(id, new TickTimeInterface(), true);
|
return new VideoCodingModuleImpl(id);
|
||||||
}
|
|
||||||
|
|
||||||
VideoCodingModule*
|
|
||||||
VideoCodingModule::Create(const WebRtc_Word32 id, TickTimeInterface* clock)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceModuleCall,
|
|
||||||
webrtc::kTraceVideoCoding,
|
|
||||||
VCMId(id),
|
|
||||||
"VideoCodingModule::Create()");
|
|
||||||
assert(clock);
|
|
||||||
return new VideoCodingModuleImpl(id, clock, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1103,7 +1085,7 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs)
|
|||||||
|
|
||||||
// If this frame was too late, we should adjust the delay accordingly
|
// If this frame was too late, we should adjust the delay accordingly
|
||||||
_timing.UpdateCurrentDelay(frame->RenderTimeMs(),
|
_timing.UpdateCurrentDelay(frame->RenderTimeMs(),
|
||||||
clock_->MillisecondTimestamp());
|
VCMTickTime::MillisecondTimestamp());
|
||||||
|
|
||||||
#ifdef DEBUG_DECODER_BIT_STREAM
|
#ifdef DEBUG_DECODER_BIT_STREAM
|
||||||
if (_bitStreamBeforeDecoder != NULL)
|
if (_bitStreamBeforeDecoder != NULL)
|
||||||
@ -1220,8 +1202,7 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs)
|
|||||||
"Decoding frame %u with dual decoder",
|
"Decoding frame %u with dual decoder",
|
||||||
dualFrame->TimeStamp());
|
dualFrame->TimeStamp());
|
||||||
// Decode dualFrame and try to catch up
|
// Decode dualFrame and try to catch up
|
||||||
WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame,
|
WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame);
|
||||||
clock_->MillisecondTimestamp());
|
|
||||||
if (ret != WEBRTC_VIDEO_CODEC_OK)
|
if (ret != WEBRTC_VIDEO_CODEC_OK)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceWarning,
|
WEBRTC_TRACE(webrtc::kTraceWarning,
|
||||||
@ -1269,7 +1250,7 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
|
|||||||
return VCM_NO_CODEC_REGISTERED;
|
return VCM_NO_CODEC_REGISTERED;
|
||||||
}
|
}
|
||||||
// Decode a frame
|
// Decode a frame
|
||||||
WebRtc_Word32 ret = _decoder->Decode(frame, clock_->MillisecondTimestamp());
|
WebRtc_Word32 ret = _decoder->Decode(frame);
|
||||||
|
|
||||||
// Check for failed decoding, run frame type request callback if needed.
|
// Check for failed decoding, run frame type request callback if needed.
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "generic_decoder.h"
|
#include "generic_decoder.h"
|
||||||
#include "generic_encoder.h"
|
#include "generic_encoder.h"
|
||||||
#include "media_optimization.h"
|
#include "media_optimization.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -31,16 +30,13 @@ namespace webrtc
|
|||||||
class VCMProcessTimer
|
class VCMProcessTimer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMProcessTimer(WebRtc_UWord32 periodMs, TickTimeInterface* clock)
|
VCMProcessTimer(WebRtc_UWord32 periodMs) :
|
||||||
: _clock(clock),
|
_periodMs(periodMs), _latestMs(VCMTickTime::MillisecondTimestamp()) {}
|
||||||
_periodMs(periodMs),
|
|
||||||
_latestMs(_clock->MillisecondTimestamp()) {}
|
|
||||||
WebRtc_UWord32 Period() const;
|
WebRtc_UWord32 Period() const;
|
||||||
WebRtc_UWord32 TimeUntilProcess() const;
|
WebRtc_UWord32 TimeUntilProcess() const;
|
||||||
void Processed();
|
void Processed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TickTimeInterface* _clock;
|
|
||||||
WebRtc_UWord32 _periodMs;
|
WebRtc_UWord32 _periodMs;
|
||||||
WebRtc_Word64 _latestMs;
|
WebRtc_Word64 _latestMs;
|
||||||
};
|
};
|
||||||
@ -57,9 +53,7 @@ enum VCMKeyRequestMode
|
|||||||
class VideoCodingModuleImpl : public VideoCodingModule
|
class VideoCodingModuleImpl : public VideoCodingModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VideoCodingModuleImpl(const WebRtc_Word32 id,
|
VideoCodingModuleImpl(const WebRtc_Word32 id);
|
||||||
TickTimeInterface* clock,
|
|
||||||
bool delete_clock_on_destroy);
|
|
||||||
|
|
||||||
virtual ~VideoCodingModuleImpl();
|
virtual ~VideoCodingModuleImpl();
|
||||||
|
|
||||||
@ -265,8 +259,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
WebRtc_Word32 _id;
|
WebRtc_Word32 _id;
|
||||||
TickTimeInterface* clock_;
|
|
||||||
bool delete_clock_on_destroy_;
|
|
||||||
CriticalSectionWrapper* _receiveCritSect;
|
CriticalSectionWrapper* _receiveCritSect;
|
||||||
bool _receiverInited;
|
bool _receiverInited;
|
||||||
VCMTiming _timing;
|
VCMTiming _timing;
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
#include "video_coding.h"
|
#include "video_coding.h"
|
||||||
#include "rtp_rtcp.h"
|
#include "rtp_rtcp.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
#include "rtp_player.h"
|
#include "rtp_player.h"
|
||||||
#include "modules/video_coding/main/source/mock/fake_tick_time_interface.h"
|
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ private:
|
|||||||
|
|
||||||
int DecodeFromStorageTest(CmdArgs& args)
|
int DecodeFromStorageTest(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Make sure this test isn't executed without simulated events.
|
// Make sure this test isn't executed without simulated clocks
|
||||||
#if !defined(EVENT_DEBUG)
|
#if !defined(TICK_TIME_DEBUG) || !defined(EVENT_DEBUG)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
// BEGIN Settings
|
// BEGIN Settings
|
||||||
@ -64,10 +64,8 @@ int DecodeFromStorageTest(CmdArgs& args)
|
|||||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||||
|
|
||||||
|
|
||||||
FakeTickTime clock(0);
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
// TODO(hlundin): This test was not verified after changing to FakeTickTime.
|
VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
|
||||||
VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2, &clock);
|
|
||||||
FrameStorageCallback storageCallback(vcmPlayback);
|
FrameStorageCallback storageCallback(vcmPlayback);
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
||||||
@ -82,7 +80,7 @@ int DecodeFromStorageTest(CmdArgs& args)
|
|||||||
}
|
}
|
||||||
vcm->RegisterFrameStorageCallback(&storageCallback);
|
vcm->RegisterFrameStorageCallback(&storageCallback);
|
||||||
vcmPlayback->RegisterReceiveCallback(&receiveCallback);
|
vcmPlayback->RegisterReceiveCallback(&receiveCallback);
|
||||||
RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, &clock);
|
RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback);
|
||||||
ListWrapper payloadTypes;
|
ListWrapper payloadTypes;
|
||||||
payloadTypes.PushFront(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8", kVideoCodecVP8));
|
payloadTypes.PushFront(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8", kVideoCodecVP8));
|
||||||
|
|
||||||
@ -126,9 +124,9 @@ int DecodeFromStorageTest(CmdArgs& args)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
// RTP stream main loop
|
// RTP stream main loop
|
||||||
while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
|
while ((ret = rtpStream.NextPacket(VCMTickTime::MillisecondTimestamp())) == 0)
|
||||||
{
|
{
|
||||||
if (clock.MillisecondTimestamp() % 5 == 0)
|
if (VCMTickTime::MillisecondTimestamp() % 5 == 0)
|
||||||
{
|
{
|
||||||
ret = vcm->Decode();
|
ret = vcm->Decode();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -140,11 +138,11 @@ int DecodeFromStorageTest(CmdArgs& args)
|
|||||||
{
|
{
|
||||||
vcm->Process();
|
vcm->Process();
|
||||||
}
|
}
|
||||||
if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >= MAX_RUNTIME_MS)
|
if (MAX_RUNTIME_MS > -1 && VCMTickTime::MillisecondTimestamp() >= MAX_RUNTIME_MS)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
clock.IncrementDebugClock(1);
|
VCMTickTime::IncrementDebugClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
#include "generic_codec_test.h"
|
#include "generic_codec_test.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "tick_time.h"
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
#include "rtp_rtcp.h"
|
#include "rtp_rtcp.h"
|
||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "modules/video_coding/main/source/mock/fake_tick_time_interface.h"
|
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -23,13 +23,12 @@ enum { kMaxWaitEncTimeMs = 100 };
|
|||||||
|
|
||||||
int GenericCodecTest::RunTest(CmdArgs& args)
|
int GenericCodecTest::RunTest(CmdArgs& args)
|
||||||
{
|
{
|
||||||
#if !defined(EVENT_DEBUG)
|
#if !defined(TICK_TIME_DEBUG) || !defined(EVENT_DEBUG)
|
||||||
printf("\n\nEnable debug events to run this test!\n\n");
|
printf("\n\nEnable debug time to run this test!\n\n");
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
FakeTickTime clock(0);
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
GenericCodecTest* get = new GenericCodecTest(vcm);
|
||||||
GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
|
|
||||||
Trace::CreateTrace();
|
Trace::CreateTrace();
|
||||||
Trace::SetTraceFile(
|
Trace::SetTraceFile(
|
||||||
(test::OutputPath() + "genericCodecTestTrace.txt").c_str());
|
(test::OutputPath() + "genericCodecTestTrace.txt").c_str());
|
||||||
@ -41,8 +40,7 @@ int GenericCodecTest::RunTest(CmdArgs& args)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm, FakeTickTime* clock):
|
GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm):
|
||||||
_clock(clock),
|
|
||||||
_vcm(vcm),
|
_vcm(vcm),
|
||||||
_width(0),
|
_width(0),
|
||||||
_height(0),
|
_height(0),
|
||||||
@ -309,7 +307,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
|||||||
_vcm->SetChannelParameters((WebRtc_UWord32)_bitRate, 0, 20);
|
_vcm->SetChannelParameters((WebRtc_UWord32)_bitRate, 0, 20);
|
||||||
_frameCnt = 0;
|
_frameCnt = 0;
|
||||||
totalBytes = 0;
|
totalBytes = 0;
|
||||||
startTime = _clock->MicrosecondTimestamp();
|
startTime = VCMTickTime::MicrosecondTimestamp();
|
||||||
_encodeCompleteCallback->Initialize();
|
_encodeCompleteCallback->Initialize();
|
||||||
sendStats.SetTargetFrameRate(static_cast<WebRtc_UWord32>(_frameRate));
|
sendStats.SetTargetFrameRate(static_cast<WebRtc_UWord32>(_frameRate));
|
||||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||||
@ -333,7 +331,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
|||||||
//currentTime = VCMTickTime::MillisecondTimestamp();//clock()/(double)CLOCKS_PER_SEC;
|
//currentTime = VCMTickTime::MillisecondTimestamp();//clock()/(double)CLOCKS_PER_SEC;
|
||||||
if (_frameCnt == _frameRate)// @ 1sec
|
if (_frameCnt == _frameRate)// @ 1sec
|
||||||
{
|
{
|
||||||
oneSecTime = _clock->MicrosecondTimestamp();
|
oneSecTime = VCMTickTime::MicrosecondTimestamp();
|
||||||
totalBytesOneSec = _encodeCompleteCallback->EncodedBytes();//totalBytes;
|
totalBytesOneSec = _encodeCompleteCallback->EncodedBytes();//totalBytes;
|
||||||
}
|
}
|
||||||
TEST(_vcm->TimeUntilNextProcess() >= 0);
|
TEST(_vcm->TimeUntilNextProcess() >= 0);
|
||||||
@ -343,7 +341,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
|||||||
// estimating rates
|
// estimating rates
|
||||||
// complete sequence
|
// complete sequence
|
||||||
// bit rate assumes input frame rate is as specified
|
// bit rate assumes input frame rate is as specified
|
||||||
currentTime = _clock->MicrosecondTimestamp();
|
currentTime = VCMTickTime::MicrosecondTimestamp();
|
||||||
totalBytes = _encodeCompleteCallback->EncodedBytes();
|
totalBytes = _encodeCompleteCallback->EncodedBytes();
|
||||||
actualBitrate = (float)(8.0/1000)*(totalBytes / (_frameCnt / _frameRate));
|
actualBitrate = (float)(8.0/1000)*(totalBytes / (_frameCnt / _frameRate));
|
||||||
|
|
||||||
@ -516,8 +514,8 @@ GenericCodecTest::Print()
|
|||||||
float
|
float
|
||||||
GenericCodecTest::WaitForEncodedFrame() const
|
GenericCodecTest::WaitForEncodedFrame() const
|
||||||
{
|
{
|
||||||
WebRtc_Word64 startTime = _clock->MillisecondTimestamp();
|
WebRtc_Word64 startTime = TickTime::MillisecondTimestamp();
|
||||||
while (_clock->MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs*10)
|
while (TickTime::MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs*10)
|
||||||
{
|
{
|
||||||
if (_encodeCompleteCallback->EncodeComplete())
|
if (_encodeCompleteCallback->EncodeComplete())
|
||||||
{
|
{
|
||||||
@ -530,7 +528,11 @@ GenericCodecTest::WaitForEncodedFrame() const
|
|||||||
void
|
void
|
||||||
GenericCodecTest::IncrementDebugClock(float frameRate)
|
GenericCodecTest::IncrementDebugClock(float frameRate)
|
||||||
{
|
{
|
||||||
_clock->IncrementDebugClock(1000/frameRate);
|
for (int t= 0; t < 1000/frameRate; t++)
|
||||||
|
{
|
||||||
|
VCMTickTime::IncrementDebugClock();
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -31,13 +31,10 @@ namespace webrtc {
|
|||||||
|
|
||||||
int VCMGenericCodecTest(CmdArgs& args);
|
int VCMGenericCodecTest(CmdArgs& args);
|
||||||
|
|
||||||
class FakeTickTime;
|
|
||||||
|
|
||||||
class GenericCodecTest
|
class GenericCodecTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericCodecTest(webrtc::VideoCodingModule* vcm,
|
GenericCodecTest(webrtc::VideoCodingModule* vcm);
|
||||||
webrtc::FakeTickTime* clock);
|
|
||||||
~GenericCodecTest();
|
~GenericCodecTest();
|
||||||
static int RunTest(CmdArgs& args);
|
static int RunTest(CmdArgs& args);
|
||||||
WebRtc_Word32 Perform(CmdArgs& args);
|
WebRtc_Word32 Perform(CmdArgs& args);
|
||||||
@ -49,7 +46,6 @@ private:
|
|||||||
WebRtc_Word32 TearDown();
|
WebRtc_Word32 TearDown();
|
||||||
void IncrementDebugClock(float frameRate);
|
void IncrementDebugClock(float frameRate);
|
||||||
|
|
||||||
webrtc::FakeTickTime* _clock;
|
|
||||||
webrtc::VideoCodingModule* _vcm;
|
webrtc::VideoCodingModule* _vcm;
|
||||||
webrtc::VideoCodec _sendCodec;
|
webrtc::VideoCodec _sendCodec;
|
||||||
webrtc::VideoCodec _receiveCodec;
|
webrtc::VideoCodec _receiveCodec;
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
#include "jitter_estimate_test.h"
|
#include "jitter_estimate_test.h"
|
||||||
#include "jitter_estimator.h"
|
#include "jitter_estimator.h"
|
||||||
#include "media_opt_util.h"
|
#include "media_opt_util.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "test_util.h"
|
#include "test_util.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
#include "tick_time.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -92,11 +92,10 @@ int CheckOutFrame(VCMEncodedFrame* frameOut, unsigned int size, bool startCode)
|
|||||||
|
|
||||||
int JitterBufferTest(CmdArgs& args)
|
int JitterBufferTest(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Don't run these tests with debug event.
|
// Don't run these tests with debug time
|
||||||
#if defined(EVENT_DEBUG)
|
#if defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
TickTimeInterface clock;
|
|
||||||
|
|
||||||
// Start test
|
// Start test
|
||||||
WebRtc_UWord16 seqNum = 1234;
|
WebRtc_UWord16 seqNum = 1234;
|
||||||
@ -115,7 +114,7 @@ int JitterBufferTest(CmdArgs& args)
|
|||||||
packet.seqNum = seqNum;
|
packet.seqNum = seqNum;
|
||||||
packet.payloadType = 126;
|
packet.payloadType = 126;
|
||||||
seqNum++;
|
seqNum++;
|
||||||
fb->InsertPacket(packet, clock.MillisecondTimestamp(), false, 0);
|
fb->InsertPacket(packet, VCMTickTime::MillisecondTimestamp(), false, 0);
|
||||||
TEST(frameList.Insert(fb) == 0);
|
TEST(frameList.Insert(fb) == 0);
|
||||||
}
|
}
|
||||||
VCMFrameListItem* item = NULL;
|
VCMFrameListItem* item = NULL;
|
||||||
@ -136,7 +135,7 @@ int JitterBufferTest(CmdArgs& args)
|
|||||||
|
|
||||||
//printf("DONE timestamp ordered frame list\n");
|
//printf("DONE timestamp ordered frame list\n");
|
||||||
|
|
||||||
VCMJitterBuffer jb(&clock);
|
VCMJitterBuffer jb;
|
||||||
|
|
||||||
seqNum = 1234;
|
seqNum = 1234;
|
||||||
timeStamp = 123*90;
|
timeStamp = 123*90;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "JitterEstimateTest.h"
|
#include "JitterEstimateTest.h"
|
||||||
|
#include "tick_time.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
|
@ -34,9 +34,8 @@ int MediaOptTest::RunTest(int testNum, CmdArgs& args)
|
|||||||
Trace::CreateTrace();
|
Trace::CreateTrace();
|
||||||
Trace::SetTraceFile((test::OutputPath() + "mediaOptTestTrace.txt").c_str());
|
Trace::SetTraceFile((test::OutputPath() + "mediaOptTestTrace.txt").c_str());
|
||||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||||
TickTimeInterface clock;
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
MediaOptTest* mot = new MediaOptTest(vcm);
|
||||||
MediaOptTest* mot = new MediaOptTest(vcm, &clock);
|
|
||||||
if (testNum == 0)
|
if (testNum == 0)
|
||||||
{ // regular
|
{ // regular
|
||||||
mot->Setup(0, args);
|
mot->Setup(0, args);
|
||||||
@ -67,9 +66,8 @@ int MediaOptTest::RunTest(int testNum, CmdArgs& args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MediaOptTest::MediaOptTest(VideoCodingModule* vcm, TickTimeInterface* clock):
|
MediaOptTest::MediaOptTest(VideoCodingModule* vcm):
|
||||||
_vcm(vcm),
|
_vcm(vcm),
|
||||||
_clock(clock),
|
|
||||||
_width(0),
|
_width(0),
|
||||||
_height(0),
|
_height(0),
|
||||||
_lengthSourceFrame(0),
|
_lengthSourceFrame(0),
|
||||||
@ -281,8 +279,7 @@ MediaOptTest::Perform()
|
|||||||
encodeCompleteCallback->SetCodecType(ConvertCodecType(_codecName.c_str()));
|
encodeCompleteCallback->SetCodecType(ConvertCodecType(_codecName.c_str()));
|
||||||
encodeCompleteCallback->SetFrameDimensions(_width, _height);
|
encodeCompleteCallback->SetFrameDimensions(_width, _height);
|
||||||
// frame ready to be sent to network
|
// frame ready to be sent to network
|
||||||
RTPSendCompleteCallback* outgoingTransport =
|
RTPSendCompleteCallback* outgoingTransport = new RTPSendCompleteCallback(_rtp);
|
||||||
new RTPSendCompleteCallback(_rtp, _clock);
|
|
||||||
_rtp->RegisterSendTransport(outgoingTransport);
|
_rtp->RegisterSendTransport(outgoingTransport);
|
||||||
//FrameReceiveCallback
|
//FrameReceiveCallback
|
||||||
VCMDecodeCompleteCallback receiveCallback(_decodedFile);
|
VCMDecodeCompleteCallback receiveCallback(_decodedFile);
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
class MediaOptTest
|
class MediaOptTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MediaOptTest(webrtc::VideoCodingModule* vcm,
|
MediaOptTest(webrtc::VideoCodingModule* vcm);
|
||||||
webrtc::TickTimeInterface* clock);
|
|
||||||
~MediaOptTest();
|
~MediaOptTest();
|
||||||
|
|
||||||
static int RunTest(int testNum, CmdArgs& args);
|
static int RunTest(int testNum, CmdArgs& args);
|
||||||
@ -52,7 +51,6 @@ private:
|
|||||||
|
|
||||||
webrtc::VideoCodingModule* _vcm;
|
webrtc::VideoCodingModule* _vcm;
|
||||||
webrtc::RtpRtcp* _rtp;
|
webrtc::RtpRtcp* _rtp;
|
||||||
webrtc::TickTimeInterface* _clock;
|
|
||||||
std::string _inname;
|
std::string _inname;
|
||||||
std::string _outname;
|
std::string _outname;
|
||||||
std::string _actualSourcename;
|
std::string _actualSourcename;
|
||||||
|
@ -170,8 +170,7 @@ int MTRxTxTest(CmdArgs& args)
|
|||||||
TEST(rtp->SetGenericFECStatus(fecEnabled, VCM_RED_PAYLOAD_TYPE, VCM_ULPFEC_PAYLOAD_TYPE) == 0);
|
TEST(rtp->SetGenericFECStatus(fecEnabled, VCM_RED_PAYLOAD_TYPE, VCM_ULPFEC_PAYLOAD_TYPE) == 0);
|
||||||
|
|
||||||
//VCM
|
//VCM
|
||||||
TickTimeInterface clock;
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
|
||||||
if (vcm->InitializeReceiver() < 0)
|
if (vcm->InitializeReceiver() < 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -216,8 +215,7 @@ int MTRxTxTest(CmdArgs& args)
|
|||||||
encodeCompleteCallback->SetCodecType(ConvertCodecType(args.codecName.c_str()));
|
encodeCompleteCallback->SetCodecType(ConvertCodecType(args.codecName.c_str()));
|
||||||
encodeCompleteCallback->SetFrameDimensions(width, height);
|
encodeCompleteCallback->SetFrameDimensions(width, height);
|
||||||
// frame ready to be sent to network
|
// frame ready to be sent to network
|
||||||
RTPSendCompleteCallback* outgoingTransport =
|
RTPSendCompleteCallback* outgoingTransport = new RTPSendCompleteCallback(rtp, "dump.rtp");
|
||||||
new RTPSendCompleteCallback(rtp, &clock, "dump.rtp");
|
|
||||||
rtp->RegisterSendTransport(outgoingTransport);
|
rtp->RegisterSendTransport(outgoingTransport);
|
||||||
// FrameReceiveCallback
|
// FrameReceiveCallback
|
||||||
VCMDecodeCompleteCallback receiveCallback(decodedFile);
|
VCMDecodeCompleteCallback receiveCallback(decodedFile);
|
||||||
|
@ -12,15 +12,13 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "rtp_dump.h"
|
#include "rtp_dump.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
TransportCallback::TransportCallback(webrtc::RtpRtcp* rtp,
|
TransportCallback::TransportCallback(webrtc::RtpRtcp* rtp,
|
||||||
TickTimeInterface* clock,
|
|
||||||
const char* filename):
|
const char* filename):
|
||||||
RTPSendCompleteCallback(rtp, clock, filename)
|
RTPSendCompleteCallback(rtp, filename)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -51,8 +49,7 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
|
|||||||
transmitPacket = PacketLoss();
|
transmitPacket = PacketLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
TickTimeInterface clock;
|
WebRtc_UWord64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
int64_t now = clock.MillisecondTimestamp();
|
|
||||||
// Insert outgoing packet into list
|
// Insert outgoing packet into list
|
||||||
if (transmitPacket)
|
if (transmitPacket)
|
||||||
{
|
{
|
||||||
@ -76,8 +73,7 @@ TransportCallback::TransportPackets()
|
|||||||
{
|
{
|
||||||
// Are we ready to send packets to the receiver?
|
// Are we ready to send packets to the receiver?
|
||||||
rtpPacket* packet = NULL;
|
rtpPacket* packet = NULL;
|
||||||
TickTimeInterface clock;
|
WebRtc_UWord64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
int64_t now = clock.MillisecondTimestamp();
|
|
||||||
|
|
||||||
while (!_rtpPackets.Empty())
|
while (!_rtpPackets.Empty())
|
||||||
{
|
{
|
||||||
|
@ -47,15 +47,15 @@ class TransportCallback:public RTPSendCompleteCallback
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor input: (receive side) rtp module to send encoded data to
|
// constructor input: (receive side) rtp module to send encoded data to
|
||||||
TransportCallback(webrtc::RtpRtcp* rtp, TickTimeInterface* clock,
|
TransportCallback(webrtc::RtpRtcp* rtp,
|
||||||
const char* filename = NULL);
|
const char* filename = NULL);
|
||||||
virtual ~TransportCallback();
|
virtual ~TransportCallback();
|
||||||
// Add packets to list
|
// Add packets to list
|
||||||
// Incorporate network conditions - delay and packet loss
|
// Incorporate network conditions - delay and packet loss
|
||||||
// Actual transmission will occur on a separate thread
|
// Actual transmission will occur on a separate thread
|
||||||
int SendPacket(int channel, const void *data, int len);
|
int SendPacket(int channel, const void *data, int len);
|
||||||
// Send to the receiver packets which are ready to be submitted
|
// Send to the receiver packets which are ready to be submitted
|
||||||
int TransportPackets();
|
int TransportPackets();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SharedRTPState
|
class SharedRTPState
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
#include "common_types.h"
|
#include "common_types.h"
|
||||||
#include "modules/video_coding/main/source/mock/fake_tick_time_interface.h"
|
|
||||||
#include "test_callbacks.h"
|
#include "test_callbacks.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "test_util.h"
|
#include "test_util.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "testsupport/metrics/video_metrics.h"
|
#include "testsupport/metrics/video_metrics.h"
|
||||||
|
|
||||||
@ -28,22 +28,20 @@ using namespace webrtc;
|
|||||||
|
|
||||||
int NormalTest::RunTest(CmdArgs& args)
|
int NormalTest::RunTest(CmdArgs& args)
|
||||||
{
|
{
|
||||||
#if defined(EVENT_DEBUG)
|
// Don't run this test with debug time
|
||||||
|
#if defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG)
|
||||||
printf("SIMULATION TIME\n");
|
printf("SIMULATION TIME\n");
|
||||||
TickTimeInterface* clock = new FakeTickTime(0);
|
|
||||||
#else
|
#else
|
||||||
printf("REAL-TIME\n");
|
printf("REAL-TIME\n");
|
||||||
TickTimeInterface* clock = new TickTimeInterface;
|
|
||||||
#endif
|
#endif
|
||||||
Trace::CreateTrace();
|
Trace::CreateTrace();
|
||||||
Trace::SetTraceFile(
|
Trace::SetTraceFile(
|
||||||
(test::OutputPath() + "VCMNormalTestTrace.txt").c_str());
|
(test::OutputPath() + "VCMNormalTestTrace.txt").c_str());
|
||||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
NormalTest VCMNTest(vcm, clock);
|
NormalTest VCMNTest(vcm);
|
||||||
VCMNTest.Perform(args);
|
VCMNTest.Perform(args);
|
||||||
VideoCodingModule::Destroy(vcm);
|
VideoCodingModule::Destroy(vcm);
|
||||||
delete clock;
|
|
||||||
Trace::ReturnTrace();
|
Trace::ReturnTrace();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -184,9 +182,8 @@ VCMNTDecodeCompleCallback::DecodedBytes()
|
|||||||
|
|
||||||
//VCM Normal Test Class implementation
|
//VCM Normal Test Class implementation
|
||||||
|
|
||||||
NormalTest::NormalTest(VideoCodingModule* vcm, TickTimeInterface* clock)
|
NormalTest::NormalTest(VideoCodingModule* vcm)
|
||||||
:
|
:
|
||||||
_clock(clock),
|
|
||||||
_vcm(vcm),
|
_vcm(vcm),
|
||||||
_sumEncBytes(0),
|
_sumEncBytes(0),
|
||||||
_timeStamp(0),
|
_timeStamp(0),
|
||||||
@ -284,8 +281,8 @@ NormalTest::Perform(CmdArgs& args)
|
|||||||
|
|
||||||
while (feof(_sourceFile) == 0)
|
while (feof(_sourceFile) == 0)
|
||||||
{
|
{
|
||||||
#if !defined(EVENT_DEBUG)
|
#if !(defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG))
|
||||||
WebRtc_Word64 processStartTime = _clock->MillisecondTimestamp();
|
WebRtc_Word64 processStartTime = VCMTickTime::MillisecondTimestamp();
|
||||||
#endif
|
#endif
|
||||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
||||||
feof(_sourceFile));
|
feof(_sourceFile));
|
||||||
@ -317,10 +314,13 @@ NormalTest::Perform(CmdArgs& args)
|
|||||||
_vcm->Process();
|
_vcm->Process();
|
||||||
}
|
}
|
||||||
WebRtc_UWord32 framePeriod = static_cast<WebRtc_UWord32>(1000.0f/static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
WebRtc_UWord32 framePeriod = static_cast<WebRtc_UWord32>(1000.0f/static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
||||||
#if defined(EVENT_DEBUG)
|
#if defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG)
|
||||||
static_cast<FakeTickTime*>(_clock)->IncrementDebugClock(framePeriod);
|
for (unsigned int i=0; i < framePeriod; i++)
|
||||||
|
{
|
||||||
|
VCMTickTime::IncrementDebugClock();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
WebRtc_Word64 timeSpent = _clock->MillisecondTimestamp() - processStartTime;
|
WebRtc_Word64 timeSpent = VCMTickTime::MillisecondTimestamp() - processStartTime;
|
||||||
if (timeSpent < framePeriod)
|
if (timeSpent < framePeriod)
|
||||||
{
|
{
|
||||||
waitEvent->Wait(framePeriod - timeSpent);
|
waitEvent->Wait(framePeriod - timeSpent);
|
||||||
|
@ -83,8 +83,7 @@ private:
|
|||||||
class NormalTest
|
class NormalTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NormalTest(webrtc::VideoCodingModule* vcm,
|
NormalTest(webrtc::VideoCodingModule* vcm);
|
||||||
webrtc::TickTimeInterface* clock);
|
|
||||||
~NormalTest();
|
~NormalTest();
|
||||||
static int RunTest(CmdArgs& args);
|
static int RunTest(CmdArgs& args);
|
||||||
WebRtc_Word32 Perform(CmdArgs& args);
|
WebRtc_Word32 Perform(CmdArgs& args);
|
||||||
@ -106,7 +105,6 @@ protected:
|
|||||||
// calculating pipeline delay, and decoding time
|
// calculating pipeline delay, and decoding time
|
||||||
void FrameDecoded(WebRtc_UWord32 timeStamp);
|
void FrameDecoded(WebRtc_UWord32 timeStamp);
|
||||||
|
|
||||||
webrtc::TickTimeInterface* _clock;
|
|
||||||
webrtc::VideoCodingModule* _vcm;
|
webrtc::VideoCodingModule* _vcm;
|
||||||
webrtc::VideoCodec _sendCodec;
|
webrtc::VideoCodec _sendCodec;
|
||||||
webrtc::VideoCodec _receiveCodec;
|
webrtc::VideoCodec _receiveCodec;
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "test_callbacks.h"
|
#include "test_callbacks.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "testsupport/metrics/video_metrics.h"
|
#include "testsupport/metrics/video_metrics.h"
|
||||||
@ -25,22 +24,20 @@ using namespace webrtc;
|
|||||||
|
|
||||||
int qualityModeTest()
|
int qualityModeTest()
|
||||||
{
|
{
|
||||||
// Don't run this test with debug events.
|
// Don't run this test with debug time
|
||||||
#if defined(EVENT_DEBUG)
|
#if defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
TickTimeInterface clock;
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
QualityModesTest QMTest(vcm);
|
||||||
QualityModesTest QMTest(vcm, &clock);
|
|
||||||
QMTest.Perform();
|
QMTest.Perform();
|
||||||
VideoCodingModule::Destroy(vcm);
|
VideoCodingModule::Destroy(vcm);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QualityModesTest::QualityModesTest(VideoCodingModule* vcm,
|
QualityModesTest::QualityModesTest(VideoCodingModule *vcm):
|
||||||
TickTimeInterface* clock):
|
NormalTest(vcm),
|
||||||
NormalTest(vcm, clock),
|
|
||||||
_vpm()
|
_vpm()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -20,8 +20,7 @@ int qualityModeTest();
|
|||||||
class QualityModesTest : public NormalTest
|
class QualityModesTest : public NormalTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QualityModesTest(webrtc::VideoCodingModule* vcm,
|
QualityModesTest(webrtc::VideoCodingModule* vcm);
|
||||||
webrtc::TickTimeInterface* clock);
|
|
||||||
virtual ~QualityModesTest();
|
virtual ~QualityModesTest();
|
||||||
WebRtc_Word32 Perform();
|
WebRtc_Word32 Perform();
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "receiver_tests.h"
|
#include "receiver_tests.h"
|
||||||
#include "video_coding.h"
|
#include "video_coding.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
#include "../source/internal_defines.h"
|
#include "../source/internal_defines.h"
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
@ -48,8 +49,8 @@ public:
|
|||||||
|
|
||||||
int ReceiverTimingTests(CmdArgs& args)
|
int ReceiverTimingTests(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Make sure this test is never executed with simulated events.
|
// Make sure this test is never executed with simulated clocks
|
||||||
#if defined(EVENT_DEBUG)
|
#if defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -61,8 +62,7 @@ int ReceiverTimingTests(CmdArgs& args)
|
|||||||
// A static random seed
|
// A static random seed
|
||||||
srand(0);
|
srand(0);
|
||||||
|
|
||||||
TickTimeInterface clock;
|
VCMTiming timing;
|
||||||
VCMTiming timing(&clock);
|
|
||||||
float clockInMs = 0.0;
|
float clockInMs = 0.0;
|
||||||
WebRtc_UWord32 waitTime = 0;
|
WebRtc_UWord32 waitTime = 0;
|
||||||
WebRtc_UWord32 jitterDelayMs = 0;
|
WebRtc_UWord32 jitterDelayMs = 0;
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
#include "../source/internal_defines.h"
|
#include "../source/internal_defines.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "rtp_rtcp.h"
|
#include "rtp_rtcp.h"
|
||||||
|
#include "tick_time.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -82,9 +82,7 @@ WebRtc_UWord32 LostPackets::AddPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtp
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebRtc_UWord32 LostPackets::SetResendTime(WebRtc_UWord16 sequenceNumber,
|
WebRtc_UWord32 LostPackets::SetResendTime(WebRtc_UWord16 sequenceNumber, WebRtc_Word64 resendTime)
|
||||||
WebRtc_Word64 resendTime,
|
|
||||||
WebRtc_Word64 nowMs)
|
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_critSect);
|
CriticalSectionScoped cs(_critSect);
|
||||||
ListItem* item = First();
|
ListItem* item = First();
|
||||||
@ -92,6 +90,7 @@ WebRtc_UWord32 LostPackets::SetResendTime(WebRtc_UWord16 sequenceNumber,
|
|||||||
{
|
{
|
||||||
RawRtpPacket* packet = static_cast<RawRtpPacket*>(item->GetItem());
|
RawRtpPacket* packet = static_cast<RawRtpPacket*>(item->GetItem());
|
||||||
const WebRtc_UWord16 seqNo = (packet->rtpData[2] << 8) + packet->rtpData[3];
|
const WebRtc_UWord16 seqNo = (packet->rtpData[2] << 8) + packet->rtpData[3];
|
||||||
|
const WebRtc_Word64 nowMs = VCMTickTime::MillisecondTimestamp();
|
||||||
if (sequenceNumber == seqNo && packet->resendTimeMs + 10 < nowMs)
|
if (sequenceNumber == seqNo && packet->resendTimeMs + 10 < nowMs)
|
||||||
{
|
{
|
||||||
if (_debugFile != NULL)
|
if (_debugFile != NULL)
|
||||||
@ -124,21 +123,18 @@ WebRtc_UWord32 LostPackets::NumberOfPacketsToResend() const
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LostPackets::ResentPacket(WebRtc_UWord16 seqNo, WebRtc_Word64 nowMs)
|
void LostPackets::ResentPacket(WebRtc_UWord16 seqNo)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_critSect);
|
CriticalSectionScoped cs(_critSect);
|
||||||
if (_debugFile != NULL)
|
if (_debugFile != NULL)
|
||||||
{
|
{
|
||||||
fprintf(_debugFile, "Resent %u at %u\n", seqNo,
|
fprintf(_debugFile, "Resent %u at %u\n", seqNo,
|
||||||
MaskWord64ToUWord32(nowMs));
|
MaskWord64ToUWord32(VCMTickTime::MillisecondTimestamp()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RTPPlayer::RTPPlayer(const char* filename,
|
RTPPlayer::RTPPlayer(const char* filename, RtpData* callback)
|
||||||
RtpData* callback,
|
|
||||||
TickTimeInterface* clock)
|
|
||||||
:
|
:
|
||||||
_clock(clock),
|
|
||||||
_rtpModule(*RtpRtcp::CreateRtpRtcp(1, false)),
|
_rtpModule(*RtpRtcp::CreateRtpRtcp(1, false)),
|
||||||
_nextRtpTime(0),
|
_nextRtpTime(0),
|
||||||
_dataCallback(callback),
|
_dataCallback(callback),
|
||||||
@ -276,7 +272,7 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
|
|||||||
|
|
||||||
WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const
|
WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const
|
||||||
{
|
{
|
||||||
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - (_clock->MillisecondTimestamp() - _firstPacketTimeMs);
|
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - (VCMTickTime::MillisecondTimestamp() - _firstPacketTimeMs);
|
||||||
if (timeLeft < 0)
|
if (timeLeft < 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -309,8 +305,7 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
|||||||
_resendPacketCount++;
|
_resendPacketCount++;
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
_lostPackets.ResentPacket(seqNo,
|
_lostPackets.ResentPacket(seqNo);
|
||||||
_clock->MillisecondTimestamp());
|
|
||||||
}
|
}
|
||||||
else if (ret < 0)
|
else if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -332,7 +327,7 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
|||||||
if (_firstPacket)
|
if (_firstPacket)
|
||||||
{
|
{
|
||||||
_firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
|
_firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
|
||||||
_firstPacketTimeMs = _clock->MillisecondTimestamp();
|
_firstPacketTimeMs = VCMTickTime::MillisecondTimestamp();
|
||||||
}
|
}
|
||||||
if (_reordering && _reorderBuffer == NULL)
|
if (_reordering && _reorderBuffer == NULL)
|
||||||
{
|
{
|
||||||
@ -452,9 +447,7 @@ WebRtc_Word32 RTPPlayer::ResendPackets(const WebRtc_UWord16* sequenceNumbers, We
|
|||||||
}
|
}
|
||||||
for (int i=0; i < length; i++)
|
for (int i=0; i < length; i++)
|
||||||
{
|
{
|
||||||
_lostPackets.SetResendTime(sequenceNumbers[i],
|
_lostPackets.SetResendTime(sequenceNumbers[i], VCMTickTime::MillisecondTimestamp() + _rttMs);
|
||||||
_clock->MillisecondTimestamp() + _rttMs,
|
|
||||||
_clock->MillisecondTimestamp());
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "list_wrapper.h"
|
#include "list_wrapper.h"
|
||||||
#include "critical_section_wrapper.h"
|
#include "critical_section_wrapper.h"
|
||||||
#include "video_coding_defines.h"
|
#include "video_coding_defines.h"
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -43,12 +42,10 @@ public:
|
|||||||
~LostPackets();
|
~LostPackets();
|
||||||
|
|
||||||
WebRtc_UWord32 AddPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
WebRtc_UWord32 AddPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
||||||
WebRtc_UWord32 SetResendTime(WebRtc_UWord16 sequenceNumber,
|
WebRtc_UWord32 SetResendTime(WebRtc_UWord16 sequenceNumber, WebRtc_Word64 resendTime);
|
||||||
WebRtc_Word64 resendTime,
|
|
||||||
WebRtc_Word64 nowMs);
|
|
||||||
WebRtc_UWord32 TotalNumberOfLosses() const { return _lossCount; };
|
WebRtc_UWord32 TotalNumberOfLosses() const { return _lossCount; };
|
||||||
WebRtc_UWord32 NumberOfPacketsToResend() const;
|
WebRtc_UWord32 NumberOfPacketsToResend() const;
|
||||||
void ResentPacket(WebRtc_UWord16 seqNo, WebRtc_Word64 nowMs);
|
void ResentPacket(WebRtc_UWord16 seqNo);
|
||||||
void Lock() {_critSect->Enter();};
|
void Lock() {_critSect->Enter();};
|
||||||
void Unlock() {_critSect->Leave();};
|
void Unlock() {_critSect->Leave();};
|
||||||
private:
|
private:
|
||||||
@ -69,9 +66,7 @@ struct PayloadCodecTuple
|
|||||||
class RTPPlayer : public webrtc::VCMPacketRequestCallback
|
class RTPPlayer : public webrtc::VCMPacketRequestCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RTPPlayer(const char* filename,
|
RTPPlayer(const char* filename, webrtc::RtpData* callback);
|
||||||
webrtc::RtpData* callback,
|
|
||||||
webrtc::TickTimeInterface* clock);
|
|
||||||
virtual ~RTPPlayer();
|
virtual ~RTPPlayer();
|
||||||
|
|
||||||
WebRtc_Word32 Initialize(const webrtc::ListWrapper& payloadList);
|
WebRtc_Word32 Initialize(const webrtc::ListWrapper& payloadList);
|
||||||
@ -86,7 +81,6 @@ private:
|
|||||||
WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
||||||
WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset);
|
WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset);
|
||||||
WebRtc_Word32 ReadHeader();
|
WebRtc_Word32 ReadHeader();
|
||||||
webrtc::TickTimeInterface* _clock;
|
|
||||||
FILE* _rtpFile;
|
FILE* _rtpFile;
|
||||||
webrtc::RtpRtcp& _rtpModule;
|
webrtc::RtpRtcp& _rtpModule;
|
||||||
WebRtc_UWord32 _nextRtpTime;
|
WebRtc_UWord32 _nextRtpTime;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "modules/video_coding/main/source/tick_time_interface.h"
|
|
||||||
#include "rtp_dump.h"
|
#include "rtp_dump.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
|
|
||||||
@ -200,9 +199,7 @@ VCMDecodeCompleteCallback::DecodedBytes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
RTPSendCompleteCallback::RTPSendCompleteCallback(RtpRtcp* rtp,
|
RTPSendCompleteCallback::RTPSendCompleteCallback(RtpRtcp* rtp,
|
||||||
TickTimeInterface* clock,
|
|
||||||
const char* filename):
|
const char* filename):
|
||||||
_clock(clock),
|
|
||||||
_sendCount(0),
|
_sendCount(0),
|
||||||
_rtp(rtp),
|
_rtp(rtp),
|
||||||
_lossPct(0),
|
_lossPct(0),
|
||||||
@ -254,7 +251,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
|||||||
bool transmitPacket = true;
|
bool transmitPacket = true;
|
||||||
transmitPacket = PacketLoss();
|
transmitPacket = PacketLoss();
|
||||||
|
|
||||||
WebRtc_UWord64 now = _clock->MillisecondTimestamp();
|
WebRtc_UWord64 now = VCMTickTime::MillisecondTimestamp();
|
||||||
// Insert outgoing packet into list
|
// Insert outgoing packet into list
|
||||||
if (transmitPacket)
|
if (transmitPacket)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "module_common_types.h"
|
#include "module_common_types.h"
|
||||||
#include "rtp_rtcp.h"
|
#include "rtp_rtcp.h"
|
||||||
#include "test_util.h"
|
#include "test_util.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "video_coding.h"
|
#include "video_coding.h"
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ class RTPSendCompleteCallback: public Transport
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constructor input: (receive side) rtp module to send encoded data to
|
// Constructor input: (receive side) rtp module to send encoded data to
|
||||||
RTPSendCompleteCallback(RtpRtcp* rtp, TickTimeInterface* clock,
|
RTPSendCompleteCallback(RtpRtcp* rtp,
|
||||||
const char* filename = NULL);
|
const char* filename = NULL);
|
||||||
virtual ~RTPSendCompleteCallback();
|
virtual ~RTPSendCompleteCallback();
|
||||||
// Send Packet to receive side RTP module
|
// Send Packet to receive side RTP module
|
||||||
@ -183,7 +184,6 @@ protected:
|
|||||||
// Random uniform loss model
|
// Random uniform loss model
|
||||||
bool UnifomLoss(double lossPct);
|
bool UnifomLoss(double lossPct);
|
||||||
|
|
||||||
TickTimeInterface* _clock;
|
|
||||||
WebRtc_UWord32 _sendCount;
|
WebRtc_UWord32 _sendCount;
|
||||||
RtpRtcp* _rtp;
|
RtpRtcp* _rtp;
|
||||||
double _lossPct;
|
double _lossPct;
|
||||||
|
@ -27,10 +27,16 @@
|
|||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build with EVENT_DEBUG defined
|
* Build with TICK_TIME_DEBUG and EVENT_DEBUG defined
|
||||||
* to build the tests with simulated events.
|
* to build the tests with simulated clock.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO(holmer): How do we get debug time into the cmd line interface?
|
||||||
|
/* Debug time */
|
||||||
|
#if defined(TICK_TIME_DEBUG) && defined(EVENT_DEBUG)
|
||||||
|
WebRtc_Word64 VCMTickTime::_timeNowDebug = 0; // current time in ms
|
||||||
|
#endif
|
||||||
|
|
||||||
int vcmMacrosTests = 0;
|
int vcmMacrosTests = 0;
|
||||||
int vcmMacrosErrors = 0;
|
int vcmMacrosErrors = 0;
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
#include "video_coding.h"
|
#include "video_coding.h"
|
||||||
#include "rtp_rtcp.h"
|
#include "rtp_rtcp.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
#include "../source/internal_defines.h"
|
#include "../source/internal_defines.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "rtp_player.h"
|
#include "rtp_player.h"
|
||||||
#include "modules/video_coding/main/source/mock/fake_tick_time_interface.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -72,8 +72,8 @@ FrameReceiveCallback::FrameToRender(VideoFrame& videoFrame)
|
|||||||
|
|
||||||
int RtpPlay(CmdArgs& args)
|
int RtpPlay(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Make sure this test isn't executed without simulated events.
|
// Make sure this test isn't executed without simulated clocks
|
||||||
#if !defined(EVENT_DEBUG)
|
#if !defined(TICK_TIME_DEBUG) || !defined(EVENT_DEBUG)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
// BEGIN Settings
|
// BEGIN Settings
|
||||||
@ -90,10 +90,9 @@ int RtpPlay(CmdArgs& args)
|
|||||||
if (outFile == "")
|
if (outFile == "")
|
||||||
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
||||||
FrameReceiveCallback receiveCallback(outFile);
|
FrameReceiveCallback receiveCallback(outFile);
|
||||||
FakeTickTime clock(0);
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback, &clock);
|
RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback);
|
||||||
|
|
||||||
|
|
||||||
ListWrapper payloadTypes;
|
ListWrapper payloadTypes;
|
||||||
@ -151,9 +150,9 @@ int RtpPlay(CmdArgs& args)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
// RTP stream main loop
|
// RTP stream main loop
|
||||||
while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
|
while ((ret = rtpStream.NextPacket(VCMTickTime::MillisecondTimestamp())) == 0)
|
||||||
{
|
{
|
||||||
if (clock.MillisecondTimestamp() % 5 == 0)
|
if (VCMTickTime::MillisecondTimestamp() % 5 == 0)
|
||||||
{
|
{
|
||||||
ret = vcm->Decode();
|
ret = vcm->Decode();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -166,11 +165,11 @@ int RtpPlay(CmdArgs& args)
|
|||||||
{
|
{
|
||||||
vcm->Process();
|
vcm->Process();
|
||||||
}
|
}
|
||||||
if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >= MAX_RUNTIME_MS)
|
if (MAX_RUNTIME_MS > -1 && VCMTickTime::MillisecondTimestamp() >= MAX_RUNTIME_MS)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
clock.IncrementDebugClock(1);
|
VCMTickTime::IncrementDebugClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "thread_wrapper.h"
|
#include "thread_wrapper.h"
|
||||||
#include "../source/event.h"
|
#include "../source/event.h"
|
||||||
|
#include "tick_time.h"
|
||||||
#include "test_macros.h"
|
#include "test_macros.h"
|
||||||
#include "rtp_player.h"
|
#include "rtp_player.h"
|
||||||
|
|
||||||
@ -39,8 +40,8 @@ bool RtpReaderThread(void* obj)
|
|||||||
SharedState* state = static_cast<SharedState*>(obj);
|
SharedState* state = static_cast<SharedState*>(obj);
|
||||||
EventWrapper& waitEvent = *EventWrapper::Create();
|
EventWrapper& waitEvent = *EventWrapper::Create();
|
||||||
// RTP stream main loop
|
// RTP stream main loop
|
||||||
TickTimeInterface clock;
|
WebRtc_Word64 nowMs = VCMTickTime::MillisecondTimestamp();
|
||||||
if (state->_rtpPlayer.NextPacket(clock.MillisecondTimestamp()) < 0)
|
if (state->_rtpPlayer.NextPacket(nowMs) < 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -59,8 +60,8 @@ bool DecodeThread(void* obj)
|
|||||||
|
|
||||||
int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTestVideoType)
|
int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTestVideoType)
|
||||||
{
|
{
|
||||||
// Don't run these tests with debug events.
|
// Don't run these tests with debug time
|
||||||
#if defined(EVENT_DEBUG)
|
#if defined(TICK_TIME_DEBUG) || defined(EVENT_DEBUG)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -81,9 +82,8 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
|||||||
(protection == kProtectionDualDecoder ||
|
(protection == kProtectionDualDecoder ||
|
||||||
protection == kProtectionNack ||
|
protection == kProtectionNack ||
|
||||||
kProtectionNackFEC));
|
kProtectionNackFEC));
|
||||||
TickTimeInterface clock;
|
|
||||||
VideoCodingModule* vcm =
|
VideoCodingModule* vcm =
|
||||||
VideoCodingModule::Create(1, &clock);
|
VideoCodingModule::Create(1);
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
std::string rtpFilename;
|
std::string rtpFilename;
|
||||||
rtpFilename = args.inputFile;
|
rtpFilename = args.inputFile;
|
||||||
@ -136,7 +136,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
|||||||
}
|
}
|
||||||
printf("Watch %s to verify that the output is reasonable\n", outFilename.c_str());
|
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);
|
||||||
ListWrapper payloadTypes;
|
ListWrapper payloadTypes;
|
||||||
payloadTypes.PushFront(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE,
|
payloadTypes.PushFront(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE,
|
||||||
"VP8", kVideoCodecVP8));
|
"VP8", kVideoCodecVP8));
|
||||||
|
Loading…
Reference in New Issue
Block a user