Move video_coding to new Clock interface and remove fake clock implementations from RTP module tests.
TEST=video_coding_unittests, video_coding_integrationtests, rtp_rtcp_unittests, trybots Review URL: https://webrtc-codereview.appspot.com/1044004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3393 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
namespace webrtc
|
||||
{
|
||||
|
||||
class TickTimeBase;
|
||||
class Clock;
|
||||
class VideoEncoder;
|
||||
class VideoDecoder;
|
||||
struct CodecSpecificInfo;
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
static VideoCodingModule* Create(const WebRtc_Word32 id);
|
||||
|
||||
static VideoCodingModule* Create(const WebRtc_Word32 id,
|
||||
TickTimeBase* clock);
|
||||
Clock* clock);
|
||||
|
||||
static void Destroy(VideoCodingModule* module);
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
#include "trace.h"
|
||||
#include "generic_decoder.h"
|
||||
#include "internal_defines.h"
|
||||
#include "tick_time_base.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing,
|
||||
TickTimeBase* clock)
|
||||
Clock* clock)
|
||||
:
|
||||
_critSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_clock(clock),
|
||||
@@ -56,7 +56,7 @@ WebRtc_Word32 VCMDecodedFrameCallback::Decoded(I420VideoFrame& decodedImage)
|
||||
_timing.StopDecodeTimer(
|
||||
decodedImage.timestamp(),
|
||||
frameInfo->decodeStartTimeMs,
|
||||
_clock->MillisecondTimestamp());
|
||||
_clock->TimeInMilliseconds());
|
||||
|
||||
if (_receiveCallback != NULL)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ struct VCMFrameInformation
|
||||
class VCMDecodedFrameCallback : public DecodedImageCallback
|
||||
{
|
||||
public:
|
||||
VCMDecodedFrameCallback(VCMTiming& timing, TickTimeBase* clock);
|
||||
VCMDecodedFrameCallback(VCMTiming& timing, Clock* clock);
|
||||
virtual ~VCMDecodedFrameCallback();
|
||||
void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper* _critSect;
|
||||
TickTimeBase* _clock;
|
||||
Clock* _clock;
|
||||
I420VideoFrame _frame;
|
||||
VCMReceiveCallback* _receiveCallback;
|
||||
VCMTiming& _timing;
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "modules/video_coding/main/source/event.h"
|
||||
#include "modules/video_coding/main/source/frame_buffer.h"
|
||||
#include "modules/video_coding/main/source/inter_frame_delay.h"
|
||||
#include "modules/video_coding/main/source/internal_defines.h"
|
||||
#include "modules/video_coding/main/source/jitter_buffer_common.h"
|
||||
#include "modules/video_coding/main/source/jitter_estimator.h"
|
||||
#include "modules/video_coding/main/source/packet.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "system_wrappers/interface/trace.h"
|
||||
#include "webrtc/modules/video_coding/main/source/event.h"
|
||||
#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
|
||||
#include "webrtc/modules/video_coding/main/source/inter_frame_delay.h"
|
||||
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||
#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.h"
|
||||
#include "webrtc/modules/video_coding/main/source/jitter_estimator.h"
|
||||
#include "webrtc/modules/video_coding/main/source/packet.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -61,7 +61,7 @@ class CompleteDecodableKeyFrameCriteria {
|
||||
}
|
||||
};
|
||||
|
||||
VCMJitterBuffer::VCMJitterBuffer(TickTimeBase* clock,
|
||||
VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
|
||||
int vcm_id,
|
||||
int receiver_id,
|
||||
bool master)
|
||||
@@ -90,7 +90,7 @@ VCMJitterBuffer::VCMJitterBuffer(TickTimeBase* clock,
|
||||
num_consecutive_old_packets_(0),
|
||||
num_discarded_packets_(0),
|
||||
jitter_estimate_(vcm_id, receiver_id),
|
||||
inter_frame_delay_(clock_->MillisecondTimestamp()),
|
||||
inter_frame_delay_(clock_->TimeInMilliseconds()),
|
||||
rtt_ms_(kDefaultRtt),
|
||||
nack_mode_(kNoNack),
|
||||
low_rtt_nack_threshold_ms_(-1),
|
||||
@@ -177,7 +177,7 @@ void VCMJitterBuffer::Start() {
|
||||
incoming_frame_rate_ = 0;
|
||||
incoming_bit_count_ = 0;
|
||||
incoming_bit_rate_ = 0;
|
||||
time_last_incoming_frame_count_ = clock_->MillisecondTimestamp();
|
||||
time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
|
||||
memset(receive_statistics_, 0, sizeof(receive_statistics_));
|
||||
|
||||
num_consecutive_old_frames_ = 0;
|
||||
@@ -241,7 +241,7 @@ void VCMJitterBuffer::Flush() {
|
||||
num_consecutive_old_packets_ = 0;
|
||||
// Also reset the jitter and delay estimates
|
||||
jitter_estimate_.Reset();
|
||||
inter_frame_delay_.Reset(clock_->MillisecondTimestamp());
|
||||
inter_frame_delay_.Reset(clock_->TimeInMilliseconds());
|
||||
waiting_for_completion_.frame_size = 0;
|
||||
waiting_for_completion_.timestamp = 0;
|
||||
waiting_for_completion_.latest_packet_time = -1;
|
||||
@@ -278,7 +278,7 @@ void VCMJitterBuffer::IncomingRateStatistics(unsigned int* framerate,
|
||||
assert(framerate);
|
||||
assert(bitrate);
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
const int64_t now = clock_->MillisecondTimestamp();
|
||||
const int64_t now = clock_->TimeInMilliseconds();
|
||||
int64_t diff = now - time_last_incoming_frame_count_;
|
||||
if (diff < 1000 && incoming_frame_rate_ > 0 && incoming_bit_rate_ > 0) {
|
||||
// Make sure we report something even though less than
|
||||
@@ -323,7 +323,7 @@ void VCMJitterBuffer::IncomingRateStatistics(unsigned int* framerate,
|
||||
|
||||
} else {
|
||||
// No frames since last call
|
||||
time_last_incoming_frame_count_ = clock_->MillisecondTimestamp();
|
||||
time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
|
||||
*framerate = 0;
|
||||
bitrate = 0;
|
||||
incoming_bit_rate_ = 0;
|
||||
@@ -437,8 +437,8 @@ VCMEncodedFrame* VCMJitterBuffer::GetCompleteFrameForDecoding(
|
||||
crit_sect_->Leave();
|
||||
return NULL;
|
||||
}
|
||||
const int64_t end_wait_time_ms = clock_->MillisecondTimestamp()
|
||||
+ max_wait_time_ms;
|
||||
const int64_t end_wait_time_ms = clock_->TimeInMilliseconds() +
|
||||
max_wait_time_ms;
|
||||
int64_t wait_time_ms = max_wait_time_ms;
|
||||
while (wait_time_ms > 0) {
|
||||
crit_sect_->Leave();
|
||||
@@ -457,8 +457,7 @@ VCMEncodedFrame* VCMJitterBuffer::GetCompleteFrameForDecoding(
|
||||
CleanUpOldFrames();
|
||||
it = FindOldestCompleteContinuousFrame(false);
|
||||
if (it == frame_list_.end()) {
|
||||
wait_time_ms = end_wait_time_ms -
|
||||
clock_->MillisecondTimestamp();
|
||||
wait_time_ms = end_wait_time_ms - clock_->TimeInMilliseconds();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -663,7 +662,7 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(VCMEncodedFrame* encoded_frame,
|
||||
const VCMPacket& packet) {
|
||||
assert(encoded_frame);
|
||||
CriticalSectionScoped cs(crit_sect_);
|
||||
int64_t now_ms = clock_->MillisecondTimestamp();
|
||||
int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
VCMFrameBufferEnum buffer_return = kSizeError;
|
||||
VCMFrameBufferEnum ret = kSizeError;
|
||||
VCMFrameBuffer* frame = static_cast<VCMFrameBuffer*>(encoded_frame);
|
||||
@@ -673,7 +672,7 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(VCMEncodedFrame* encoded_frame,
|
||||
if (first_packet_) {
|
||||
// Now it's time to start estimating jitter
|
||||
// reset the delay estimate.
|
||||
inter_frame_delay_.Reset(clock_->MillisecondTimestamp());
|
||||
inter_frame_delay_.Reset(clock_->TimeInMilliseconds());
|
||||
first_packet_ = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ enum VCMNackMode {
|
||||
typedef std::list<VCMFrameBuffer*> FrameList;
|
||||
|
||||
// forward declarations
|
||||
class TickTimeBase;
|
||||
class Clock;
|
||||
class VCMFrameBuffer;
|
||||
class VCMPacket;
|
||||
class VCMEncodedFrame;
|
||||
@@ -49,7 +49,7 @@ struct VCMJitterSample {
|
||||
|
||||
class VCMJitterBuffer {
|
||||
public:
|
||||
VCMJitterBuffer(TickTimeBase* clock, int vcm_id = -1, int receiver_id = -1,
|
||||
VCMJitterBuffer(Clock* clock, int vcm_id = -1, int receiver_id = -1,
|
||||
bool master = true);
|
||||
virtual ~VCMJitterBuffer();
|
||||
|
||||
@@ -206,7 +206,7 @@ class VCMJitterBuffer {
|
||||
|
||||
int vcm_id_;
|
||||
int receiver_id_;
|
||||
TickTimeBase* clock_;
|
||||
Clock* clock_;
|
||||
// If we are running (have started) or not.
|
||||
bool running_;
|
||||
CriticalSectionWrapper* crit_sect_;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "modules/video_coding/main/source/jitter_buffer.h"
|
||||
#include "modules/video_coding/main/source/media_opt_util.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "modules/video_coding/main/source/packet.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -145,10 +145,10 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
||||
enum { kDefaultFramePeriodMs = 1000 / kDefaultFrameRate };
|
||||
|
||||
virtual void SetUp() {
|
||||
clock_ = new FakeTickTime(0);
|
||||
jitter_buffer_ = new VCMJitterBuffer(clock_);
|
||||
clock_.reset(new SimulatedClock(0));
|
||||
jitter_buffer_ = new VCMJitterBuffer(clock_.get());
|
||||
stream_generator = new StreamGenerator(0, 0,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->TimeInMilliseconds());
|
||||
jitter_buffer_->Start();
|
||||
memset(data_buffer_, 0, kDataBufferSize);
|
||||
}
|
||||
@@ -157,7 +157,6 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
||||
jitter_buffer_->Stop();
|
||||
delete stream_generator;
|
||||
delete jitter_buffer_;
|
||||
delete clock_;
|
||||
}
|
||||
|
||||
VCMFrameBufferEnum InsertPacketAndPop(int index) {
|
||||
@@ -190,9 +189,9 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
||||
stream_generator->GenerateFrame(frame_type,
|
||||
(frame_type != kFrameEmpty) ? 1 : 0,
|
||||
(frame_type == kFrameEmpty) ? 1 : 0,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->TimeInMilliseconds());
|
||||
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
|
||||
clock_->IncrementDebugClock(kDefaultFramePeriodMs);
|
||||
clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
|
||||
}
|
||||
|
||||
void InsertFrames(int num_frames, FrameType frame_type) {
|
||||
@@ -203,8 +202,8 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
||||
|
||||
void DropFrame(int num_packets) {
|
||||
stream_generator->GenerateFrame(kVideoFrameDelta, num_packets, 0,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->IncrementDebugClock(kDefaultFramePeriodMs);
|
||||
clock_->TimeInMilliseconds());
|
||||
clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
|
||||
}
|
||||
|
||||
bool DecodeCompleteFrame() {
|
||||
@@ -223,7 +222,7 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
||||
|
||||
VCMJitterBuffer* jitter_buffer_;
|
||||
StreamGenerator* stream_generator;
|
||||
FakeTickTime* clock_;
|
||||
scoped_ptr<SimulatedClock> clock_;
|
||||
uint8_t data_buffer_[kDataBufferSize];
|
||||
};
|
||||
|
||||
@@ -258,7 +257,7 @@ TEST_F(TestRunningJitterBuffer, TestFull) {
|
||||
TEST_F(TestRunningJitterBuffer, TestEmptyPackets) {
|
||||
// Make sure a frame can get complete even though empty packets are missing.
|
||||
stream_generator->GenerateFrame(kVideoFrameKey, 3, 3,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->TimeInMilliseconds());
|
||||
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(4));
|
||||
EXPECT_EQ(kIncomplete, InsertPacketAndPop(4));
|
||||
EXPECT_EQ(kIncomplete, InsertPacketAndPop(0));
|
||||
@@ -319,8 +318,8 @@ TEST_F(TestJitterBufferNack, TestNormalOperation) {
|
||||
// | 1 | 2 | .. | 8 | 9 | x | 11 | 12 | .. | 19 | x | 21 | .. | 100 |
|
||||
// ----------------------------------------------------------------
|
||||
stream_generator->GenerateFrame(kVideoFrameKey, 100, 0,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->IncrementDebugClock(kDefaultFramePeriodMs);
|
||||
clock_->TimeInMilliseconds());
|
||||
clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
|
||||
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
|
||||
// Verify that the frame is incomplete.
|
||||
EXPECT_FALSE(DecodeCompleteFrame());
|
||||
@@ -348,11 +347,11 @@ TEST_F(TestJitterBufferNack, TestNormalOperationWrap) {
|
||||
// ------- ------------------------------------------------------------
|
||||
// | 65532 | | 65533 | 65534 | 65535 | x | 1 | .. | 9 | x | 11 |.....| 96 |
|
||||
// ------- ------------------------------------------------------------
|
||||
stream_generator->Init(65532, 0, clock_->MillisecondTimestamp());
|
||||
stream_generator->Init(65532, 0, clock_->TimeInMilliseconds());
|
||||
InsertFrame(kVideoFrameKey);
|
||||
EXPECT_TRUE(DecodeCompleteFrame());
|
||||
stream_generator->GenerateFrame(kVideoFrameDelta, 100, 0,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->TimeInMilliseconds());
|
||||
EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
|
||||
while (stream_generator->PacketsRemaining() > 1) {
|
||||
if (stream_generator->NextSequenceNumber() % 10 != 0)
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
#include "content_metrics_processing.h"
|
||||
#include "frame_dropper.h"
|
||||
#include "qm_select.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id,
|
||||
TickTimeBase* clock):
|
||||
Clock* clock):
|
||||
_id(id),
|
||||
_clock(clock),
|
||||
_maxBitRate(0),
|
||||
@@ -46,7 +46,7 @@ _numLayers(0)
|
||||
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
|
||||
|
||||
_frameDropper = new VCMFrameDropper(_id);
|
||||
_lossProtLogic = new VCMLossProtectionLogic(_clock->MillisecondTimestamp());
|
||||
_lossProtLogic = new VCMLossProtectionLogic(_clock->TimeInMilliseconds());
|
||||
_content = new VCMContentMetricsProcessing();
|
||||
_qmResolution = new VCMQmResolution();
|
||||
}
|
||||
@@ -66,12 +66,12 @@ VCMMediaOptimization::Reset()
|
||||
memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
|
||||
_incomingFrameRate = 0.0;
|
||||
_frameDropper->Reset();
|
||||
_lossProtLogic->Reset(_clock->MillisecondTimestamp());
|
||||
_lossProtLogic->Reset(_clock->TimeInMilliseconds());
|
||||
_frameDropper->SetRates(0, 0);
|
||||
_content->Reset();
|
||||
_qmResolution->Reset();
|
||||
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
|
||||
_lossProtLogic->Reset(_clock->MillisecondTimestamp());
|
||||
_lossProtLogic->Reset(_clock->TimeInMilliseconds());
|
||||
_sendStatisticsZeroEncode = 0;
|
||||
_targetBitRate = 0;
|
||||
_codecWidth = 0;
|
||||
@@ -122,7 +122,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
|
||||
// Use max window filter for now.
|
||||
FilterPacketLossMode filter_mode = kMaxFilter;
|
||||
WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss(
|
||||
_clock->MillisecondTimestamp(), filter_mode, fractionLost);
|
||||
_clock->TimeInMilliseconds(), filter_mode, fractionLost);
|
||||
|
||||
// For now use the filtered loss for computing the robustness settings
|
||||
_lossProtLogic->UpdateFilteredLossPr(packetLossEnc);
|
||||
@@ -274,7 +274,7 @@ VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType,
|
||||
// has changed. If native dimension values have changed, then either user
|
||||
// initiated change, or QM initiated change. Will be able to determine only
|
||||
// after the processing of the first frame.
|
||||
_lastChangeTime = _clock->MillisecondTimestamp();
|
||||
_lastChangeTime = _clock->TimeInMilliseconds();
|
||||
_content->Reset();
|
||||
_content->UpdateFrameRate(frameRate);
|
||||
|
||||
@@ -359,7 +359,7 @@ VCMMediaOptimization::SentFrameRate()
|
||||
float
|
||||
VCMMediaOptimization::SentBitRate()
|
||||
{
|
||||
UpdateBitRateEstimate(-1, _clock->MillisecondTimestamp());
|
||||
UpdateBitRateEstimate(-1, _clock->TimeInMilliseconds());
|
||||
return _avgSentBitRateBps / 1000.0f;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ VCMMediaOptimization::UpdateWithEncodedData(WebRtc_Word32 encodedLength,
|
||||
FrameType encodedFrameType)
|
||||
{
|
||||
// look into the ViE version - debug mode - needs also number of layers.
|
||||
UpdateBitRateEstimate(encodedLength, _clock->MillisecondTimestamp());
|
||||
UpdateBitRateEstimate(encodedLength, _clock->TimeInMilliseconds());
|
||||
if(encodedLength > 0)
|
||||
{
|
||||
const bool deltaFrame = (encodedFrameType != kVideoFrameKey &&
|
||||
@@ -388,12 +388,12 @@ VCMMediaOptimization::UpdateWithEncodedData(WebRtc_Word32 encodedLength,
|
||||
if (deltaFrame)
|
||||
{
|
||||
_lossProtLogic->UpdatePacketsPerFrame(
|
||||
minPacketsPerFrame, _clock->MillisecondTimestamp());
|
||||
minPacketsPerFrame, _clock->TimeInMilliseconds());
|
||||
}
|
||||
else
|
||||
{
|
||||
_lossProtLogic->UpdatePacketsPerFrameKey(
|
||||
minPacketsPerFrame, _clock->MillisecondTimestamp());
|
||||
minPacketsPerFrame, _clock->TimeInMilliseconds());
|
||||
}
|
||||
|
||||
if (_enableQm)
|
||||
@@ -544,7 +544,7 @@ VCMMediaOptimization::SelectQuality()
|
||||
_qmResolution->ResetRates();
|
||||
|
||||
// Reset counters
|
||||
_lastQMUpdateTime = _clock->MillisecondTimestamp();
|
||||
_lastQMUpdateTime = _clock->TimeInMilliseconds();
|
||||
|
||||
// Reset content metrics
|
||||
_content->Reset();
|
||||
@@ -567,7 +567,7 @@ VCMMediaOptimization::checkStatusForQMchange()
|
||||
// (to sample the metrics) from the event lastChangeTime
|
||||
// lastChangeTime is the time where user changed the size/rate/frame rate
|
||||
// (via SetEncodingData)
|
||||
WebRtc_Word64 now = _clock->MillisecondTimestamp();
|
||||
WebRtc_Word64 now = _clock->TimeInMilliseconds();
|
||||
if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
|
||||
(now - _lastChangeTime) < kQmMinIntervalMs)
|
||||
{
|
||||
@@ -619,7 +619,7 @@ bool VCMMediaOptimization::QMUpdate(VCMResolutionScale* qm) {
|
||||
void
|
||||
VCMMediaOptimization::UpdateIncomingFrameRate()
|
||||
{
|
||||
WebRtc_Word64 now = _clock->MillisecondTimestamp();
|
||||
WebRtc_Word64 now = _clock->TimeInMilliseconds();
|
||||
if (_incomingFrameTimes[0] == 0)
|
||||
{
|
||||
// first no shift
|
||||
@@ -667,7 +667,7 @@ VCMMediaOptimization::ProcessIncomingFrameRate(WebRtc_Word64 now)
|
||||
WebRtc_UWord32
|
||||
VCMMediaOptimization::InputFrameRate()
|
||||
{
|
||||
ProcessIncomingFrameRate(_clock->MillisecondTimestamp());
|
||||
ProcessIncomingFrameRate(_clock->TimeInMilliseconds());
|
||||
return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace webrtc
|
||||
enum { kBitrateMaxFrameSamples = 60 };
|
||||
enum { kBitrateAverageWinMs = 1000 };
|
||||
|
||||
class TickTimeBase;
|
||||
class Clock;
|
||||
class VCMContentMetricsProcessing;
|
||||
class VCMFrameDropper;
|
||||
|
||||
@@ -38,7 +38,7 @@ struct VCMEncodedFrameSample
|
||||
class VCMMediaOptimization
|
||||
{
|
||||
public:
|
||||
VCMMediaOptimization(WebRtc_Word32 id, TickTimeBase* clock);
|
||||
VCMMediaOptimization(WebRtc_Word32 id, Clock* clock);
|
||||
~VCMMediaOptimization(void);
|
||||
/*
|
||||
* Reset the Media Optimization module
|
||||
@@ -163,7 +163,7 @@ private:
|
||||
enum { kFrameHistoryWinMs = 2000};
|
||||
|
||||
WebRtc_Word32 _id;
|
||||
TickTimeBase* _clock;
|
||||
Clock* _clock;
|
||||
WebRtc_Word32 _maxBitRate;
|
||||
VideoCodecType _sendCodecType;
|
||||
WebRtc_UWord16 _codecWidth;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// Provides a fake implementation of TickTimeBase, intended for offline
|
||||
// testing. This implementation does not query the system clock, but returns a
|
||||
// time value set by the user when creating the object, and incremented with
|
||||
// the method IncrementDebugClock.
|
||||
class FakeTickTime : public TickTimeBase {
|
||||
public:
|
||||
explicit FakeTickTime(int64_t start_time_ms) : fake_now_ms_(start_time_ms) {}
|
||||
virtual ~FakeTickTime() {}
|
||||
virtual int64_t MillisecondTimestamp() const {
|
||||
return fake_now_ms_;
|
||||
}
|
||||
virtual int64_t MicrosecondTimestamp() const {
|
||||
return 1000 * fake_now_ms_;
|
||||
}
|
||||
virtual void IncrementDebugClock(int64_t increase_ms) {
|
||||
assert(increase_ms <= std::numeric_limits<int64_t>::max() - fake_now_ms_);
|
||||
fake_now_ms_ += increase_ms;
|
||||
}
|
||||
|
||||
private:
|
||||
int64_t fake_now_ms_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
|
||||
@@ -16,13 +16,13 @@
|
||||
#include "webrtc/modules/video_coding/main/source/encoded_frame.h"
|
||||
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
|
||||
#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VCMReceiver::VCMReceiver(VCMTiming* timing,
|
||||
TickTimeBase* clock,
|
||||
Clock* clock,
|
||||
int32_t vcm_id,
|
||||
int32_t receiver_id,
|
||||
bool master)
|
||||
@@ -95,10 +95,10 @@ int32_t VCMReceiver::InsertPacket(const VCMPacket& packet, uint16_t frame_width,
|
||||
VCMId(vcm_id_, receiver_id_),
|
||||
"Packet seq_no %u of frame %u at %u",
|
||||
packet.seqNum, packet.timestamp,
|
||||
MaskWord64ToUWord32(clock_->MillisecondTimestamp()));
|
||||
MaskWord64ToUWord32(clock_->TimeInMilliseconds()));
|
||||
}
|
||||
|
||||
const int64_t now_ms = clock_->MillisecondTimestamp();
|
||||
const int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
|
||||
int64_t render_time_ms = timing_->RenderTimeMs(packet.timestamp, now_ms);
|
||||
|
||||
@@ -106,7 +106,7 @@ int32_t VCMReceiver::InsertPacket(const VCMPacket& packet, uint16_t frame_width,
|
||||
// Render time error. Assume that this is due to some change in the
|
||||
// incoming video stream and reset the JB and the timing.
|
||||
jitter_buffer_.Flush();
|
||||
timing_->Reset(clock_->MillisecondTimestamp());
|
||||
timing_->Reset(clock_->TimeInMilliseconds());
|
||||
return VCM_FLUSH_INDICATOR;
|
||||
} else if (render_time_ms < now_ms - kMaxVideoDelayMs) {
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
|
||||
@@ -115,7 +115,7 @@ int32_t VCMReceiver::InsertPacket(const VCMPacket& packet, uint16_t frame_width,
|
||||
"Flushing jitter buffer and resetting timing.",
|
||||
kMaxVideoDelayMs);
|
||||
jitter_buffer_.Flush();
|
||||
timing_->Reset(clock_->MillisecondTimestamp());
|
||||
timing_->Reset(clock_->TimeInMilliseconds());
|
||||
return VCM_FLUSH_INDICATOR;
|
||||
} else if (timing_->TargetVideoDelay() > kMaxVideoDelayMs) {
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
|
||||
@@ -123,13 +123,13 @@ int32_t VCMReceiver::InsertPacket(const VCMPacket& packet, uint16_t frame_width,
|
||||
"More than %u ms target delay. Flushing jitter buffer and"
|
||||
"resetting timing.", kMaxVideoDelayMs);
|
||||
jitter_buffer_.Flush();
|
||||
timing_->Reset(clock_->MillisecondTimestamp());
|
||||
timing_->Reset(clock_->TimeInMilliseconds());
|
||||
return VCM_FLUSH_INDICATOR;
|
||||
}
|
||||
|
||||
// First packet received belonging to this frame.
|
||||
if (buffer->Length() == 0) {
|
||||
const int64_t now_ms = clock_->MillisecondTimestamp();
|
||||
const int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
if (master_) {
|
||||
// Only trace the primary receiver to make it possible to parse and plot
|
||||
// the trace file.
|
||||
@@ -171,7 +171,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(
|
||||
// is thread-safe.
|
||||
FrameType incoming_frame_type = kVideoFrameDelta;
|
||||
next_render_time_ms = -1;
|
||||
const int64_t start_time_ms = clock_->MillisecondTimestamp();
|
||||
const int64_t start_time_ms = clock_->TimeInMilliseconds();
|
||||
int64_t ret = jitter_buffer_.NextTimestamp(max_wait_time_ms,
|
||||
&incoming_frame_type,
|
||||
&next_render_time_ms);
|
||||
@@ -186,7 +186,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(
|
||||
timing_->UpdateCurrentDelay(time_stamp);
|
||||
|
||||
const int32_t temp_wait_time = max_wait_time_ms -
|
||||
static_cast<int32_t>(clock_->MillisecondTimestamp() - start_time_ms);
|
||||
static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms);
|
||||
uint16_t new_max_wait_time = static_cast<uint16_t>(VCM_MAX(temp_wait_time,
|
||||
0));
|
||||
|
||||
@@ -223,7 +223,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(
|
||||
VCMReceiver* dual_receiver) {
|
||||
// How long can we wait until we must decode the next frame.
|
||||
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
||||
next_render_time_ms, clock_->MillisecondTimestamp());
|
||||
next_render_time_ms, clock_->TimeInMilliseconds());
|
||||
|
||||
// Try to get a complete frame from the jitter buffer.
|
||||
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
|
||||
@@ -257,7 +257,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(
|
||||
if (frame == NULL) {
|
||||
// Get an incomplete frame.
|
||||
if (timing_->MaxWaitingTime(next_render_time_ms,
|
||||
clock_->MillisecondTimestamp()) > 0) {
|
||||
clock_->TimeInMilliseconds()) > 0) {
|
||||
// Still time to wait for a complete frame.
|
||||
return NULL;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ VCMEncodedFrame* VCMReceiver::FrameForRendering(uint16_t max_wait_time_ms,
|
||||
// frame to the decoder, which will render the frame as soon as it has been
|
||||
// decoded.
|
||||
uint32_t wait_time_ms = timing_->MaxWaitingTime(
|
||||
next_render_time_ms, clock_->MillisecondTimestamp());
|
||||
next_render_time_ms, clock_->TimeInMilliseconds());
|
||||
if (max_wait_time_ms < wait_time_ms) {
|
||||
// If we're not allowed to wait until the frame is supposed to be rendered
|
||||
// we will have to return NULL for now.
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
|
||||
#include "webrtc/modules/video_coding/main/source/packet.h"
|
||||
#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "webrtc/modules/video_coding/main/source/timing.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class Clock;
|
||||
class VCMEncodedFrame;
|
||||
|
||||
enum VCMNackStatus {
|
||||
@@ -36,7 +36,7 @@ enum VCMReceiverState {
|
||||
class VCMReceiver {
|
||||
public:
|
||||
VCMReceiver(VCMTiming* timing,
|
||||
TickTimeBase* clock,
|
||||
Clock* clock,
|
||||
int32_t vcm_id = -1,
|
||||
int32_t receiver_id = -1,
|
||||
bool master = true);
|
||||
@@ -81,7 +81,7 @@ class VCMReceiver {
|
||||
|
||||
CriticalSectionWrapper* crit_sect_;
|
||||
int32_t vcm_id_;
|
||||
TickTimeBase* clock_;
|
||||
Clock* clock_;
|
||||
int32_t receiver_id_;
|
||||
bool master_;
|
||||
VCMJitterBuffer jitter_buffer_;
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
|
||||
|
||||
#include "system_wrappers/interface/tick_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// This class provides a mockable wrapper to TickTime.
|
||||
class TickTimeBase {
|
||||
public:
|
||||
virtual ~TickTimeBase() {}
|
||||
|
||||
// "Now" in milliseconds.
|
||||
virtual int64_t MillisecondTimestamp() const {
|
||||
return TickTime::MillisecondTimestamp();
|
||||
}
|
||||
|
||||
// "Now" in microseconds.
|
||||
virtual int64_t MicrosecondTimestamp() const {
|
||||
return TickTime::MicrosecondTimestamp();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
|
||||
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
|
||||
#include "internal_defines.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "timestamp_extrapolator.h"
|
||||
#include "trace.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VCMTimestampExtrapolator::VCMTimestampExtrapolator(TickTimeBase* clock,
|
||||
VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock,
|
||||
WebRtc_Word32 vcmId,
|
||||
WebRtc_Word32 id)
|
||||
:
|
||||
@@ -38,7 +38,7 @@ _accDrift(6600), // in timestamp ticks, i.e. 15 ms
|
||||
_accMaxError(7000),
|
||||
_P11(1e10)
|
||||
{
|
||||
Reset(_clock->MillisecondTimestamp());
|
||||
Reset(_clock->TimeInMilliseconds());
|
||||
}
|
||||
|
||||
VCMTimestampExtrapolator::~VCMTimestampExtrapolator()
|
||||
@@ -56,7 +56,7 @@ VCMTimestampExtrapolator::Reset(const WebRtc_Word64 nowMs /* = -1 */)
|
||||
}
|
||||
else
|
||||
{
|
||||
_startMs = _clock->MillisecondTimestamp();
|
||||
_startMs = _clock->TimeInMilliseconds();
|
||||
}
|
||||
_prevMs = _startMs;
|
||||
_firstTimestamp = 0;
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
namespace webrtc
|
||||
{
|
||||
|
||||
class TickTimeBase;
|
||||
class Clock;
|
||||
|
||||
class VCMTimestampExtrapolator
|
||||
{
|
||||
public:
|
||||
VCMTimestampExtrapolator(TickTimeBase* clock,
|
||||
VCMTimestampExtrapolator(Clock* clock,
|
||||
WebRtc_Word32 vcmId = 0,
|
||||
WebRtc_Word32 receiverId = 0);
|
||||
~VCMTimestampExtrapolator();
|
||||
@@ -37,16 +37,16 @@ private:
|
||||
RWLockWrapper* _rwLock;
|
||||
WebRtc_Word32 _vcmId;
|
||||
WebRtc_Word32 _id;
|
||||
TickTimeBase* _clock;
|
||||
double _w[2];
|
||||
double _P[2][2];
|
||||
Clock* _clock;
|
||||
double _w[2];
|
||||
double _P[2][2];
|
||||
WebRtc_Word64 _startMs;
|
||||
WebRtc_Word64 _prevMs;
|
||||
WebRtc_UWord32 _firstTimestamp;
|
||||
WebRtc_Word32 _wrapArounds;
|
||||
WebRtc_UWord32 _prevTs90khz;
|
||||
const double _lambda;
|
||||
bool _firstAfterReset;
|
||||
const double _lambda;
|
||||
bool _firstAfterReset;
|
||||
WebRtc_UWord32 _packetCount;
|
||||
const WebRtc_UWord32 _startUpFilterDelayInPackets;
|
||||
|
||||
|
||||
@@ -8,15 +8,17 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "trace.h"
|
||||
#include "internal_defines.h"
|
||||
#include "jitter_buffer_common.h"
|
||||
#include "timing.h"
|
||||
#include "timestamp_extrapolator.h"
|
||||
#include "webrtc/modules/video_coding/main/source/timing.h"
|
||||
|
||||
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||
#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.h"
|
||||
#include "webrtc/modules/video_coding/main/source/timestamp_extrapolator.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VCMTiming::VCMTiming(TickTimeBase* clock,
|
||||
VCMTiming::VCMTiming(Clock* clock,
|
||||
WebRtc_Word32 vcmId,
|
||||
WebRtc_Word32 timingId,
|
||||
VCMTiming* masterTiming)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace webrtc
|
||||
{
|
||||
|
||||
class TickTimeBase;
|
||||
class Clock;
|
||||
class VCMTimestampExtrapolator;
|
||||
|
||||
class VCMTiming
|
||||
@@ -26,7 +26,7 @@ class VCMTiming
|
||||
public:
|
||||
// The primary timing component should be passed
|
||||
// if this is the dual timing component.
|
||||
VCMTiming(TickTimeBase* clock,
|
||||
VCMTiming(Clock* clock,
|
||||
WebRtc_Word32 vcmId = 0,
|
||||
WebRtc_Word32 timingId = 0,
|
||||
VCMTiming* masterTiming = NULL);
|
||||
@@ -94,7 +94,7 @@ protected:
|
||||
private:
|
||||
CriticalSectionWrapper* _critSect;
|
||||
WebRtc_Word32 _vcmId;
|
||||
TickTimeBase* _clock;
|
||||
Clock* _clock;
|
||||
WebRtc_Word32 _timingId;
|
||||
bool _master;
|
||||
VCMTimestampExtrapolator* _tsExtrapolator;
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
'receiver.h',
|
||||
'rtt_filter.h',
|
||||
'session_info.h',
|
||||
'tick_time_base.h',
|
||||
'timestamp_extrapolator.h',
|
||||
'timestamp_map.h',
|
||||
'timing.h',
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "packet.h"
|
||||
#include "trace.h"
|
||||
#include "video_codec_interface.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
@@ -34,22 +34,20 @@ VCMProcessTimer::TimeUntilProcess() const
|
||||
{
|
||||
return static_cast<WebRtc_UWord32>(
|
||||
VCM_MAX(static_cast<WebRtc_Word64>(_periodMs) -
|
||||
(_clock->MillisecondTimestamp() - _latestMs), 0));
|
||||
(_clock->TimeInMilliseconds() - _latestMs), 0));
|
||||
}
|
||||
|
||||
void
|
||||
VCMProcessTimer::Processed()
|
||||
{
|
||||
_latestMs = _clock->MillisecondTimestamp();
|
||||
_latestMs = _clock->TimeInMilliseconds();
|
||||
}
|
||||
|
||||
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
|
||||
TickTimeBase* clock,
|
||||
bool delete_clock_on_destroy)
|
||||
Clock* clock)
|
||||
:
|
||||
_id(id),
|
||||
clock_(clock),
|
||||
delete_clock_on_destroy_(delete_clock_on_destroy),
|
||||
_receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_receiverInited(false),
|
||||
_timing(clock_, id, 1),
|
||||
@@ -99,7 +97,6 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl()
|
||||
}
|
||||
delete _receiveCritSect;
|
||||
delete _sendCritSect;
|
||||
if (delete_clock_on_destroy_) delete clock_;
|
||||
#ifdef DEBUG_DECODER_BIT_STREAM
|
||||
fclose(_bitStreamBeforeDecoder);
|
||||
#endif
|
||||
@@ -112,14 +109,14 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl()
|
||||
VideoCodingModule*
|
||||
VideoCodingModule::Create(const WebRtc_Word32 id)
|
||||
{
|
||||
return new VideoCodingModuleImpl(id, new TickTimeBase(), true);
|
||||
return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock());
|
||||
}
|
||||
|
||||
VideoCodingModule*
|
||||
VideoCodingModule::Create(const WebRtc_Word32 id, TickTimeBase* clock)
|
||||
VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock)
|
||||
{
|
||||
assert(clock);
|
||||
return new VideoCodingModuleImpl(id, clock, false);
|
||||
return new VideoCodingModuleImpl(id, clock);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -890,7 +887,7 @@ VideoCodingModuleImpl::Decode(WebRtc_UWord16 maxWaitTimeMs)
|
||||
|
||||
// If this frame was too late, we should adjust the delay accordingly
|
||||
_timing.UpdateCurrentDelay(frame->RenderTimeMs(),
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->TimeInMilliseconds());
|
||||
|
||||
#ifdef DEBUG_DECODER_BIT_STREAM
|
||||
if (_bitStreamBeforeDecoder != NULL)
|
||||
@@ -1001,7 +998,7 @@ VideoCodingModuleImpl::DecodeDualFrame(WebRtc_UWord16 maxWaitTimeMs)
|
||||
dualFrame->TimeStamp());
|
||||
// Decode dualFrame and try to catch up
|
||||
WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame,
|
||||
clock_->MillisecondTimestamp());
|
||||
clock_->TimeInMilliseconds());
|
||||
if (ret != WEBRTC_VIDEO_CODEC_OK)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning,
|
||||
@@ -1049,7 +1046,7 @@ VideoCodingModuleImpl::Decode(const VCMEncodedFrame& frame)
|
||||
return VCM_NO_CODEC_REGISTERED;
|
||||
}
|
||||
// Decode a frame
|
||||
WebRtc_Word32 ret = _decoder->Decode(frame, clock_->MillisecondTimestamp());
|
||||
WebRtc_Word32 ret = _decoder->Decode(frame, clock_->TimeInMilliseconds());
|
||||
|
||||
// Check for failed decoding, run frame type request callback if needed.
|
||||
if (ret < 0)
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "modules/video_coding/main/source/codec_database.h"
|
||||
#include "modules/video_coding/main/source/frame_buffer.h"
|
||||
#include "modules/video_coding/main/source/generic_decoder.h"
|
||||
#include "modules/video_coding/main/source/generic_encoder.h"
|
||||
#include "modules/video_coding/main/source/jitter_buffer.h"
|
||||
#include "modules/video_coding/main/source/media_optimization.h"
|
||||
#include "modules/video_coding/main/source/receiver.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "modules/video_coding/main/source/timing.h"
|
||||
#include "system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/modules/video_coding/main/source/codec_database.h"
|
||||
#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
|
||||
#include "webrtc/modules/video_coding/main/source/generic_decoder.h"
|
||||
#include "webrtc/modules/video_coding/main/source/generic_encoder.h"
|
||||
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
|
||||
#include "webrtc/modules/video_coding/main/source/media_optimization.h"
|
||||
#include "webrtc/modules/video_coding/main/source/receiver.h"
|
||||
#include "webrtc/modules/video_coding/main/source/timing.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
@@ -32,16 +32,16 @@ namespace webrtc
|
||||
class VCMProcessTimer
|
||||
{
|
||||
public:
|
||||
VCMProcessTimer(WebRtc_UWord32 periodMs, TickTimeBase* clock)
|
||||
VCMProcessTimer(WebRtc_UWord32 periodMs, Clock* clock)
|
||||
: _clock(clock),
|
||||
_periodMs(periodMs),
|
||||
_latestMs(_clock->MillisecondTimestamp()) {}
|
||||
_latestMs(_clock->TimeInMilliseconds()) {}
|
||||
WebRtc_UWord32 Period() const;
|
||||
WebRtc_UWord32 TimeUntilProcess() const;
|
||||
void Processed();
|
||||
|
||||
private:
|
||||
TickTimeBase* _clock;
|
||||
Clock* _clock;
|
||||
WebRtc_UWord32 _periodMs;
|
||||
WebRtc_Word64 _latestMs;
|
||||
};
|
||||
@@ -59,8 +59,7 @@ class VideoCodingModuleImpl : public VideoCodingModule
|
||||
{
|
||||
public:
|
||||
VideoCodingModuleImpl(const WebRtc_Word32 id,
|
||||
TickTimeBase* clock,
|
||||
bool delete_clock_on_destroy);
|
||||
Clock* clock);
|
||||
|
||||
virtual ~VideoCodingModuleImpl();
|
||||
|
||||
@@ -275,8 +274,7 @@ protected:
|
||||
|
||||
private:
|
||||
WebRtc_Word32 _id;
|
||||
TickTimeBase* clock_;
|
||||
bool delete_clock_on_destroy_;
|
||||
Clock* clock_;
|
||||
CriticalSectionWrapper* _receiveCritSect;
|
||||
bool _receiverInited;
|
||||
VCMTiming _timing;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
|
||||
#include "modules/video_coding/main/interface/video_coding.h"
|
||||
#include "modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -32,9 +32,9 @@ class VCMRobustnessTest : public ::testing::Test {
|
||||
static const size_t kPayloadLen = 10;
|
||||
|
||||
virtual void SetUp() {
|
||||
clock_ = new FakeTickTime(0);
|
||||
ASSERT_TRUE(clock_ != NULL);
|
||||
vcm_ = VideoCodingModule::Create(0, clock_);
|
||||
clock_.reset(new SimulatedClock(0));
|
||||
ASSERT_TRUE(clock_.get() != NULL);
|
||||
vcm_ = VideoCodingModule::Create(0, clock_.get());
|
||||
ASSERT_TRUE(vcm_ != NULL);
|
||||
ASSERT_EQ(0, vcm_->InitializeReceiver());
|
||||
ASSERT_EQ(0, vcm_->RegisterFrameTypeCallback(&frame_type_callback_));
|
||||
@@ -48,7 +48,6 @@ class VCMRobustnessTest : public ::testing::Test {
|
||||
|
||||
virtual void TearDown() {
|
||||
VideoCodingModule::Destroy(vcm_);
|
||||
delete clock_;
|
||||
}
|
||||
|
||||
void InsertPacket(uint32_t timestamp,
|
||||
@@ -77,7 +76,7 @@ class VCMRobustnessTest : public ::testing::Test {
|
||||
MockPacketRequestCallback request_callback_;
|
||||
NiceMock<MockVideoDecoder> decoder_;
|
||||
NiceMock<MockVideoDecoder> decoderCopy_;
|
||||
FakeTickTime* clock_;
|
||||
scoped_ptr<SimulatedClock> clock_;
|
||||
};
|
||||
|
||||
TEST_F(VCMRobustnessTest, TestHardNack) {
|
||||
@@ -112,21 +111,21 @@ TEST_F(VCMRobustnessTest, TestHardNack) {
|
||||
ASSERT_EQ(VCM_OK, vcm_->Decode(0));
|
||||
ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
|
||||
ASSERT_EQ(VCM_OK, vcm_->Process());
|
||||
|
||||
ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
|
||||
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
ASSERT_EQ(VCM_OK, vcm_->Process());
|
||||
|
||||
ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
|
||||
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
ASSERT_EQ(VCM_OK, vcm_->Process());
|
||||
|
||||
ASSERT_EQ(VCM_OK, vcm_->Decode(0));
|
||||
@@ -149,7 +148,7 @@ TEST_F(VCMRobustnessTest, TestHardNackNoneDecoded) {
|
||||
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
ASSERT_EQ(VCM_OK, vcm_->Process());
|
||||
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
|
||||
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
ASSERT_EQ(VCM_OK, vcm_->Process());
|
||||
@@ -217,13 +216,13 @@ TEST_F(VCMRobustnessTest, TestDualDecoder) {
|
||||
InsertPacket(0, 2, false, true, kVideoFrameKey);
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 0.
|
||||
|
||||
clock_->IncrementDebugClock(33);
|
||||
clock_->AdvanceTimeMilliseconds(33);
|
||||
InsertPacket(3000, 3, true, false, kVideoFrameDelta);
|
||||
// Packet 4 missing
|
||||
InsertPacket(3000, 5, false, true, kVideoFrameDelta);
|
||||
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
|
||||
clock_->IncrementDebugClock(33);
|
||||
clock_->AdvanceTimeMilliseconds(33);
|
||||
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
|
||||
@@ -232,7 +231,7 @@ TEST_F(VCMRobustnessTest, TestDualDecoder) {
|
||||
// Spawn a decoder copy.
|
||||
EXPECT_EQ(0, vcm_->DecodeDualFrame(0)); // Expect no dual decoder action.
|
||||
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Generate NACK list.
|
||||
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 6000 complete.
|
||||
@@ -299,25 +298,25 @@ TEST_F(VCMRobustnessTest, TestModeNoneWithErrors) {
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 0.
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(33);
|
||||
clock_->AdvanceTimeMilliseconds(33);
|
||||
InsertPacket(3000, 3, true, false, kVideoFrameDelta);
|
||||
// Packet 4 missing
|
||||
InsertPacket(3000, 5, false, true, kVideoFrameDelta);
|
||||
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(33);
|
||||
clock_->AdvanceTimeMilliseconds(33);
|
||||
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 3000 incomplete.
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 6000 complete.
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(23);
|
||||
clock_->AdvanceTimeMilliseconds(23);
|
||||
InsertPacket(3000, 4, false, false, kVideoFrameDelta);
|
||||
|
||||
InsertPacket(9000, 9, true, false, kVideoFrameDelta);
|
||||
@@ -371,14 +370,14 @@ TEST_F(VCMRobustnessTest, TestModeNoneWithoutErrors) {
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 0.
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(33);
|
||||
clock_->AdvanceTimeMilliseconds(33);
|
||||
InsertPacket(3000, 3, true, false, kVideoFrameDelta);
|
||||
// Packet 4 missing
|
||||
InsertPacket(3000, 5, false, true, kVideoFrameDelta);
|
||||
EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(33);
|
||||
clock_->AdvanceTimeMilliseconds(33);
|
||||
InsertPacket(6000, 6, true, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 7, false, false, kVideoFrameDelta);
|
||||
InsertPacket(6000, 8, false, true, kVideoFrameDelta);
|
||||
@@ -386,11 +385,12 @@ TEST_F(VCMRobustnessTest, TestModeNoneWithoutErrors) {
|
||||
// Schedule key frame request.
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(10);
|
||||
clock_->AdvanceTimeMilliseconds(10);
|
||||
EXPECT_EQ(VCM_OK, vcm_->Decode(0)); // Decode timestamp 6000 complete.
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect no NACK list.
|
||||
|
||||
clock_->IncrementDebugClock(500); // Wait for the key request timer to set.
|
||||
// Wait for the key request timer to set.
|
||||
clock_->AdvanceTimeMilliseconds(500);
|
||||
EXPECT_EQ(VCM_OK, vcm_->Process()); // Expect key frame request.
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "trace.h"
|
||||
#include "../source/event.h"
|
||||
#include "rtp_player.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@@ -64,7 +64,7 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
|
||||
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
// TODO(hlundin): This test was not verified after changing to FakeTickTime.
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2, &clock);
|
||||
@@ -125,9 +125,9 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
ret = 0;
|
||||
|
||||
// RTP stream main loop
|
||||
while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
|
||||
while ((ret = rtpStream.NextPacket(clock.TimeInMilliseconds())) == 0)
|
||||
{
|
||||
if (clock.MillisecondTimestamp() % 5 == 0)
|
||||
if (clock.TimeInMilliseconds() % 5 == 0)
|
||||
{
|
||||
ret = vcm->Decode();
|
||||
if (ret < 0)
|
||||
@@ -139,11 +139,11 @@ int DecodeFromStorageTest(CmdArgs& args)
|
||||
{
|
||||
vcm->Process();
|
||||
}
|
||||
if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >= MAX_RUNTIME_MS)
|
||||
if (MAX_RUNTIME_MS > -1 && clock.TimeInMilliseconds() >= MAX_RUNTIME_MS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
clock.IncrementDebugClock(1);
|
||||
clock.AdvanceTimeMilliseconds(1);
|
||||
}
|
||||
|
||||
switch (ret)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "rtp_rtcp.h"
|
||||
#include "common_video/interface/i420_video_frame.h"
|
||||
#include "test_macros.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@@ -27,7 +27,7 @@ int GenericCodecTest::RunTest(CmdArgs& args)
|
||||
printf("\n\nEnable debug events to run this test!\n\n");
|
||||
return -1;
|
||||
#endif
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
|
||||
Trace::CreateTrace();
|
||||
@@ -41,7 +41,8 @@ int GenericCodecTest::RunTest(CmdArgs& args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm, FakeTickTime* clock):
|
||||
GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm,
|
||||
SimulatedClock* clock):
|
||||
_clock(clock),
|
||||
_vcm(vcm),
|
||||
_width(0),
|
||||
@@ -332,10 +333,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
IncrementDebugClock(_frameRate);
|
||||
// The following should be uncommneted for timing tests. Release tests only include
|
||||
// compliance with full sequence bit rate.
|
||||
|
||||
|
||||
//totalBytes = WaitForEncodedFrame();
|
||||
//currentTime = VCMTickTime::MillisecondTimestamp();//clock()/(double)CLOCKS_PER_SEC;
|
||||
if (_frameCnt == _frameRate)// @ 1sec
|
||||
{
|
||||
totalBytesOneSec = _encodeCompleteCallback->EncodedBytes();//totalBytes;
|
||||
@@ -482,8 +479,8 @@ GenericCodecTest::Print()
|
||||
float
|
||||
GenericCodecTest::WaitForEncodedFrame() const
|
||||
{
|
||||
WebRtc_Word64 startTime = _clock->MillisecondTimestamp();
|
||||
while (_clock->MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs*10)
|
||||
WebRtc_Word64 startTime = _clock->TimeInMilliseconds();
|
||||
while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10)
|
||||
{
|
||||
if (_encodeCompleteCallback->EncodeComplete())
|
||||
{
|
||||
@@ -496,7 +493,7 @@ GenericCodecTest::WaitForEncodedFrame() const
|
||||
void
|
||||
GenericCodecTest::IncrementDebugClock(float frameRate)
|
||||
{
|
||||
_clock->IncrementDebugClock(1000/frameRate);
|
||||
_clock->AdvanceTimeMilliseconds(1000/frameRate);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -31,13 +31,13 @@ namespace webrtc {
|
||||
|
||||
int VCMGenericCodecTest(CmdArgs& args);
|
||||
|
||||
class FakeTickTime;
|
||||
class SimulatedClock;
|
||||
|
||||
class GenericCodecTest
|
||||
{
|
||||
public:
|
||||
GenericCodecTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::FakeTickTime* clock);
|
||||
webrtc::SimulatedClock* clock);
|
||||
~GenericCodecTest();
|
||||
static int RunTest(CmdArgs& args);
|
||||
WebRtc_Word32 Perform(CmdArgs& args);
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
WebRtc_Word32 TearDown();
|
||||
void IncrementDebugClock(float frameRate);
|
||||
|
||||
webrtc::FakeTickTime* _clock;
|
||||
webrtc::SimulatedClock* _clock;
|
||||
webrtc::VideoCodingModule* _vcm;
|
||||
webrtc::VideoCodec _sendCodec;
|
||||
webrtc::VideoCodec _receiveCodec;
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
#include "jitter_estimate_test.h"
|
||||
#include "jitter_estimator.h"
|
||||
#include "media_opt_util.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "packet.h"
|
||||
#include "test_util.h"
|
||||
#include "test_macros.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
// TODO(holmer): Get rid of this to conform with style guide.
|
||||
using namespace webrtc;
|
||||
@@ -97,7 +97,7 @@ int JitterBufferTest(CmdArgs& args)
|
||||
#if defined(EVENT_DEBUG)
|
||||
return -1;
|
||||
#endif
|
||||
TickTimeBase clock;
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
|
||||
// Start test
|
||||
WebRtc_UWord16 seqNum = 1234;
|
||||
@@ -106,7 +106,7 @@ int JitterBufferTest(CmdArgs& args)
|
||||
WebRtc_UWord8 data[1500];
|
||||
VCMPacket packet(data, size, seqNum, timeStamp, true);
|
||||
|
||||
VCMJitterBuffer jb(&clock);
|
||||
VCMJitterBuffer jb(clock);
|
||||
|
||||
seqNum = 1234;
|
||||
timeStamp = 123*90;
|
||||
|
||||
@@ -32,9 +32,9 @@ int MediaOptTest::RunTest(int testNum, CmdArgs& args)
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile((test::OutputPath() + "mediaOptTestTrace.txt").c_str());
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
TickTimeBase clock;
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
MediaOptTest* mot = new MediaOptTest(vcm, &clock);
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
||||
MediaOptTest* mot = new MediaOptTest(vcm, clock);
|
||||
if (testNum == 0)
|
||||
{ // regular
|
||||
mot->Setup(0, args);
|
||||
@@ -65,7 +65,7 @@ int MediaOptTest::RunTest(int testNum, CmdArgs& args)
|
||||
}
|
||||
|
||||
|
||||
MediaOptTest::MediaOptTest(VideoCodingModule* vcm, TickTimeBase* clock)
|
||||
MediaOptTest::MediaOptTest(VideoCodingModule* vcm, Clock* clock)
|
||||
: _vcm(vcm),
|
||||
_rtp(NULL),
|
||||
_outgoingTransport(NULL),
|
||||
|
||||
@@ -34,7 +34,7 @@ class MediaOptTest
|
||||
{
|
||||
public:
|
||||
MediaOptTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
~MediaOptTest();
|
||||
|
||||
static int RunTest(int testNum, CmdArgs& args);
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
webrtc::RTPSendCompleteCallback* _outgoingTransport;
|
||||
RtpDataCallback* _dataCallback;
|
||||
|
||||
webrtc::TickTimeBase* _clock;
|
||||
webrtc::Clock* _clock;
|
||||
std::string _inname;
|
||||
std::string _outname;
|
||||
std::string _actualSourcename;
|
||||
|
||||
@@ -143,12 +143,12 @@ int MTRxTxTest(CmdArgs& args)
|
||||
printf("Cannot read file %s.\n", outname.c_str());
|
||||
return -1;
|
||||
}
|
||||
TickTimeBase clock;
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
|
||||
RTPSendCompleteCallback* outgoingTransport =
|
||||
new RTPSendCompleteCallback(&clock, "dump.rtp");
|
||||
new RTPSendCompleteCallback(clock, "dump.rtp");
|
||||
|
||||
RtpRtcp::Configuration configuration;
|
||||
configuration.id = 1;
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "rtp_dump.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
TransportCallback::TransportCallback(TickTimeBase* clock, const char* filename)
|
||||
TransportCallback::TransportCallback(Clock* clock, const char* filename)
|
||||
: RTPSendCompleteCallback(clock, filename) {
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ TransportCallback::SendPacket(int channel, const void *data, int len)
|
||||
transmitPacket = PacketLoss();
|
||||
}
|
||||
|
||||
TickTimeBase clock;
|
||||
int64_t now = clock.MillisecondTimestamp();
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
int64_t now = clock->TimeInMilliseconds();
|
||||
// Insert outgoing packet into list
|
||||
if (transmitPacket)
|
||||
{
|
||||
@@ -72,8 +72,8 @@ TransportCallback::TransportPackets()
|
||||
{
|
||||
// Are we ready to send packets to the receiver?
|
||||
RtpPacket* packet = NULL;
|
||||
TickTimeBase clock;
|
||||
int64_t now = clock.MillisecondTimestamp();
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
int64_t now = clock->TimeInMilliseconds();
|
||||
|
||||
while (!_rtpPackets.empty())
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ class TransportCallback:public RTPSendCompleteCallback
|
||||
{
|
||||
public:
|
||||
// constructor input: (receive side) rtp module to send encoded data to
|
||||
TransportCallback(TickTimeBase* clock, const char* filename = NULL);
|
||||
TransportCallback(Clock* clock, const char* filename = NULL);
|
||||
virtual ~TransportCallback();
|
||||
// Add packets to list
|
||||
// Incorporate network conditions - delay and packet loss
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
#include "../source/event.h"
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "common_types.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "test_callbacks.h"
|
||||
#include "test_macros.h"
|
||||
#include "test_util.h"
|
||||
#include "trace.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@@ -31,17 +31,18 @@ int NormalTest::RunTest(const CmdArgs& args)
|
||||
{
|
||||
#if defined(EVENT_DEBUG)
|
||||
printf("SIMULATION TIME\n");
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock sim_clock;
|
||||
SimulatedClock* clock = &sim_clock;
|
||||
#else
|
||||
printf("REAL-TIME\n");
|
||||
TickTimeBase clock;
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
#endif
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile(
|
||||
(test::OutputPath() + "VCMNormalTestTrace.txt").c_str());
|
||||
Trace::SetLevelFilter(webrtc::kTraceAll);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
NormalTest VCMNTest(vcm, &clock);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
||||
NormalTest VCMNTest(vcm, clock);
|
||||
VCMNTest.Perform(args);
|
||||
VideoCodingModule::Destroy(vcm);
|
||||
Trace::ReturnTrace();
|
||||
@@ -183,7 +184,7 @@ VCMNTDecodeCompleCallback::DecodedBytes()
|
||||
|
||||
//VCM Normal Test Class implementation
|
||||
|
||||
NormalTest::NormalTest(VideoCodingModule* vcm, TickTimeBase* clock)
|
||||
NormalTest::NormalTest(VideoCodingModule* vcm, Clock* clock)
|
||||
:
|
||||
_clock(clock),
|
||||
_vcm(vcm),
|
||||
@@ -289,7 +290,7 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
|
||||
while (feof(_sourceFile) == 0) {
|
||||
#if !defined(EVENT_DEBUG)
|
||||
WebRtc_Word64 processStartTime = _clock->MillisecondTimestamp();
|
||||
WebRtc_Word64 processStartTime = _clock->TimeInMilliseconds();
|
||||
#endif
|
||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
||||
feof(_sourceFile));
|
||||
@@ -332,10 +333,10 @@ NormalTest::Perform(const CmdArgs& args)
|
||||
1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
||||
|
||||
#if defined(EVENT_DEBUG)
|
||||
static_cast<FakeTickTime*>(_clock)->IncrementDebugClock(framePeriod);
|
||||
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
|
||||
#else
|
||||
WebRtc_Word64 timeSpent =
|
||||
_clock->MillisecondTimestamp() - processStartTime;
|
||||
_clock->TimeInMilliseconds() - processStartTime;
|
||||
if (timeSpent < framePeriod)
|
||||
{
|
||||
waitEvent->Wait(framePeriod - timeSpent);
|
||||
|
||||
@@ -86,7 +86,7 @@ class NormalTest
|
||||
{
|
||||
public:
|
||||
NormalTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
~NormalTest();
|
||||
static int RunTest(const CmdArgs& args);
|
||||
WebRtc_Word32 Perform(const CmdArgs& args);
|
||||
@@ -108,7 +108,7 @@ protected:
|
||||
// calculating pipeline delay, and decoding time
|
||||
void FrameDecoded(WebRtc_UWord32 timeStamp);
|
||||
|
||||
webrtc::TickTimeBase* _clock;
|
||||
webrtc::Clock* _clock;
|
||||
webrtc::VideoCodingModule* _vcm;
|
||||
webrtc::VideoCodec _sendCodec;
|
||||
webrtc::VideoCodec _receiveCodec;
|
||||
|
||||
@@ -17,20 +17,19 @@
|
||||
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/main/source/event.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "modules/video_coding/main/test/test_callbacks.h"
|
||||
#include "modules/video_coding/main/test/test_macros.h"
|
||||
#include "modules/video_coding/main/test/test_util.h"
|
||||
#include "system_wrappers/interface/data_log.h"
|
||||
#include "system_wrappers/interface/data_log.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
int qualityModeTest(const CmdArgs& args)
|
||||
{
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
QualityModesTest QMTest(vcm, &clock);
|
||||
QMTest.Perform(args);
|
||||
@@ -39,7 +38,7 @@ int qualityModeTest(const CmdArgs& args)
|
||||
}
|
||||
|
||||
QualityModesTest::QualityModesTest(VideoCodingModule* vcm,
|
||||
TickTimeBase* clock):
|
||||
Clock* clock):
|
||||
NormalTest(vcm, clock),
|
||||
_vpm()
|
||||
{
|
||||
@@ -367,8 +366,8 @@ QualityModesTest::Perform(const CmdArgs& args)
|
||||
DataLog::InsertCell(feature_table_name_, "frame rate", _nativeFrameRate);
|
||||
DataLog::NextRow(feature_table_name_);
|
||||
|
||||
static_cast<FakeTickTime*>(
|
||||
_clock)->IncrementDebugClock(1000 / _nativeFrameRate);
|
||||
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(
|
||||
1000 / _nativeFrameRate);
|
||||
}
|
||||
|
||||
} while (feof(_sourceFile) == 0);
|
||||
|
||||
@@ -22,7 +22,7 @@ class QualityModesTest : public NormalTest
|
||||
{
|
||||
public:
|
||||
QualityModesTest(webrtc::VideoCodingModule* vcm,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
virtual ~QualityModesTest();
|
||||
WebRtc_Word32 Perform(const CmdArgs& args);
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
// A static random seed
|
||||
srand(0);
|
||||
|
||||
TickTimeBase clock;
|
||||
VCMTiming timing(&clock);
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VCMTiming timing(clock);
|
||||
float clockInMs = 0.0;
|
||||
WebRtc_UWord32 waitTime = 0;
|
||||
WebRtc_UWord32 jitterDelayMs = 0;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#include "../source/internal_defines.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "rtp_rtcp.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
@@ -137,7 +137,7 @@ void LostPackets::Print() const {
|
||||
|
||||
RTPPlayer::RTPPlayer(const char* filename,
|
||||
RtpData* callback,
|
||||
TickTimeBase* clock)
|
||||
Clock* clock)
|
||||
:
|
||||
_clock(clock),
|
||||
_rtpModule(NULL),
|
||||
@@ -273,7 +273,8 @@ WebRtc_Word32 RTPPlayer::ReadHeader()
|
||||
|
||||
WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const
|
||||
{
|
||||
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - (_clock->MillisecondTimestamp() - _firstPacketTimeMs);
|
||||
WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) -
|
||||
(_clock->TimeInMilliseconds() - _firstPacketTimeMs);
|
||||
if (timeLeft < 0)
|
||||
{
|
||||
return 0;
|
||||
@@ -293,7 +294,7 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
delete resend_packet;
|
||||
_resendPacketCount++;
|
||||
if (ret > 0) {
|
||||
_lostPackets.SetPacketResent(seqNo, _clock->MillisecondTimestamp());
|
||||
_lostPackets.SetPacketResent(seqNo, _clock->TimeInMilliseconds());
|
||||
} else if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -307,7 +308,7 @@ WebRtc_Word32 RTPPlayer::NextPacket(const WebRtc_Word64 timeNow)
|
||||
if (_firstPacket)
|
||||
{
|
||||
_firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
|
||||
_firstPacketTimeMs = _clock->MillisecondTimestamp();
|
||||
_firstPacketTimeMs = _clock->TimeInMilliseconds();
|
||||
}
|
||||
if (_reordering && _reorderBuffer == NULL)
|
||||
{
|
||||
@@ -428,8 +429,8 @@ WebRtc_Word32 RTPPlayer::ResendPackets(const WebRtc_UWord16* sequenceNumbers, We
|
||||
for (int i=0; i < length; i++)
|
||||
{
|
||||
_lostPackets.SetResendTime(sequenceNumbers[i],
|
||||
_clock->MillisecondTimestamp() + _rttMs,
|
||||
_clock->MillisecondTimestamp());
|
||||
_clock->TimeInMilliseconds() + _rttMs,
|
||||
_clock->TimeInMilliseconds());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "rtp_rtcp.h"
|
||||
#include "critical_section_wrapper.h"
|
||||
#include "video_coding_defines.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <list>
|
||||
@@ -78,7 +78,7 @@ class RTPPlayer : public webrtc::VCMPacketRequestCallback
|
||||
public:
|
||||
RTPPlayer(const char* filename,
|
||||
webrtc::RtpData* callback,
|
||||
webrtc::TickTimeBase* clock);
|
||||
webrtc::Clock* clock);
|
||||
virtual ~RTPPlayer();
|
||||
|
||||
WebRtc_Word32 Initialize(const PayloadTypeList* payloadList);
|
||||
@@ -93,7 +93,7 @@ private:
|
||||
WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
|
||||
WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset);
|
||||
WebRtc_Word32 ReadHeader();
|
||||
webrtc::TickTimeBase* _clock;
|
||||
webrtc::Clock* _clock;
|
||||
FILE* _rtpFile;
|
||||
webrtc::RtpRtcp* _rtpModule;
|
||||
WebRtc_UWord32 _nextRtpTime;
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "modules/video_coding/main/source/tick_time_base.h"
|
||||
#include "rtp_dump.h"
|
||||
#include "test_macros.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -204,7 +204,7 @@ VCMDecodeCompleteCallback::DecodedBytes()
|
||||
return _decodedBytes;
|
||||
}
|
||||
|
||||
RTPSendCompleteCallback::RTPSendCompleteCallback(TickTimeBase* clock,
|
||||
RTPSendCompleteCallback::RTPSendCompleteCallback(Clock* clock,
|
||||
const char* filename):
|
||||
_clock(clock),
|
||||
_sendCount(0),
|
||||
@@ -258,7 +258,7 @@ RTPSendCompleteCallback::SendPacket(int channel, const void *data, int len)
|
||||
bool transmitPacket = true;
|
||||
transmitPacket = PacketLoss();
|
||||
|
||||
WebRtc_UWord64 now = _clock->MillisecondTimestamp();
|
||||
int64_t now = _clock->TimeInMilliseconds();
|
||||
// Insert outgoing packet into list
|
||||
if (transmitPacket)
|
||||
{
|
||||
|
||||
@@ -157,7 +157,7 @@ class RTPSendCompleteCallback: public Transport
|
||||
{
|
||||
public:
|
||||
// Constructor input: (receive side) rtp module to send encoded data to
|
||||
RTPSendCompleteCallback(TickTimeBase* clock,
|
||||
RTPSendCompleteCallback(Clock* clock,
|
||||
const char* filename = NULL);
|
||||
virtual ~RTPSendCompleteCallback();
|
||||
|
||||
@@ -186,7 +186,7 @@ protected:
|
||||
// Random uniform loss model
|
||||
bool UnifomLoss(double lossPct);
|
||||
|
||||
TickTimeBase* _clock;
|
||||
Clock* _clock;
|
||||
WebRtc_UWord32 _sendCount;
|
||||
RtpRtcp* _rtp;
|
||||
double _lossPct;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "../source/internal_defines.h"
|
||||
#include "test_macros.h"
|
||||
#include "rtp_player.h"
|
||||
#include "modules/video_coding/main/source/mock/fake_tick_time.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -130,7 +130,7 @@ int RtpPlay(CmdArgs& args)
|
||||
if (outFile == "")
|
||||
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
||||
FrameReceiveCallback receiveCallback(outFile);
|
||||
FakeTickTime clock(0);
|
||||
SimulatedClock clock(0);
|
||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback, &clock);
|
||||
@@ -198,9 +198,9 @@ int RtpPlay(CmdArgs& args)
|
||||
ret = 0;
|
||||
|
||||
// RTP stream main loop
|
||||
while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
|
||||
while ((ret = rtpStream.NextPacket(clock.TimeInMilliseconds())) == 0)
|
||||
{
|
||||
if (clock.MillisecondTimestamp() % 5 == 0)
|
||||
if (clock.TimeInMilliseconds() % 5 == 0)
|
||||
{
|
||||
ret = vcm->Decode();
|
||||
if (ret < 0)
|
||||
@@ -214,12 +214,12 @@ int RtpPlay(CmdArgs& args)
|
||||
{
|
||||
vcm->Process();
|
||||
}
|
||||
if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >=
|
||||
if (MAX_RUNTIME_MS > -1 && clock.TimeInMilliseconds() >=
|
||||
MAX_RUNTIME_MS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
clock.IncrementDebugClock(1);
|
||||
clock.AdvanceTimeMilliseconds(1);
|
||||
}
|
||||
|
||||
// Tear down
|
||||
|
||||
@@ -8,17 +8,18 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "receiver_tests.h"
|
||||
#include "video_coding.h"
|
||||
#include "rtp_rtcp.h"
|
||||
#include "trace.h"
|
||||
#include "thread_wrapper.h"
|
||||
#include "../source/event.h"
|
||||
#include "test_macros.h"
|
||||
#include "rtp_player.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||
#include "webrtc/modules/video_coding/main/source/event.h"
|
||||
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||
#include "webrtc/modules/video_coding/main/test/rtp_player.h"
|
||||
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
using namespace webrtc;
|
||||
|
||||
bool ProcessingThread(void* obj)
|
||||
@@ -39,8 +40,8 @@ bool RtpReaderThread(void* obj)
|
||||
SharedState* state = static_cast<SharedState*>(obj);
|
||||
EventWrapper& waitEvent = *EventWrapper::Create();
|
||||
// RTP stream main loop
|
||||
TickTimeBase clock;
|
||||
if (state->_rtpPlayer.NextPacket(clock.MillisecondTimestamp()) < 0)
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
if (state->_rtpPlayer.NextPacket(clock->TimeInMilliseconds()) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -82,9 +83,9 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
(protection == kProtectionDualDecoder ||
|
||||
protection == kProtectionNack ||
|
||||
kProtectionNackFEC));
|
||||
TickTimeBase clock;
|
||||
Clock* clock = Clock::GetRealTimeClock();
|
||||
VideoCodingModule* vcm =
|
||||
VideoCodingModule::Create(1, &clock);
|
||||
VideoCodingModule::Create(1, clock);
|
||||
RtpDataCallback dataCallback(vcm);
|
||||
std::string rtpFilename;
|
||||
rtpFilename = args.inputFile;
|
||||
@@ -137,7 +138,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
}
|
||||
printf("Watch %s to verify that the output is reasonable\n", outFilename.c_str());
|
||||
}
|
||||
RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, &clock);
|
||||
RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, clock);
|
||||
PayloadTypeList payloadTypes;
|
||||
payloadTypes.push_front(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8",
|
||||
kVideoCodecVP8));
|
||||
@@ -164,10 +165,10 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
||||
}
|
||||
|
||||
// Create and start all threads
|
||||
ThreadWrapper* processingThread = ThreadWrapper::CreateThread(ProcessingThread,
|
||||
&mtState, kNormalPriority, "ProcessingThread");
|
||||
ThreadWrapper* rtpReaderThread = ThreadWrapper::CreateThread(RtpReaderThread,
|
||||
&mtState, kNormalPriority, "RtpReaderThread");
|
||||
ThreadWrapper* processingThread = ThreadWrapper::CreateThread(
|
||||
ProcessingThread, &mtState, kNormalPriority, "ProcessingThread");
|
||||
ThreadWrapper* rtpReaderThread = ThreadWrapper::CreateThread(
|
||||
RtpReaderThread, &mtState, kNormalPriority, "RtpReaderThread");
|
||||
ThreadWrapper* decodeThread = ThreadWrapper::CreateThread(DecodeThread,
|
||||
&mtState, kNormalPriority, "DecodeThread");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user