Refactor webrtc specific Event implementation to an EventFactory.
Review URL: https://webrtc-codereview.appspot.com/1187005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3664 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b7edd06530
commit
2baf5f5fa0
@ -11,10 +11,11 @@
|
|||||||
#ifndef WEBRTC_MODULES_INTERFACE_VIDEO_CODING_H_
|
#ifndef WEBRTC_MODULES_INTERFACE_VIDEO_CODING_H_
|
||||||
#define WEBRTC_MODULES_INTERFACE_VIDEO_CODING_H_
|
#define WEBRTC_MODULES_INTERFACE_VIDEO_CODING_H_
|
||||||
|
|
||||||
#include "common_video/interface/i420_video_frame.h"
|
#include "webrtc/common_video/interface/i420_video_frame.h"
|
||||||
#include "modules/interface/module.h"
|
#include "webrtc/modules/interface/module.h"
|
||||||
#include "modules/interface/module_common_types.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
#include "modules/video_coding/main/interface/video_coding_defines.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc
|
||||||
{
|
{
|
||||||
@ -24,6 +25,22 @@ class VideoEncoder;
|
|||||||
class VideoDecoder;
|
class VideoDecoder;
|
||||||
struct CodecSpecificInfo;
|
struct CodecSpecificInfo;
|
||||||
|
|
||||||
|
class EventFactory {
|
||||||
|
public:
|
||||||
|
virtual ~EventFactory() {}
|
||||||
|
|
||||||
|
virtual EventWrapper* CreateEvent() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EventFactoryImpl : public EventFactory {
|
||||||
|
public:
|
||||||
|
virtual ~EventFactoryImpl() {}
|
||||||
|
|
||||||
|
virtual EventWrapper* CreateEvent() {
|
||||||
|
return EventWrapper::Create();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class VideoCodingModule : public Module
|
class VideoCodingModule : public Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -49,7 +66,8 @@ public:
|
|||||||
static VideoCodingModule* Create(const WebRtc_Word32 id);
|
static VideoCodingModule* Create(const WebRtc_Word32 id);
|
||||||
|
|
||||||
static VideoCodingModule* Create(const WebRtc_Word32 id,
|
static VideoCodingModule* Create(const WebRtc_Word32 id,
|
||||||
Clock* clock);
|
Clock* clock,
|
||||||
|
EventFactory* event_factory);
|
||||||
|
|
||||||
static void Destroy(VideoCodingModule* module);
|
static void Destroy(VideoCodingModule* module);
|
||||||
|
|
||||||
|
@ -1,63 +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_EVENT_H_
|
|
||||||
#define WEBRTC_MODULES_VIDEO_CODING_EVENT_H_
|
|
||||||
|
|
||||||
#include "event_wrapper.h"
|
|
||||||
|
|
||||||
namespace webrtc
|
|
||||||
{
|
|
||||||
|
|
||||||
//#define EVENT_DEBUG
|
|
||||||
|
|
||||||
class VCMEvent : public EventWrapper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VCMEvent() : _event(*EventWrapper::Create()) {};
|
|
||||||
|
|
||||||
virtual ~VCMEvent() { delete &_event; };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release waiting threads
|
|
||||||
*/
|
|
||||||
bool Set() { return _event.Set(); };
|
|
||||||
|
|
||||||
bool Reset() { return _event.Reset(); };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wait for this event
|
|
||||||
*/
|
|
||||||
EventTypeWrapper Wait(unsigned long maxTime)
|
|
||||||
{
|
|
||||||
#ifdef EVENT_DEBUG
|
|
||||||
return kEventTimeout;
|
|
||||||
#else
|
|
||||||
return _event.Wait(maxTime);
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start a timer
|
|
||||||
*/
|
|
||||||
bool StartTimer(bool periodic, unsigned long time)
|
|
||||||
{ return _event.StartTimer(periodic, time); };
|
|
||||||
/**
|
|
||||||
* Stop the timer
|
|
||||||
*/
|
|
||||||
bool StopTimer() { return _event.StopTimer(); };
|
|
||||||
|
|
||||||
private:
|
|
||||||
EventWrapper& _event;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CODING_EVENT_H_
|
|
@ -7,12 +7,12 @@
|
|||||||
* in the file PATENTS. All contributing project authors may
|
* in the file PATENTS. All contributing project authors may
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
#include "modules/video_coding/main/source/jitter_buffer.h"
|
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "webrtc/modules/video_coding/main/source/event.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "webrtc/modules/video_coding/main/source/frame_buffer.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/inter_frame_delay.h"
|
||||||
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include "webrtc/modules/video_coding/main/source/packet.h"
|
#include "webrtc/modules/video_coding/main/source/packet.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/logging.h"
|
#include "webrtc/system_wrappers/interface/logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
@ -67,6 +68,7 @@ bool HasNonEmptyState(VCMFrameBuffer* frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
|
VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
|
||||||
|
EventFactory* event_factory,
|
||||||
int vcm_id,
|
int vcm_id,
|
||||||
int receiver_id,
|
int receiver_id,
|
||||||
bool master)
|
bool master)
|
||||||
@ -76,8 +78,8 @@ VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
|
|||||||
running_(false),
|
running_(false),
|
||||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||||
master_(master),
|
master_(master),
|
||||||
frame_event_(),
|
frame_event_(event_factory->CreateEvent()),
|
||||||
packet_event_(),
|
packet_event_(event_factory->CreateEvent()),
|
||||||
max_number_of_frames_(kStartNumberOfFrames),
|
max_number_of_frames_(kStartNumberOfFrames),
|
||||||
frame_buffers_(),
|
frame_buffers_(),
|
||||||
frame_list_(),
|
frame_list_(),
|
||||||
@ -192,8 +194,8 @@ void VCMJitterBuffer::Start() {
|
|||||||
num_discarded_packets_ = 0;
|
num_discarded_packets_ = 0;
|
||||||
|
|
||||||
// Start in a non-signaled state.
|
// Start in a non-signaled state.
|
||||||
frame_event_.Reset();
|
frame_event_->Reset();
|
||||||
packet_event_.Reset();
|
packet_event_->Reset();
|
||||||
waiting_for_completion_.frame_size = 0;
|
waiting_for_completion_.frame_size = 0;
|
||||||
waiting_for_completion_.timestamp = 0;
|
waiting_for_completion_.timestamp = 0;
|
||||||
waiting_for_completion_.latest_packet_time = -1;
|
waiting_for_completion_.latest_packet_time = -1;
|
||||||
@ -220,8 +222,8 @@ void VCMJitterBuffer::Stop() {
|
|||||||
|
|
||||||
crit_sect_->Leave();
|
crit_sect_->Leave();
|
||||||
// Make sure we wake up any threads waiting on these events.
|
// Make sure we wake up any threads waiting on these events.
|
||||||
frame_event_.Set();
|
frame_event_->Set();
|
||||||
packet_event_.Set();
|
packet_event_->Set();
|
||||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
|
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
|
||||||
VCMId(vcm_id_, receiver_id_), "JB(0x%x): Jitter buffer: stop",
|
VCMId(vcm_id_, receiver_id_), "JB(0x%x): Jitter buffer: stop",
|
||||||
this);
|
this);
|
||||||
@ -241,8 +243,8 @@ void VCMJitterBuffer::Flush() {
|
|||||||
}
|
}
|
||||||
last_decoded_state_.Reset(); // TODO(mikhal): sync reset.
|
last_decoded_state_.Reset(); // TODO(mikhal): sync reset.
|
||||||
num_not_decodable_packets_ = 0;
|
num_not_decodable_packets_ = 0;
|
||||||
frame_event_.Reset();
|
frame_event_->Reset();
|
||||||
packet_event_.Reset();
|
packet_event_->Reset();
|
||||||
num_consecutive_old_frames_ = 0;
|
num_consecutive_old_frames_ = 0;
|
||||||
num_consecutive_old_packets_ = 0;
|
num_consecutive_old_packets_ = 0;
|
||||||
// Also reset the jitter and delay estimates
|
// Also reset the jitter and delay estimates
|
||||||
@ -354,10 +356,10 @@ int64_t VCMJitterBuffer::NextTimestamp(uint32_t max_wait_time_ms,
|
|||||||
FrameList::iterator it = frame_list_.begin();
|
FrameList::iterator it = frame_list_.begin();
|
||||||
|
|
||||||
if (it == frame_list_.end()) {
|
if (it == frame_list_.end()) {
|
||||||
packet_event_.Reset();
|
packet_event_->Reset();
|
||||||
crit_sect_->Leave();
|
crit_sect_->Leave();
|
||||||
|
|
||||||
if (packet_event_.Wait(max_wait_time_ms) == kEventSignaled) {
|
if (packet_event_->Wait(max_wait_time_ms) == kEventSignaled) {
|
||||||
// are we closing down the Jitter buffer
|
// are we closing down the Jitter buffer
|
||||||
if (!running_) {
|
if (!running_) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -449,7 +451,7 @@ VCMEncodedFrame* VCMJitterBuffer::GetCompleteFrameForDecoding(
|
|||||||
while (wait_time_ms > 0) {
|
while (wait_time_ms > 0) {
|
||||||
crit_sect_->Leave();
|
crit_sect_->Leave();
|
||||||
const EventTypeWrapper ret =
|
const EventTypeWrapper ret =
|
||||||
frame_event_.Wait(static_cast<uint32_t>(wait_time_ms));
|
frame_event_->Wait(static_cast<uint32_t>(wait_time_ms));
|
||||||
crit_sect_->Enter();
|
crit_sect_->Enter();
|
||||||
if (ret == kEventSignaled) {
|
if (ret == kEventSignaled) {
|
||||||
// are we closing down the Jitter buffer
|
// are we closing down the Jitter buffer
|
||||||
@ -475,7 +477,7 @@ VCMEncodedFrame* VCMJitterBuffer::GetCompleteFrameForDecoding(
|
|||||||
// Inside |crit_sect_|.
|
// Inside |crit_sect_|.
|
||||||
} else {
|
} else {
|
||||||
// We already have a frame reset the event.
|
// We already have a frame reset the event.
|
||||||
frame_event_.Reset();
|
frame_event_->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (it == frame_list_.end()) {
|
if (it == frame_list_.end()) {
|
||||||
@ -763,13 +765,13 @@ VCMFrameBufferEnum VCMJitterBuffer::InsertPacket(VCMEncodedFrame* encoded_frame,
|
|||||||
if (UpdateFrameState(frame) == kFlushIndicator)
|
if (UpdateFrameState(frame) == kFlushIndicator)
|
||||||
ret = kFlushIndicator;
|
ret = kFlushIndicator;
|
||||||
// Signal that we have a received packet.
|
// Signal that we have a received packet.
|
||||||
packet_event_.Set();
|
packet_event_->Set();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kDecodableSession:
|
case kDecodableSession:
|
||||||
case kIncomplete: {
|
case kIncomplete: {
|
||||||
// Signal that we have a received packet.
|
// Signal that we have a received packet.
|
||||||
packet_event_.Set();
|
packet_event_->Set();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kNoError:
|
case kNoError:
|
||||||
@ -1178,7 +1180,7 @@ VCMFrameBufferEnum VCMJitterBuffer::UpdateFrameState(VCMFrameBuffer* frame) {
|
|||||||
// Only signal if this is the oldest frame.
|
// Only signal if this is the oldest frame.
|
||||||
// Not necessarily the case due to packet reordering or NACK.
|
// Not necessarily the case due to packet reordering or NACK.
|
||||||
if (!WaitForRetransmissions() || (old_frame != NULL && old_frame == frame)) {
|
if (!WaitForRetransmissions() || (old_frame != NULL && old_frame == frame)) {
|
||||||
frame_event_.Set();
|
frame_event_->Set();
|
||||||
}
|
}
|
||||||
return kNoError;
|
return kNoError;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "webrtc/modules/interface/module_common_types.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
|
||||||
#include "webrtc/modules/video_coding/main/source/decoding_state.h"
|
#include "webrtc/modules/video_coding/main/source/decoding_state.h"
|
||||||
#include "webrtc/modules/video_coding/main/source/event.h"
|
|
||||||
#include "webrtc/modules/video_coding/main/source/inter_frame_delay.h"
|
#include "webrtc/modules/video_coding/main/source/inter_frame_delay.h"
|
||||||
#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.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/jitter_estimator.h"
|
||||||
@ -40,6 +39,8 @@ typedef std::list<VCMFrameBuffer*> FrameList;
|
|||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
class Clock;
|
class Clock;
|
||||||
|
class EventFactory;
|
||||||
|
class EventWrapper;
|
||||||
class VCMFrameBuffer;
|
class VCMFrameBuffer;
|
||||||
class VCMPacket;
|
class VCMPacket;
|
||||||
class VCMEncodedFrame;
|
class VCMEncodedFrame;
|
||||||
@ -54,6 +55,7 @@ struct VCMJitterSample {
|
|||||||
class VCMJitterBuffer {
|
class VCMJitterBuffer {
|
||||||
public:
|
public:
|
||||||
VCMJitterBuffer(Clock* clock,
|
VCMJitterBuffer(Clock* clock,
|
||||||
|
EventFactory* event_factory,
|
||||||
int vcm_id,
|
int vcm_id,
|
||||||
int receiver_id,
|
int receiver_id,
|
||||||
bool master);
|
bool master);
|
||||||
@ -248,9 +250,9 @@ class VCMJitterBuffer {
|
|||||||
CriticalSectionWrapper* crit_sect_;
|
CriticalSectionWrapper* crit_sect_;
|
||||||
bool master_;
|
bool master_;
|
||||||
// Event to signal when we have a frame ready for decoder.
|
// Event to signal when we have a frame ready for decoder.
|
||||||
VCMEvent frame_event_;
|
scoped_ptr<EventWrapper> frame_event_;
|
||||||
// Event to signal when we have received a packet.
|
// Event to signal when we have received a packet.
|
||||||
VCMEvent packet_event_;
|
scoped_ptr<EventWrapper> packet_event_;
|
||||||
// Number of allocated frames.
|
// Number of allocated frames.
|
||||||
int max_number_of_frames_;
|
int max_number_of_frames_;
|
||||||
// Array of pointers to the frames in jitter buffer.
|
// Array of pointers to the frames in jitter buffer.
|
||||||
|
@ -12,10 +12,11 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "modules/video_coding/main/source/jitter_buffer.h"
|
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
|
||||||
#include "modules/video_coding/main/source/media_opt_util.h"
|
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
|
||||||
#include "modules/video_coding/main/source/packet.h"
|
#include "webrtc/modules/video_coding/main/source/packet.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -163,7 +164,8 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
|||||||
clock_.reset(new SimulatedClock(0));
|
clock_.reset(new SimulatedClock(0));
|
||||||
max_nack_list_size_ = 150;
|
max_nack_list_size_ = 150;
|
||||||
oldest_packet_to_nack_ = 250;
|
oldest_packet_to_nack_ = 250;
|
||||||
jitter_buffer_ = new VCMJitterBuffer(clock_.get(), -1, -1, true);
|
jitter_buffer_ = new VCMJitterBuffer(clock_.get(), &event_factory_, -1, -1,
|
||||||
|
true);
|
||||||
stream_generator = new StreamGenerator(0, 0, clock_->TimeInMilliseconds());
|
stream_generator = new StreamGenerator(0, 0, clock_->TimeInMilliseconds());
|
||||||
jitter_buffer_->Start();
|
jitter_buffer_->Start();
|
||||||
jitter_buffer_->SetNackSettings(max_nack_list_size_,
|
jitter_buffer_->SetNackSettings(max_nack_list_size_,
|
||||||
@ -249,6 +251,7 @@ class TestRunningJitterBuffer : public ::testing::Test {
|
|||||||
VCMJitterBuffer* jitter_buffer_;
|
VCMJitterBuffer* jitter_buffer_;
|
||||||
StreamGenerator* stream_generator;
|
StreamGenerator* stream_generator;
|
||||||
scoped_ptr<SimulatedClock> clock_;
|
scoped_ptr<SimulatedClock> clock_;
|
||||||
|
NullEventFactory event_factory_;
|
||||||
size_t max_nack_list_size_;
|
size_t max_nack_list_size_;
|
||||||
int oldest_packet_to_nack_;
|
int oldest_packet_to_nack_;
|
||||||
uint8_t data_buffer_[kDataBufferSize];
|
uint8_t data_buffer_[kDataBufferSize];
|
||||||
|
@ -25,6 +25,7 @@ enum { kMaxReceiverDelayMs = 10000 };
|
|||||||
|
|
||||||
VCMReceiver::VCMReceiver(VCMTiming* timing,
|
VCMReceiver::VCMReceiver(VCMTiming* timing,
|
||||||
Clock* clock,
|
Clock* clock,
|
||||||
|
EventFactory* event_factory,
|
||||||
int32_t vcm_id,
|
int32_t vcm_id,
|
||||||
int32_t receiver_id,
|
int32_t receiver_id,
|
||||||
bool master)
|
bool master)
|
||||||
@ -33,14 +34,14 @@ VCMReceiver::VCMReceiver(VCMTiming* timing,
|
|||||||
clock_(clock),
|
clock_(clock),
|
||||||
receiver_id_(receiver_id),
|
receiver_id_(receiver_id),
|
||||||
master_(master),
|
master_(master),
|
||||||
jitter_buffer_(clock_, vcm_id, receiver_id, master),
|
jitter_buffer_(clock_, event_factory, vcm_id, receiver_id, master),
|
||||||
timing_(timing),
|
timing_(timing),
|
||||||
render_wait_event_(),
|
render_wait_event_(event_factory->CreateEvent()),
|
||||||
state_(kPassive),
|
state_(kPassive),
|
||||||
max_video_delay_ms_(kMaxVideoDelayMs) {}
|
max_video_delay_ms_(kMaxVideoDelayMs) {}
|
||||||
|
|
||||||
VCMReceiver::~VCMReceiver() {
|
VCMReceiver::~VCMReceiver() {
|
||||||
render_wait_event_.Set();
|
render_wait_event_->Set();
|
||||||
delete crit_sect_;
|
delete crit_sect_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ void VCMReceiver::Reset() {
|
|||||||
} else {
|
} else {
|
||||||
jitter_buffer_.Flush();
|
jitter_buffer_.Flush();
|
||||||
}
|
}
|
||||||
render_wait_event_.Reset();
|
render_wait_event_->Reset();
|
||||||
if (master_) {
|
if (master_) {
|
||||||
state_ = kReceiving;
|
state_ = kReceiving;
|
||||||
} else {
|
} else {
|
||||||
@ -298,7 +299,7 @@ VCMEncodedFrame* VCMReceiver::FrameForRendering(uint16_t max_wait_time_ms,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// Wait until it's time to render.
|
// Wait until it's time to render.
|
||||||
render_wait_event_.Wait(wait_time_ms);
|
render_wait_event_->Wait(wait_time_ms);
|
||||||
|
|
||||||
// Get a complete frame if possible.
|
// Get a complete frame if possible.
|
||||||
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
|
VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
|
||||||
|
@ -37,9 +37,10 @@ class VCMReceiver {
|
|||||||
public:
|
public:
|
||||||
VCMReceiver(VCMTiming* timing,
|
VCMReceiver(VCMTiming* timing,
|
||||||
Clock* clock,
|
Clock* clock,
|
||||||
int32_t vcm_id = -1,
|
EventFactory* event_factory,
|
||||||
int32_t receiver_id = -1,
|
int32_t vcm_id,
|
||||||
bool master = true);
|
int32_t receiver_id,
|
||||||
|
bool master);
|
||||||
~VCMReceiver();
|
~VCMReceiver();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
@ -94,7 +95,7 @@ class VCMReceiver {
|
|||||||
bool master_;
|
bool master_;
|
||||||
VCMJitterBuffer jitter_buffer_;
|
VCMJitterBuffer jitter_buffer_;
|
||||||
VCMTiming* timing_;
|
VCMTiming* timing_;
|
||||||
VCMEvent render_wait_event_;
|
scoped_ptr<EventWrapper> render_wait_event_;
|
||||||
VCMReceiverState state_;
|
VCMReceiverState state_;
|
||||||
int max_video_delay_ms_;
|
int max_video_delay_ms_;
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@
|
|||||||
'decoding_state.h',
|
'decoding_state.h',
|
||||||
'encoded_frame.h',
|
'encoded_frame.h',
|
||||||
'er_tables_xor.h',
|
'er_tables_xor.h',
|
||||||
'event.h',
|
|
||||||
'fec_tables_xor.h',
|
'fec_tables_xor.h',
|
||||||
'frame_buffer.h',
|
'frame_buffer.h',
|
||||||
'generic_decoder.h',
|
'generic_decoder.h',
|
||||||
|
@ -44,7 +44,9 @@ VCMProcessTimer::Processed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
|
VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
|
||||||
Clock* clock)
|
Clock* clock,
|
||||||
|
EventFactory* event_factory,
|
||||||
|
bool owns_event_factory)
|
||||||
:
|
:
|
||||||
_id(id),
|
_id(id),
|
||||||
clock_(clock),
|
clock_(clock),
|
||||||
@ -52,8 +54,8 @@ _receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
|
|||||||
_receiverInited(false),
|
_receiverInited(false),
|
||||||
_timing(clock_, id, 1),
|
_timing(clock_, id, 1),
|
||||||
_dualTiming(clock_, id, 2, &_timing),
|
_dualTiming(clock_, id, 2, &_timing),
|
||||||
_receiver(&_timing, clock_, id, 1),
|
_receiver(&_timing, clock_, event_factory, id, 1, true),
|
||||||
_dualReceiver(&_dualTiming, clock_, id, 2, false),
|
_dualReceiver(&_dualTiming, clock_, event_factory, id, 2, false),
|
||||||
_decodedFrameCallback(_timing, clock_),
|
_decodedFrameCallback(_timing, clock_),
|
||||||
_dualDecodedFrameCallback(_dualTiming, clock_),
|
_dualDecodedFrameCallback(_dualTiming, clock_),
|
||||||
_frameTypeCallback(NULL),
|
_frameTypeCallback(NULL),
|
||||||
@ -82,7 +84,9 @@ _codecDataBase(id),
|
|||||||
_receiveStatsTimer(1000, clock_),
|
_receiveStatsTimer(1000, clock_),
|
||||||
_sendStatsTimer(1000, clock_),
|
_sendStatsTimer(1000, clock_),
|
||||||
_retransmissionTimer(10, clock_),
|
_retransmissionTimer(10, clock_),
|
||||||
_keyRequestTimer(500, clock_)
|
_keyRequestTimer(500, clock_),
|
||||||
|
event_factory_(event_factory),
|
||||||
|
owns_event_factory_(owns_event_factory)
|
||||||
{
|
{
|
||||||
assert(clock_);
|
assert(clock_);
|
||||||
#ifdef DEBUG_DECODER_BIT_STREAM
|
#ifdef DEBUG_DECODER_BIT_STREAM
|
||||||
@ -98,6 +102,9 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl()
|
|||||||
}
|
}
|
||||||
delete _receiveCritSect;
|
delete _receiveCritSect;
|
||||||
delete _sendCritSect;
|
delete _sendCritSect;
|
||||||
|
if (owns_event_factory_) {
|
||||||
|
delete event_factory_;
|
||||||
|
}
|
||||||
#ifdef DEBUG_DECODER_BIT_STREAM
|
#ifdef DEBUG_DECODER_BIT_STREAM
|
||||||
fclose(_bitStreamBeforeDecoder);
|
fclose(_bitStreamBeforeDecoder);
|
||||||
#endif
|
#endif
|
||||||
@ -110,14 +117,17 @@ VideoCodingModuleImpl::~VideoCodingModuleImpl()
|
|||||||
VideoCodingModule*
|
VideoCodingModule*
|
||||||
VideoCodingModule::Create(const WebRtc_Word32 id)
|
VideoCodingModule::Create(const WebRtc_Word32 id)
|
||||||
{
|
{
|
||||||
return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock());
|
return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock(),
|
||||||
|
new EventFactoryImpl, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCodingModule*
|
VideoCodingModule*
|
||||||
VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock)
|
VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock,
|
||||||
|
EventFactory* event_factory)
|
||||||
{
|
{
|
||||||
assert(clock);
|
assert(clock);
|
||||||
return new VideoCodingModuleImpl(id, clock);
|
assert(event_factory);
|
||||||
|
return new VideoCodingModuleImpl(id, clock, event_factory, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -58,7 +58,8 @@ enum VCMKeyRequestMode
|
|||||||
class VideoCodingModuleImpl : public VideoCodingModule
|
class VideoCodingModuleImpl : public VideoCodingModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VideoCodingModuleImpl(const WebRtc_Word32 id, Clock* clock);
|
VideoCodingModuleImpl(const WebRtc_Word32 id, Clock* clock,
|
||||||
|
EventFactory* event_factory, bool owns_event_factory);
|
||||||
|
|
||||||
virtual ~VideoCodingModuleImpl();
|
virtual ~VideoCodingModuleImpl();
|
||||||
|
|
||||||
@ -316,6 +317,8 @@ private:
|
|||||||
VCMProcessTimer _sendStatsTimer;
|
VCMProcessTimer _sendStatsTimer;
|
||||||
VCMProcessTimer _retransmissionTimer;
|
VCMProcessTimer _retransmissionTimer;
|
||||||
VCMProcessTimer _keyRequestTimer;
|
VCMProcessTimer _keyRequestTimer;
|
||||||
|
EventFactory* event_factory_;
|
||||||
|
bool owns_event_factory_;
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_
|
#endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_
|
||||||
|
@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
|
#include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
|
||||||
#include "webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
|
#include "webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
|
||||||
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
using ::testing::AllOf;
|
using ::testing::AllOf;
|
||||||
using ::testing::ElementsAre;
|
using ::testing::ElementsAre;
|
||||||
@ -39,7 +39,7 @@ class TestVideoCodingModule : public ::testing::Test {
|
|||||||
|
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
clock_.reset(new SimulatedClock(0));
|
clock_.reset(new SimulatedClock(0));
|
||||||
vcm_ = VideoCodingModule::Create(0, clock_.get());
|
vcm_ = VideoCodingModule::Create(0, clock_.get(), &event_factory_);
|
||||||
EXPECT_EQ(0, vcm_->InitializeReceiver());
|
EXPECT_EQ(0, vcm_->InitializeReceiver());
|
||||||
EXPECT_EQ(0, vcm_->InitializeSender());
|
EXPECT_EQ(0, vcm_->InitializeSender());
|
||||||
EXPECT_EQ(0, vcm_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType,
|
EXPECT_EQ(0, vcm_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType,
|
||||||
@ -125,6 +125,7 @@ class TestVideoCodingModule : public ::testing::Test {
|
|||||||
|
|
||||||
VideoCodingModule* vcm_;
|
VideoCodingModule* vcm_;
|
||||||
scoped_ptr<SimulatedClock> clock_;
|
scoped_ptr<SimulatedClock> clock_;
|
||||||
|
NullEventFactory event_factory_;
|
||||||
NiceMock<MockVideoDecoder> decoder_;
|
NiceMock<MockVideoDecoder> decoder_;
|
||||||
NiceMock<MockVideoEncoder> encoder_;
|
NiceMock<MockVideoEncoder> encoder_;
|
||||||
I420VideoFrame input_frame_;
|
I420VideoFrame input_frame_;
|
||||||
|
@ -8,11 +8,12 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
#include "gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
|
#include "webrtc/modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
|
||||||
#include "modules/video_coding/main/interface/video_coding.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
|
#include "webrtc/modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -34,7 +35,7 @@ class VCMRobustnessTest : public ::testing::Test {
|
|||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
clock_.reset(new SimulatedClock(0));
|
clock_.reset(new SimulatedClock(0));
|
||||||
ASSERT_TRUE(clock_.get() != NULL);
|
ASSERT_TRUE(clock_.get() != NULL);
|
||||||
vcm_ = VideoCodingModule::Create(0, clock_.get());
|
vcm_ = VideoCodingModule::Create(0, clock_.get(), &event_factory_);
|
||||||
ASSERT_TRUE(vcm_ != NULL);
|
ASSERT_TRUE(vcm_ != NULL);
|
||||||
ASSERT_EQ(0, vcm_->InitializeReceiver());
|
ASSERT_EQ(0, vcm_->InitializeReceiver());
|
||||||
const size_t kMaxNackListSize = 250;
|
const size_t kMaxNackListSize = 250;
|
||||||
@ -80,6 +81,7 @@ class VCMRobustnessTest : public ::testing::Test {
|
|||||||
NiceMock<MockVideoDecoder> decoder_;
|
NiceMock<MockVideoDecoder> decoder_;
|
||||||
NiceMock<MockVideoDecoder> decoderCopy_;
|
NiceMock<MockVideoDecoder> decoderCopy_;
|
||||||
scoped_ptr<SimulatedClock> clock_;
|
scoped_ptr<SimulatedClock> clock_;
|
||||||
|
NullEventFactory event_factory_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(VCMRobustnessTest, TestHardNack) {
|
TEST_F(VCMRobustnessTest, TestHardNack) {
|
||||||
|
@ -11,20 +11,19 @@
|
|||||||
// Implementation of codec data base test
|
// Implementation of codec data base test
|
||||||
// testing is done via the VCM module, no specific CodecDataBase module functionality.
|
// testing is done via the VCM module, no specific CodecDataBase module functionality.
|
||||||
|
|
||||||
#include "codec_database_test.h"
|
#include "webrtc/modules/video_coding/main/test/codec_database_test.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "../../../../engine_configurations.h"
|
#include "webrtc/engine_configurations.h"
|
||||||
#include "../source/event.h"
|
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
|
||||||
#include "test_callbacks.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_callbacks.h"
|
||||||
#include "test_util.h"
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "testsupport/fileutils.h"
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "testsupport/metrics/video_metrics.h"
|
#include "webrtc/test/testsupport/fileutils.h"
|
||||||
#include "vp8.h" // for external codecs test
|
#include "webrtc/test/testsupport/metrics/video_metrics.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
|
@ -8,13 +8,12 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "receiver_tests.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
#include "video_coding.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "rtp_rtcp.h"
|
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||||
#include "trace.h"
|
#include "webrtc/modules/video_coding/main/test/rtp_player.h"
|
||||||
#include "../source/event.h"
|
|
||||||
#include "rtp_player.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -35,12 +34,7 @@ private:
|
|||||||
|
|
||||||
int DecodeFromStorageTest(CmdArgs& args)
|
int DecodeFromStorageTest(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Make sure this test isn't executed without simulated events.
|
|
||||||
#if !defined(EVENT_DEBUG)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
// BEGIN Settings
|
// BEGIN Settings
|
||||||
|
|
||||||
bool protectionEnabled = false;
|
bool protectionEnabled = false;
|
||||||
VCMVideoProtection protectionMethod = kProtectionNack;
|
VCMVideoProtection protectionMethod = kProtectionNack;
|
||||||
WebRtc_UWord32 rttMS = 100;
|
WebRtc_UWord32 rttMS = 100;
|
||||||
@ -65,9 +59,12 @@ int DecodeFromStorageTest(CmdArgs& args)
|
|||||||
|
|
||||||
|
|
||||||
SimulatedClock clock(0);
|
SimulatedClock clock(0);
|
||||||
|
NullEventFactory event_factory;
|
||||||
// TODO(hlundin): This test was not verified after changing to FakeTickTime.
|
// TODO(hlundin): This test was not verified after changing to FakeTickTime.
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock,
|
||||||
VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2, &clock);
|
&event_factory);
|
||||||
|
VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2, &clock,
|
||||||
|
&event_factory);
|
||||||
FrameStorageCallback storageCallback(vcmPlayback);
|
FrameStorageCallback storageCallback(vcmPlayback);
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
WebRtc_Word32 ret = vcm->InitializeReceiver();
|
||||||
|
@ -8,13 +8,15 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "generic_codec_test.h"
|
#include "webrtc/modules/video_coding/main/test/generic_codec_test.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "../source/event.h"
|
|
||||||
#include "rtp_rtcp.h"
|
#include "webrtc/common_video/interface/i420_video_frame.h"
|
||||||
#include "common_video/interface/i420_video_frame.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
#include "test_macros.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
@ -23,12 +25,10 @@ enum { kMaxWaitEncTimeMs = 100 };
|
|||||||
|
|
||||||
int GenericCodecTest::RunTest(CmdArgs& args)
|
int GenericCodecTest::RunTest(CmdArgs& args)
|
||||||
{
|
{
|
||||||
#if !defined(EVENT_DEBUG)
|
|
||||||
printf("\n\nEnable debug events to run this test!\n\n");
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
SimulatedClock clock(0);
|
SimulatedClock clock(0);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
NullEventFactory event_factory;
|
||||||
|
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock,
|
||||||
|
&event_factory);
|
||||||
GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
|
GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
|
||||||
Trace::CreateTrace();
|
Trace::CreateTrace();
|
||||||
Trace::SetTraceFile(
|
Trace::SetTraceFile(
|
||||||
|
@ -8,20 +8,20 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
#include "webrtc/modules/video_coding/main/test/jitter_estimate_test.h"
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "common_types.h"
|
#include <math.h>
|
||||||
#include "../source/event.h"
|
|
||||||
#include "frame_buffer.h"
|
#include "webrtc/common_types.h"
|
||||||
#include "inter_frame_delay.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "jitter_buffer.h"
|
#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
|
||||||
#include "jitter_estimate_test.h"
|
#include "webrtc/modules/video_coding/main/source/inter_frame_delay.h"
|
||||||
#include "jitter_estimator.h"
|
#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
|
||||||
#include "media_opt_util.h"
|
#include "webrtc/modules/video_coding/main/source/jitter_estimator.h"
|
||||||
#include "packet.h"
|
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
|
||||||
#include "test_util.h"
|
#include "webrtc/modules/video_coding/main/source/packet.h"
|
||||||
#include "test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
|
||||||
// TODO(holmer): Get rid of this to conform with style guide.
|
// TODO(holmer): Get rid of this to conform with style guide.
|
||||||
@ -93,10 +93,6 @@ 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.
|
|
||||||
#if defined(EVENT_DEBUG)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
Clock* clock = Clock::GetRealTimeClock();
|
Clock* clock = Clock::GetRealTimeClock();
|
||||||
|
|
||||||
// Start test
|
// Start test
|
||||||
@ -106,7 +102,8 @@ int JitterBufferTest(CmdArgs& args)
|
|||||||
WebRtc_UWord8 data[1500];
|
WebRtc_UWord8 data[1500];
|
||||||
VCMPacket packet(data, size, seqNum, timeStamp, true);
|
VCMPacket packet(data, size, seqNum, timeStamp, true);
|
||||||
|
|
||||||
VCMJitterBuffer jb(clock, -1, -1, true);
|
NullEventFactory event_factory;
|
||||||
|
VCMJitterBuffer jb(clock, &event_factory, -1, -1, true);
|
||||||
|
|
||||||
seqNum = 1234;
|
seqNum = 1234;
|
||||||
timeStamp = 123*90;
|
timeStamp = 123*90;
|
||||||
|
@ -11,19 +11,17 @@
|
|||||||
// Implementation of Media Optimization Test
|
// Implementation of Media Optimization Test
|
||||||
// testing is done via the VCM module, no specific Media opt functionality.
|
// testing is done via the VCM module, no specific Media opt functionality.
|
||||||
|
|
||||||
#include "media_opt_test.h"
|
#include "webrtc/modules/video_coding/main/test/media_opt_test.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../source/event.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "test_util.h" // send side callback
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "testsupport/metrics/video_metrics.h"
|
#include "webrtc/test/testsupport/metrics/video_metrics.h"
|
||||||
#include "video_coding.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -32,8 +30,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);
|
||||||
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
Clock* clock = Clock::GetRealTimeClock();
|
Clock* clock = Clock::GetRealTimeClock();
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
|
||||||
MediaOptTest* mot = new MediaOptTest(vcm, clock);
|
MediaOptTest* mot = new MediaOptTest(vcm, clock);
|
||||||
if (testNum == 0)
|
if (testNum == 0)
|
||||||
{ // regular
|
{ // regular
|
||||||
|
@ -16,15 +16,14 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../source/event.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
#include "media_opt_test.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "mt_test_common.h"
|
#include "webrtc/modules/video_coding/main/test/media_opt_test.h"
|
||||||
#include "receiver_tests.h" // shared RTP state and receive side threads
|
#include "webrtc/modules/video_coding/main/test/mt_test_common.h"
|
||||||
#include "rtp_rtcp.h"
|
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||||
#include "test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "test_util.h" // send side callback
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "thread_wrapper.h"
|
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||||
#include "video_coding.h"
|
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
@ -143,12 +142,11 @@ int MTRxTxTest(CmdArgs& args)
|
|||||||
printf("Cannot read file %s.\n", outname.c_str());
|
printf("Cannot read file %s.\n", outname.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
Clock* clock = Clock::GetRealTimeClock();
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
|
|
||||||
RTPSendCompleteCallback* outgoingTransport =
|
RTPSendCompleteCallback* outgoingTransport =
|
||||||
new RTPSendCompleteCallback(clock, "dump.rtp");
|
new RTPSendCompleteCallback(Clock::GetRealTimeClock(), "dump.rtp");
|
||||||
|
|
||||||
RtpRtcp::Configuration configuration;
|
RtpRtcp::Configuration configuration;
|
||||||
configuration.id = 1;
|
configuration.id = 1;
|
||||||
|
@ -8,40 +8,36 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "normal_test.h"
|
#include "webrtc/modules/video_coding/main/test/normal_test.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "../source/event.h"
|
#include "webrtc/common_types.h"
|
||||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
#include "common_types.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "test_callbacks.h"
|
#include "webrtc/modules/video_coding/main/test/test_callbacks.h"
|
||||||
#include "test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "test_util.h"
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
#include "trace.h"
|
#include "webrtc/test/testsupport/metrics/video_metrics.h"
|
||||||
#include "testsupport/metrics/video_metrics.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
int NormalTest::RunTest(const CmdArgs& args)
|
int NormalTest::RunTest(const CmdArgs& args)
|
||||||
{
|
{
|
||||||
#if defined(EVENT_DEBUG)
|
SimulatedClock sim_clock(0);
|
||||||
printf("SIMULATION TIME\n");
|
|
||||||
SimulatedClock sim_clock;
|
|
||||||
SimulatedClock* clock = &sim_clock;
|
SimulatedClock* clock = &sim_clock;
|
||||||
#else
|
NullEventFactory event_factory;
|
||||||
printf("REAL-TIME\n");
|
|
||||||
Clock* clock = Clock::GetRealTimeClock();
|
|
||||||
#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, clock,
|
||||||
|
&event_factory);
|
||||||
NormalTest VCMNTest(vcm, clock);
|
NormalTest VCMNTest(vcm, clock);
|
||||||
VCMNTest.Perform(args);
|
VCMNTest.Perform(args);
|
||||||
VideoCodingModule::Destroy(vcm);
|
VideoCodingModule::Destroy(vcm);
|
||||||
@ -289,9 +285,6 @@ NormalTest::Perform(const CmdArgs& args)
|
|||||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||||
|
|
||||||
while (feof(_sourceFile) == 0) {
|
while (feof(_sourceFile) == 0) {
|
||||||
#if !defined(EVENT_DEBUG)
|
|
||||||
WebRtc_Word64 processStartTime = _clock->TimeInMilliseconds();
|
|
||||||
#endif
|
|
||||||
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
|
||||||
feof(_sourceFile));
|
feof(_sourceFile));
|
||||||
_frameCnt++;
|
_frameCnt++;
|
||||||
@ -331,17 +324,7 @@ NormalTest::Perform(const CmdArgs& args)
|
|||||||
WebRtc_UWord32 framePeriod =
|
WebRtc_UWord32 framePeriod =
|
||||||
static_cast<WebRtc_UWord32>(
|
static_cast<WebRtc_UWord32>(
|
||||||
1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
|
||||||
|
|
||||||
#if defined(EVENT_DEBUG)
|
|
||||||
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
|
static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
|
||||||
#else
|
|
||||||
WebRtc_Word64 timeSpent =
|
|
||||||
_clock->TimeInMilliseconds() - processStartTime;
|
|
||||||
if (timeSpent < framePeriod)
|
|
||||||
{
|
|
||||||
waitEvent->Wait(framePeriod - timeSpent);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
double endTime = clock()/(double)CLOCKS_PER_SEC;
|
double endTime = clock()/(double)CLOCKS_PER_SEC;
|
||||||
_testTotalTime = endTime - startTime;
|
_testTotalTime = endTime - startTime;
|
||||||
|
@ -8,29 +8,30 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "quality_modes_test.h"
|
#include "webrtc/modules/video_coding/main/test/quality_modes_test.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
#include "modules/video_coding/main/source/event.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#include "modules/video_coding/main/test/test_callbacks.h"
|
#include "webrtc/modules/video_coding/main/test/test_callbacks.h"
|
||||||
#include "modules/video_coding/main/test/test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "modules/video_coding/main/test/test_util.h"
|
#include "webrtc/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"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/data_log.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/data_log.h"
|
||||||
|
#include "webrtc/test/testsupport/metrics/video_metrics.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
int qualityModeTest(const CmdArgs& args)
|
int qualityModeTest(const CmdArgs& args)
|
||||||
{
|
{
|
||||||
SimulatedClock clock(0);
|
SimulatedClock clock(0);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
NullEventFactory event_factory;
|
||||||
|
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock, &event_factory);
|
||||||
QualityModesTest QMTest(vcm, &clock);
|
QualityModesTest QMTest(vcm, &clock);
|
||||||
QMTest.Perform(args);
|
QMTest.Perform(args);
|
||||||
VideoCodingModule::Destroy(vcm);
|
VideoCodingModule::Destroy(vcm);
|
||||||
|
@ -8,19 +8,18 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "receiver_tests.h"
|
|
||||||
#include "video_coding.h"
|
|
||||||
#include "trace.h"
|
|
||||||
#include "../source/event.h"
|
|
||||||
#include "../source/internal_defines.h"
|
|
||||||
#include "timing.h"
|
|
||||||
#include "test_macros.h"
|
|
||||||
#include "test_util.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/source/timing.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
float vcmFloatMax(float a, float b)
|
float vcmFloatMax(float a, float b)
|
||||||
@ -48,11 +47,6 @@ public:
|
|||||||
|
|
||||||
int ReceiverTimingTests(CmdArgs& args)
|
int ReceiverTimingTests(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Make sure this test is never executed with simulated events.
|
|
||||||
#if defined(EVENT_DEBUG)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set up trace
|
// Set up trace
|
||||||
Trace::CreateTrace();
|
Trace::CreateTrace();
|
||||||
Trace::SetTraceFile((test::OutputPath() + "receiverTestTrace.txt").c_str());
|
Trace::SetTraceFile((test::OutputPath() + "receiverTestTrace.txt").c_str());
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
|
||||||
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
|
||||||
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "module_common_types.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
#include "testsupport/fileutils.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||||
|
#include "webrtc/test/testsupport/fileutils.h"
|
||||||
|
|
||||||
enum { kMaxNackListSize = 250 };
|
enum { kMaxNackListSize = 250 };
|
||||||
enum { kMaxPacketAgeToNack = 450 };
|
enum { kMaxPacketAgeToNack = 450 };
|
||||||
@ -72,6 +74,31 @@ struct RtpPacket {
|
|||||||
WebRtc_Word64 receiveTime;
|
WebRtc_Word64 receiveTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NullEvent : public webrtc::EventWrapper {
|
||||||
|
public:
|
||||||
|
virtual ~NullEvent() {}
|
||||||
|
|
||||||
|
virtual bool Set() { return true; }
|
||||||
|
|
||||||
|
virtual bool Reset() { return true; }
|
||||||
|
|
||||||
|
virtual webrtc::EventTypeWrapper Wait(unsigned long max_time) {
|
||||||
|
return webrtc::kEventTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool StartTimer(bool periodic, unsigned long time) { return true; }
|
||||||
|
|
||||||
|
virtual bool StopTimer() { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class NullEventFactory : public webrtc::EventFactory {
|
||||||
|
public:
|
||||||
|
virtual ~NullEventFactory() {}
|
||||||
|
|
||||||
|
virtual webrtc::EventWrapper* CreateEvent() {
|
||||||
|
return new NullEvent;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Codec type conversion
|
// Codec type conversion
|
||||||
webrtc::RTPVideoCodecTypes
|
webrtc::RTPVideoCodecTypes
|
||||||
|
@ -8,24 +8,20 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "google/gflags.h"
|
|
||||||
|
|
||||||
#include "receiver_tests.h"
|
|
||||||
#include "normal_test.h"
|
|
||||||
#include "codec_database_test.h"
|
|
||||||
#include "generic_codec_test.h"
|
|
||||||
#include "../source/event.h"
|
|
||||||
#include "media_opt_test.h"
|
|
||||||
#include "quality_modes_test.h"
|
|
||||||
#include "test_util.h"
|
|
||||||
#include "webrtc/test/testsupport/fileutils.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "google/gflags.h"
|
||||||
//#include "vld.h"
|
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
|
||||||
#endif
|
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/normal_test.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/codec_database_test.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/generic_codec_test.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/media_opt_test.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/quality_modes_test.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_util.h"
|
||||||
|
#include "webrtc/test/testsupport/fileutils.h"
|
||||||
|
|
||||||
DEFINE_string(codec, "VP8", "Codec to use (VP8 or I420).");
|
DEFINE_string(codec, "VP8", "Codec to use (VP8 or I420).");
|
||||||
DEFINE_int32(width, 352, "Width in pixels of the frames in the input file.");
|
DEFINE_int32(width, 352, "Width in pixels of the frames in the input file.");
|
||||||
|
@ -8,21 +8,20 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
|
||||||
#include "receiver_tests.h"
|
|
||||||
#include "video_coding.h"
|
|
||||||
#include "rtp_rtcp.h"
|
|
||||||
#include "trace.h"
|
|
||||||
#include "../source/event.h"
|
|
||||||
#include "../source/internal_defines.h"
|
|
||||||
#include "test_macros.h"
|
|
||||||
#include "rtp_player.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.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/internal_defines.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
|
#include "webrtc/modules/video_coding/main/test/rtp_player.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
using namespace webrtc;
|
using namespace webrtc;
|
||||||
|
|
||||||
WebRtc_Word32
|
WebRtc_Word32
|
||||||
@ -112,12 +111,7 @@ std::string FrameReceiveCallback::AppendWidthHeightAndCount(
|
|||||||
|
|
||||||
int RtpPlay(CmdArgs& args)
|
int RtpPlay(CmdArgs& args)
|
||||||
{
|
{
|
||||||
// Make sure this test isn't executed without simulated events.
|
|
||||||
#if !defined(EVENT_DEBUG)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
// BEGIN Settings
|
// BEGIN Settings
|
||||||
|
|
||||||
bool protectionEnabled = true;
|
bool protectionEnabled = true;
|
||||||
VCMVideoProtection protectionMethod = kProtectionNack;
|
VCMVideoProtection protectionMethod = kProtectionNack;
|
||||||
WebRtc_UWord32 rttMS = 0;
|
WebRtc_UWord32 rttMS = 0;
|
||||||
@ -131,7 +125,9 @@ int RtpPlay(CmdArgs& args)
|
|||||||
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
|
||||||
FrameReceiveCallback receiveCallback(outFile);
|
FrameReceiveCallback receiveCallback(outFile);
|
||||||
SimulatedClock clock(0);
|
SimulatedClock clock(0);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
|
NullEventFactory event_factory;
|
||||||
|
VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock,
|
||||||
|
&event_factory);
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback, &clock);
|
RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback, &clock);
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.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/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/receiver_tests.h"
|
||||||
#include "webrtc/modules/video_coding/main/test/rtp_player.h"
|
#include "webrtc/modules/video_coding/main/test/rtp_player.h"
|
||||||
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
#include "webrtc/modules/video_coding/main/test/test_macros.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
|
#include "webrtc/system_wrappers/interface/event_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
@ -61,13 +61,7 @@ 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.
|
|
||||||
#if defined(EVENT_DEBUG)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// BEGIN Settings
|
// BEGIN Settings
|
||||||
|
|
||||||
bool protectionEnabled = true;
|
bool protectionEnabled = true;
|
||||||
VCMVideoProtection protection = kProtectionDualDecoder;
|
VCMVideoProtection protection = kProtectionDualDecoder;
|
||||||
WebRtc_UWord8 rttMS = 50;
|
WebRtc_UWord8 rttMS = 50;
|
||||||
@ -83,8 +77,7 @@ int RtpPlayMT(CmdArgs& args, int releaseTestNo, webrtc::VideoCodecType releaseTe
|
|||||||
(protection == kProtectionDualDecoder ||
|
(protection == kProtectionDualDecoder ||
|
||||||
protection == kProtectionNack ||
|
protection == kProtectionNack ||
|
||||||
kProtectionNackFEC));
|
kProtectionNackFEC));
|
||||||
Clock* clock = Clock::GetRealTimeClock();
|
VideoCodingModule* vcm = VideoCodingModule::Create(1);
|
||||||
VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
|
|
||||||
RtpDataCallback dataCallback(vcm);
|
RtpDataCallback dataCallback(vcm);
|
||||||
std::string rtpFilename;
|
std::string rtpFilename;
|
||||||
rtpFilename = args.inputFile;
|
rtpFilename = args.inputFile;
|
||||||
@ -137,7 +130,8 @@ 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,
|
||||||
|
Clock::GetRealTimeClock());
|
||||||
PayloadTypeList payloadTypes;
|
PayloadTypeList payloadTypes;
|
||||||
payloadTypes.push_front(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8",
|
payloadTypes.push_front(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8",
|
||||||
kVideoCodecVP8));
|
kVideoCodecVP8));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user