Cleaned up logging in video_coding.
Converted all calls to WEBRTC_TRACE to LOG(). Also removed a large number of less useful logs.
BUG=3153
R=mflodman@webrtc.org, pbos@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/11169004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5887 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/modules/utility/source/file_player_impl.cc b/modules/utility/source/file_player_impl.cc
index 23a928f..8049245 100644
--- a/modules/utility/source/file_player_impl.cc
+++ b/modules/utility/source/file_player_impl.cc
@@ -417,7 +417,7 @@
VideoFilePlayerImpl::VideoFilePlayerImpl(uint32_t instanceID,
FileFormats fileFormat)
: FilePlayerImpl(instanceID, fileFormat),
- video_decoder_(new VideoCoder(instanceID)),
+ video_decoder_(new VideoCoder()),
video_codec_info_(),
_decodedVideoFrames(0),
_encodedData(*new EncodedVideoData()),
@@ -481,7 +481,7 @@
CriticalSectionScoped lock( _critSec);
_decodedVideoFrames = 0;
- video_decoder_.reset(new VideoCoder(_instanceID));
+ video_decoder_.reset(new VideoCoder());
return FilePlayerImpl::StopPlayingFile();
}
diff --git a/modules/utility/source/file_recorder_impl.cc b/modules/utility/source/file_recorder_impl.cc
index 8f1b69c..264b867 100644
--- a/modules/utility/source/file_recorder_impl.cc
+++ b/modules/utility/source/file_recorder_impl.cc
@@ -328,7 +328,7 @@
_writtenAudioMS(0),
_writtenVideoMS(0)
{
- _videoEncoder = new VideoCoder(instanceID);
+ _videoEncoder = new VideoCoder();
_frameScaler = new FrameScaler();
_videoFramesQueue = new VideoFramesQueue();
_thread = ThreadWrapper::CreateThread(Run, this, kNormalPriority,
diff --git a/modules/utility/source/video_coder.cc b/modules/utility/source/video_coder.cc
index 267ed81..5096ace 100644
--- a/modules/utility/source/video_coder.cc
+++ b/modules/utility/source/video_coder.cc
@@ -13,10 +13,7 @@
#include "webrtc/modules/utility/source/video_coder.h"
namespace webrtc {
-VideoCoder::VideoCoder(uint32_t instanceID)
- : _vcm(VideoCodingModule::Create(instanceID)),
- _decodedVideo(0)
-{
+VideoCoder::VideoCoder() : _vcm(VideoCodingModule::Create()), _decodedVideo(0) {
_vcm->InitializeSender();
_vcm->InitializeReceiver();
diff --git a/modules/utility/source/video_coder.h b/modules/utility/source/video_coder.h
index cb8bfa5..8e4344b 100644
--- a/modules/utility/source/video_coder.h
+++ b/modules/utility/source/video_coder.h
@@ -20,7 +20,7 @@
class VideoCoder : public VCMPacketizationCallback, public VCMReceiveCallback
{
public:
- VideoCoder(uint32_t instanceID);
+ VideoCoder();
~VideoCoder();
int32_t SetEncodeCodec(VideoCodec& videoCodecInst,
diff --git a/modules/video_coding/main/interface/video_coding.h b/modules/video_coding/main/interface/video_coding.h
index c016676..cad0e5a 100644
--- a/modules/video_coding/main/interface/video_coding.h
+++ b/modules/video_coding/main/interface/video_coding.h
@@ -72,11 +72,9 @@
kReferenceSelection
};
- static VideoCodingModule* Create(const int32_t id);
+ static VideoCodingModule* Create();
- static VideoCodingModule* Create(const int32_t id,
- Clock* clock,
- EventFactory* event_factory);
+ static VideoCodingModule* Create(Clock* clock, EventFactory* event_factory);
static void Destroy(VideoCodingModule* module);
diff --git a/modules/video_coding/main/source/codec_database.cc b/modules/video_coding/main/source/codec_database.cc
index 3ff8c76..904fa5d 100644
--- a/modules/video_coding/main/source/codec_database.cc
+++ b/modules/video_coding/main/source/codec_database.cc
@@ -20,7 +20,7 @@
#include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
#endif
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
-#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
@@ -42,9 +42,8 @@
internal_render_timing(internal_render_timing) {
}
-VCMCodecDataBase::VCMCodecDataBase(int id)
- : id_(id),
- number_of_cores_(0),
+VCMCodecDataBase::VCMCodecDataBase()
+ : number_of_cores_(0),
max_payload_size_(kDefaultPayloadSize),
periodic_key_frames_(false),
pending_encoder_reset_(true),
@@ -58,8 +57,7 @@
ptr_decoder_(NULL),
current_dec_is_external_(false),
dec_map_(),
- dec_external_map_() {
-}
+ dec_external_map_() {}
VCMCodecDataBase::~VCMCodecDataBase() {
ResetSender();
@@ -221,24 +219,14 @@
} else {
ptr_encoder_ = CreateEncoder(send_codec->codecType);
current_enc_is_external_ = false;
+ if (!ptr_encoder_) {
+ return false;
+ }
}
encoded_frame_callback->SetPayloadType(send_codec->plType);
- if (!ptr_encoder_) {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(id_),
- "Failed to create encoder: %s.",
- send_codec->plName);
- return false;
- }
if (ptr_encoder_->InitEncode(send_codec,
number_of_cores_,
max_payload_size_) < 0) {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(id_),
- "Failed to initialize encoder: %s.",
- send_codec->plName);
DeleteEncoder();
return false;
} else if (ptr_encoder_->RegisterEncodeCallback(encoded_frame_callback) < 0) {
@@ -257,8 +245,6 @@
}
bool VCMCodecDataBase::SendCodec(VideoCodec* current_send_codec) const {
- WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideoCoding, VCMId(id_),
- "SendCodec");
if (!ptr_encoder_) {
return false;
}
@@ -267,8 +253,6 @@
}
VideoCodecType VCMCodecDataBase::SendCodec() const {
- WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideoCoding, VCMId(id_),
- "SendCodec type");
if (!ptr_encoder_) {
return kVideoCodecUnknown;
}
@@ -437,12 +421,6 @@
if (number_of_cores < 0) {
return false;
}
- WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideoCoding, VCMId(id_),
- "Codec: %s, Payload type %d, Height %d, Width %d, Bitrate %d,"
- "Framerate %d.",
- receive_codec->plName, receive_codec->plType,
- receive_codec->height, receive_codec->width,
- receive_codec->startBitrate, receive_codec->maxFramerate);
// Check if payload value already exists, if so - erase old and insert new.
DeregisterReceiveCodec(receive_codec->plType);
if (receive_codec->codecType == kVideoCodecUnknown) {
@@ -524,7 +502,7 @@
if (!decoder_copy) {
return NULL;
}
- return new VCMGenericDecoder(*decoder_copy, id_, ptr_decoder_->External());
+ return new VCMGenericDecoder(*decoder_copy, ptr_decoder_->External());
}
void VCMCodecDataBase::ReleaseDecoder(VCMGenericDecoder* decoder) const {
@@ -543,8 +521,7 @@
if (decoder_copy) {
VCMDecodedFrameCallback* cb = ptr_decoder_->_callback;
ReleaseDecoder(ptr_decoder_);
- ptr_decoder_ = new VCMGenericDecoder(*decoder_copy, id_,
- decoder.External());
+ ptr_decoder_ = new VCMGenericDecoder(*decoder_copy, decoder.External());
if (cb && ptr_decoder_->RegisterDecodeCompleteCallback(cb)) {
assert(false);
}
@@ -569,8 +546,8 @@
assert(new_codec);
const VCMDecoderMapItem* decoder_item = FindDecoderItem(payload_type);
if (!decoder_item) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding, VCMId(id_),
- "Unknown payload type: %u", payload_type);
+ LOG(LS_ERROR) << "Can't find a decoder associated with payload type: "
+ << payload_type;
return NULL;
}
VCMGenericDecoder* ptr_decoder = NULL;
@@ -579,7 +556,7 @@
if (external_dec_item) {
// External codec.
ptr_decoder = new VCMGenericDecoder(
- *external_dec_item->external_decoder_instance, id_, true);
+ *external_dec_item->external_decoder_instance, true);
*external = true;
} else {
// Create decoder.
@@ -611,6 +588,7 @@
return new VCMGenericEncoder(*(new I420Encoder));
#endif
default:
+ LOG(LS_WARNING) << "No internal encoder of this type exists.";
return NULL;
}
}
@@ -630,11 +608,11 @@
switch (type) {
#ifdef VIDEOCODEC_VP8
case kVideoCodecVP8:
- return new VCMGenericDecoder(*(VP8Decoder::Create()), id_);
+ return new VCMGenericDecoder(*(VP8Decoder::Create()));
#endif
#ifdef VIDEOCODEC_I420
case kVideoCodecI420:
- return new VCMGenericDecoder(*(new I420Decoder), id_);
+ return new VCMGenericDecoder(*(new I420Decoder));
#endif
default:
return NULL;
diff --git a/modules/video_coding/main/source/codec_database.h b/modules/video_coding/main/source/codec_database.h
index 2a28ed4..f27218f 100644
--- a/modules/video_coding/main/source/codec_database.h
+++ b/modules/video_coding/main/source/codec_database.h
@@ -50,7 +50,7 @@
class VCMCodecDataBase {
public:
- explicit VCMCodecDataBase(int id);
+ VCMCodecDataBase();
~VCMCodecDataBase();
// Sender Side
@@ -174,7 +174,6 @@
const VCMExtDecoderMapItem* FindExternalDecoderItem(
uint8_t payload_type) const;
- int id_;
int number_of_cores_;
int max_payload_size_;
bool periodic_key_frames_;
diff --git a/modules/video_coding/main/source/encoded_frame.cc b/modules/video_coding/main/source/encoded_frame.cc
index 6760762..3ccf0b0 100644
--- a/modules/video_coding/main/source/encoded_frame.cc
+++ b/modules/video_coding/main/source/encoded_frame.cc
@@ -149,17 +149,12 @@
return &_fragmentation;
}
-int32_t
-VCMEncodedFrame::VerifyAndAllocate(const uint32_t minimumSize)
+void VCMEncodedFrame::VerifyAndAllocate(const uint32_t minimumSize)
{
if(minimumSize > _size)
{
// create buffer of sufficient size
uint8_t* newBuffer = new uint8_t[minimumSize];
- if (newBuffer == NULL)
- {
- return -1;
- }
if(_buffer)
{
// copy old data
@@ -169,7 +164,6 @@
_buffer = newBuffer;
_size = minimumSize;
}
- return 0;
}
webrtc::FrameType VCMEncodedFrame::ConvertFrameType(VideoFrameType frameType)
diff --git a/modules/video_coding/main/source/encoded_frame.h b/modules/video_coding/main/source/encoded_frame.h
index 3e73be5..dd0f843 100644
--- a/modules/video_coding/main/source/encoded_frame.h
+++ b/modules/video_coding/main/source/encoded_frame.h
@@ -104,7 +104,7 @@
* is copied to the new buffer.
* Buffer size is updated to minimumSize.
*/
- int32_t VerifyAndAllocate(const uint32_t minimumSize);
+ void VerifyAndAllocate(const uint32_t minimumSize);
void Reset();
diff --git a/modules/video_coding/main/source/frame_buffer.cc b/modules/video_coding/main/source/frame_buffer.cc
index 531c7ac..97e0722 100644
--- a/modules/video_coding/main/source/frame_buffer.cc
+++ b/modules/video_coding/main/source/frame_buffer.cc
@@ -14,6 +14,7 @@
#include <string.h>
#include "webrtc/modules/video_coding/main/source/packet.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
@@ -86,20 +87,7 @@
int64_t timeInMs,
VCMDecodeErrorMode decode_error_mode,
const FrameData& frame_data) {
- // Is this packet part of this frame?
- if (TimeStamp() && (TimeStamp() != packet.timestamp)) {
- return kTimeStampError;
- }
-
- // sanity checks
- if (_size + packet.sizeBytes +
- (packet.insertStartCode ? kH264StartCodeLengthBytes : 0 )
- > kMaxJBFrameSizeBytes) {
- return kSizeError;
- }
- if (NULL == packet.dataPtr && packet.sizeBytes > 0) {
- return kSizeError;
- }
+ assert(!(NULL == packet.dataPtr && packet.sizeBytes > 0));
if (packet.dataPtr != NULL) {
_payloadType = packet.payloadType;
}
@@ -126,11 +114,11 @@
const uint32_t newSize = _size +
increments * kBufferIncStepSizeBytes;
if (newSize > kMaxJBFrameSizeBytes) {
+ LOG(LS_ERROR) << "Failed to insert packet due to frame being too "
+ "big.";
return kSizeError;
}
- if (VerifyAndAllocate(newSize) == -1) {
- return kSizeError;
- }
+ VerifyAndAllocate(newSize);
_sessionInfo.UpdateDataPointers(prevBuffer, _buffer);
}
diff --git a/modules/video_coding/main/source/generic_decoder.cc b/modules/video_coding/main/source/generic_decoder.cc
index 50b1eda..07663e1 100644
--- a/modules/video_coding/main/source/generic_decoder.cc
+++ b/modules/video_coding/main/source/generic_decoder.cc
@@ -12,8 +12,7 @@
#include "webrtc/modules/video_coding/main/source/generic_decoder.h"
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
#include "webrtc/system_wrappers/interface/clock.h"
-#include "webrtc/system_wrappers/interface/trace.h"
-#include "webrtc/system_wrappers/interface/trace_event.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
@@ -59,11 +58,7 @@
_timestampMap.Pop(decodedImage.timestamp()));
callback = _receiveCallback;
}
- if (frameInfo == NULL)
- {
- // The map should never be empty or full if this callback is called.
- return WEBRTC_VIDEO_CODEC_ERROR;
- }
+ assert(frameInfo != NULL);
_timing.StopDecodeTimer(
decodedImage.timestamp(),
@@ -73,14 +68,7 @@
if (callback != NULL)
{
decodedImage.set_render_time_ms(frameInfo->renderTimeMs);
- int32_t callbackReturn = callback->FrameToRender(decodedImage);
- if (callbackReturn < 0)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug,
- webrtc::kTraceVideoCoding,
- -1,
- "Render callback returned error: %d", callbackReturn);
- }
+ callback->FrameToRender(decodedImage);
}
return WEBRTC_VIDEO_CODEC_OK;
}
@@ -125,15 +113,15 @@
return VCM_OK;
}
-VCMGenericDecoder::VCMGenericDecoder(VideoDecoder& decoder, int32_t id, bool isExternal)
+VCMGenericDecoder::VCMGenericDecoder(VideoDecoder& decoder, bool isExternal)
:
-_id(id),
_callback(NULL),
_frameInfos(),
_nextFrameInfoIdx(0),
_decoder(decoder),
_codecType(kVideoCodecUnknown),
-_isExternal(isExternal)
+_isExternal(isExternal),
+_keyFrameDecoded(false)
{
}
@@ -156,11 +144,6 @@
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
_callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]);
- WEBRTC_TRACE(webrtc::kTraceDebug,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Decoding timestamp %u", frame.TimeStamp());
-
_nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength;
int32_t ret = _decoder.Decode(frame.EncodedImage(),
frame.MissingFrame(),
@@ -170,7 +153,8 @@
if (ret < WEBRTC_VIDEO_CODEC_OK)
{
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding, VCMId(_id), "Decoder error: %d\n", ret);
+ LOG(LS_WARNING) << "Failed to decode frame with timestamp "
+ << frame.TimeStamp() << ", error code: " << ret;
_callback->Pop(frame.TimeStamp());
return ret;
}
diff --git a/modules/video_coding/main/source/generic_decoder.h b/modules/video_coding/main/source/generic_decoder.h
index e1993fb..846d4d3 100644
--- a/modules/video_coding/main/source/generic_decoder.h
+++ b/modules/video_coding/main/source/generic_decoder.h
@@ -63,7 +63,7 @@
{
friend class VCMCodecDataBase;
public:
- VCMGenericDecoder(VideoDecoder& decoder, int32_t id = 0, bool isExternal = false);
+ VCMGenericDecoder(VideoDecoder& decoder, bool isExternal = false);
~VCMGenericDecoder();
/**
@@ -105,17 +105,14 @@
bool External() const;
-protected:
-
- int32_t _id;
+private:
VCMDecodedFrameCallback* _callback;
VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength];
- uint32_t _nextFrameInfoIdx;
+ uint32_t _nextFrameInfoIdx;
VideoDecoder& _decoder;
VideoCodecType _codecType;
bool _isExternal;
bool _keyFrameDecoded;
-
};
} // namespace webrtc
diff --git a/modules/video_coding/main/source/generic_encoder.cc b/modules/video_coding/main/source/generic_encoder.cc
index 68296fc..6fb2c9f 100644
--- a/modules/video_coding/main/source/generic_encoder.cc
+++ b/modules/video_coding/main/source/generic_encoder.cc
@@ -13,6 +13,7 @@
#include "webrtc/modules/video_coding/main/source/generic_encoder.h"
#include "webrtc/modules/video_coding/main/source/media_optimization.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
namespace {
@@ -83,7 +84,12 @@
_bitRate = settings->startBitrate * 1000;
_frameRate = settings->maxFramerate;
_codecType = settings->codecType;
- return _encoder.InitEncode(settings, numberOfCores, maxPayloadSize);
+ if (_encoder.InitEncode(settings, numberOfCores, maxPayloadSize) != 0) {
+ LOG(LS_ERROR) << "Failed to initialize the encoder associated with "
+ "payload name: " << settings->plName;
+ return -1;
+ }
+ return 0;
}
int32_t
diff --git a/modules/video_coding/main/source/jitter_buffer.cc b/modules/video_coding/main/source/jitter_buffer.cc
index f11f81b..6f0a333 100644
--- a/modules/video_coding/main/source/jitter_buffer.cc
+++ b/modules/video_coding/main/source/jitter_buffer.cc
@@ -25,7 +25,6 @@
#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/trace.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
@@ -77,10 +76,6 @@
FrameList::iterator it = begin();
while (!empty()) {
// Throw at least one frame.
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding, -1,
- "Recycling: type=%s, low seqnum=%u",
- it->second->FrameType() == kVideoFrameKey ?
- "key" : "delta", it->second->GetLowSeqNum());
it->second->Reset();
free_frames->push_back(it->second);
erase(it++);
@@ -128,16 +123,10 @@
}
VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
- EventFactory* event_factory,
- int vcm_id,
- int receiver_id,
- bool master)
- : vcm_id_(vcm_id),
- receiver_id_(receiver_id),
- clock_(clock),
+ EventFactory* event_factory)
+ : clock_(clock),
running_(false),
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
- master_(master),
frame_event_(event_factory->CreateEvent()),
packet_event_(event_factory->CreateEvent()),
max_number_of_frames_(kStartNumberOfFrames),
@@ -156,7 +145,7 @@
num_consecutive_old_frames_(0),
num_consecutive_old_packets_(0),
num_discarded_packets_(0),
- jitter_estimate_(vcm_id, receiver_id),
+ jitter_estimate_(),
inter_frame_delay_(clock_->TimeInMilliseconds()),
rtt_ms_(kDefaultRtt),
nack_mode_(kNoNack),
@@ -192,10 +181,7 @@
if (this != &rhs) {
crit_sect_->Enter();
rhs.crit_sect_->Enter();
- vcm_id_ = rhs.vcm_id_;
- receiver_id_ = rhs.receiver_id_;
running_ = rhs.running_;
- master_ = !rhs.master_;
max_number_of_frames_ = rhs.max_number_of_frames_;
incoming_frame_rate_ = rhs.incoming_frame_rate_;
incoming_frame_count_ = rhs.incoming_frame_count_;
@@ -276,10 +262,6 @@
first_packet_since_reset_ = true;
rtt_ms_ = kDefaultRtt;
last_decoded_state_.Reset();
-
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_), "JB(0x%x): Jitter buffer: start",
- this);
}
void VCMJitterBuffer::Stop() {
@@ -300,9 +282,6 @@
// Make sure we wake up any threads waiting on these events.
frame_event_->Set();
packet_event_->Set();
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_), "JB(0x%x): Jitter buffer: stop",
- this);
}
bool VCMJitterBuffer::Running() const {
@@ -327,9 +306,6 @@
waiting_for_completion_.latest_packet_time = -1;
first_packet_since_reset_ = true;
missing_sequence_numbers_.clear();
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_), "JB(0x%x): Jitter buffer: flush",
- this);
}
// Get received key and delta frames
@@ -583,6 +559,8 @@
DropPacketsFromNackList(last_decoded_state_.sequence_num());
if (num_consecutive_old_packets_ > kMaxConsecutiveOldPackets) {
+ LOG(LS_WARNING) << num_consecutive_old_packets_ << " consecutive old "
+ "packets received. Flushing the jitter buffer.";
Flush();
return kFlushIndicator;
}
@@ -602,13 +580,13 @@
VCMFrameBufferEnum ret = kNoError;
if (!*frame) {
// No free frame! Try to reclaim some...
- LOG_F(LS_INFO) << "Unable to get empty frame; Recycling.";
+ LOG(LS_WARNING) << "Unable to get empty frame; Recycling.";
bool found_key_frame = RecycleFramesUntilKeyFrame();
*frame = GetEmptyFrame();
- if (!*frame)
- return kGeneralError;
- else if (!found_key_frame)
+ assert(*frame);
+ if (!found_key_frame) {
ret = kFlushIndicator;
+ }
}
(*frame)->Reset();
return ret;
@@ -650,6 +628,8 @@
// Flush if this happens consistently.
num_consecutive_old_frames_++;
if (num_consecutive_old_frames_ > kMaxConsecutiveOldFrames) {
+ LOG(LS_WARNING) << num_consecutive_old_packets_ << " consecutive old "
+ "frames received. Flushing the jitter buffer.";
Flush();
return kFlushIndicator;
}
@@ -703,7 +683,6 @@
frame->IncrementNackCount();
}
if (!UpdateNackList(packet.seqNum)) {
- LOG_F(LS_INFO) << "Requesting key frame due to flushed NACK list.";
buffer_return = kFlushIndicator;
}
latest_received_sequence_number_ = LatestSequenceNumber(
@@ -725,15 +704,6 @@
}
case kCompleteSession: {
if (update_decodable_list) {
- if (master_) {
- // Only trace the primary jitter buffer to make it possible to parse
- // and plot the trace file.
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "JB(0x%x) FB(0x%x): Complete frame added to jitter"
- "buffer, size:%d type %d",
- this, frame, frame->Length(), frame->FrameType());
- }
CountFrame(*frame);
frame->SetCountedFrame(true);
if (continuous) {
@@ -960,8 +930,6 @@
incomplete_frames_.begin(), incomplete_frames_.end(),
HasNonEmptyState);
}
- if (have_non_empty_frame)
- LOG_F(LS_INFO) << "First frame is not key; Recycling.";
bool found_key_frame = RecycleFramesUntilKeyFrame();
if (!found_key_frame) {
*request_key_frame = have_non_empty_frame;
@@ -977,9 +945,9 @@
int non_continuous_incomplete_duration =
NonContinuousOrIncompleteDuration();
if (non_continuous_incomplete_duration > 90 * max_incomplete_time_ms_) {
- LOG_F(LS_INFO) << "Too long non-decodable duration: " <<
- non_continuous_incomplete_duration << " > " <<
- 90 * max_incomplete_time_ms_;
+ LOG_F(LS_WARNING) << "Too long non-decodable duration: "
+ << non_continuous_incomplete_duration << " > "
+ << 90 * max_incomplete_time_ms_;
FrameList::reverse_iterator rit = find_if(incomplete_frames_.rbegin(),
incomplete_frames_.rend(), IsKeyFrame);
if (rit == incomplete_frames_.rend()) {
@@ -1038,10 +1006,12 @@
TRACE_EVENT_INSTANT1("webrtc", "AddNack", "seqnum", i);
}
if (TooLargeNackList() && !HandleTooLargeNackList()) {
+ LOG(LS_WARNING) << "Requesting key frame due to too large NACK list.";
return false;
}
if (MissingTooOldPacket(sequence_number) &&
!HandleTooOldPackets(sequence_number)) {
+ LOG(LS_WARNING) << "Requesting key frame due to missing too old packets";
return false;
}
} else {
@@ -1058,8 +1028,9 @@
bool VCMJitterBuffer::HandleTooLargeNackList() {
// Recycle frames until the NACK list is small enough. It is likely cheaper to
// request a key frame than to retransmit this many missing packets.
- LOG_F(LS_INFO) << "NACK list has grown too large: " <<
- missing_sequence_numbers_.size() << " > " << max_nack_list_size_;
+ LOG_F(LS_WARNING) << "NACK list has grown too large: "
+ << missing_sequence_numbers_.size() << " > "
+ << max_nack_list_size_;
bool key_frame_found = false;
while (TooLargeNackList()) {
key_frame_found = RecycleFramesUntilKeyFrame();
@@ -1083,8 +1054,9 @@
bool key_frame_found = false;
const uint16_t age_of_oldest_missing_packet = latest_sequence_number -
*missing_sequence_numbers_.begin();
- LOG_F(LS_INFO) << "NACK list contains too old sequence numbers: " <<
- age_of_oldest_missing_packet << " > " << max_packet_age_to_nack_;
+ LOG_F(LS_WARNING) << "NACK list contains too old sequence numbers: "
+ << age_of_oldest_missing_packet << " > "
+ << max_packet_age_to_nack_;
while (MissingTooOldPacket(latest_sequence_number)) {
key_frame_found = RecycleFramesUntilKeyFrame();
}
@@ -1136,10 +1108,6 @@
frame_buffers_[max_number_of_frames_] = new_frame;
free_frames_.push_back(new_frame);
++max_number_of_frames_;
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "JB(0x%x) FB(0x%x): Jitter buffer increased to:%d frames",
- this, new_frame, max_number_of_frames_);
TRACE_COUNTER1("webrtc", "JBMaxFrames", max_number_of_frames_);
return true;
}
@@ -1161,13 +1129,9 @@
key_frame_found = key_frame_it != decodable_frames_.end();
}
drop_count_ += dropped_frames;
- if (dropped_frames) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "Jitter buffer drop count:%u", drop_count_);
- }
TRACE_EVENT_INSTANT0("webrtc", "JB::RecycleFramesUntilKeyFrame");
if (key_frame_found) {
+ LOG(LS_INFO) << "Found key frame while dropping frames.";
// Reset last decoded state to make sure the next frame decoded is a key
// frame, and start NACKing from here.
last_decoded_state_.Reset();
@@ -1246,19 +1210,6 @@
if (sample.latest_packet_time == -1) {
return;
}
- if (incomplete_frame) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_), "Received incomplete frame "
- "timestamp %u frame size %u at time %u",
- sample.timestamp, sample.frame_size,
- MaskWord64ToUWord32(sample.latest_packet_time));
- } else {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_), "Received complete frame "
- "timestamp %u frame size %u at time %u",
- sample.timestamp, sample.frame_size,
- MaskWord64ToUWord32(sample.latest_packet_time));
- }
UpdateJitterEstimate(sample.latest_packet_time, sample.timestamp,
sample.frame_size, incomplete_frame);
}
@@ -1273,23 +1224,6 @@
}
// No retransmitted frames should be a part of the jitter
// estimate.
- if (incomplete_frame) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "Received incomplete frame timestamp %u frame type %d "
- "frame size %u at time %u, jitter estimate was %u",
- frame.TimeStamp(), frame.FrameType(), frame.Length(),
- MaskWord64ToUWord32(frame.LatestPacketTimeMs()),
- EstimatedJitterMs());
- } else {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_), "Received complete frame "
- "timestamp %u frame type %d frame size %u at time %u, "
- "jitter estimate was %u",
- frame.TimeStamp(), frame.FrameType(), frame.Length(),
- MaskWord64ToUWord32(frame.LatestPacketTimeMs()),
- EstimatedJitterMs());
- }
UpdateJitterEstimate(frame.LatestPacketTimeMs(), frame.TimeStamp(),
frame.Length(), incomplete_frame);
}
@@ -1306,12 +1240,6 @@
return;
}
int64_t frame_delay;
- // Calculate the delay estimate
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "Packet received and sent to jitter estimate with: "
- "timestamp=%u wall_clock=%u", timestamp,
- MaskWord64ToUWord32(latest_packet_time_ms));
bool not_reordered = inter_frame_delay_.CalculateDelay(timestamp,
&frame_delay,
latest_packet_time_ms);
diff --git a/modules/video_coding/main/source/jitter_buffer.h b/modules/video_coding/main/source/jitter_buffer.h
index 8586f11..1e0a44a 100644
--- a/modules/video_coding/main/source/jitter_buffer.h
+++ b/modules/video_coding/main/source/jitter_buffer.h
@@ -77,10 +77,7 @@
class VCMJitterBuffer {
public:
VCMJitterBuffer(Clock* clock,
- EventFactory* event_factory,
- int vcm_id,
- int receiver_id,
- bool master);
+ EventFactory* event_factory);
virtual ~VCMJitterBuffer();
// Makes |this| a deep copy of |rhs|.
@@ -274,13 +271,10 @@
uint16_t EstimatedLowSequenceNumber(const VCMFrameBuffer& frame) const;
- int vcm_id_;
- int receiver_id_;
Clock* clock_;
// If we are running (have started) or not.
bool running_;
CriticalSectionWrapper* crit_sect_;
- bool master_;
// Event to signal when we have a frame ready for decoder.
scoped_ptr<EventWrapper> frame_event_;
// Event to signal when we have received a packet.
diff --git a/modules/video_coding/main/source/jitter_buffer_unittest.cc b/modules/video_coding/main/source/jitter_buffer_unittest.cc
index e535a8a..cbe091a 100644
--- a/modules/video_coding/main/source/jitter_buffer_unittest.cc
+++ b/modules/video_coding/main/source/jitter_buffer_unittest.cc
@@ -27,8 +27,8 @@
protected:
virtual void SetUp() {
clock_.reset(new SimulatedClock(0));
- jitter_buffer_.reset(new VCMJitterBuffer(clock_.get(),
- &event_factory_, -1, -1, true));
+ jitter_buffer_.reset(
+ new VCMJitterBuffer(clock_.get(), &event_factory_));
jitter_buffer_->Start();
seq_num_ = 1234;
timestamp_ = 0;
@@ -126,8 +126,7 @@
clock_.reset(new SimulatedClock(0));
max_nack_list_size_ = 150;
oldest_packet_to_nack_ = 250;
- jitter_buffer_ = new VCMJitterBuffer(clock_.get(), &event_factory_, -1, -1,
- true);
+ jitter_buffer_ = new VCMJitterBuffer(clock_.get(), &event_factory_);
stream_generator_ = new StreamGenerator(0, 0, clock_->TimeInMilliseconds());
jitter_buffer_->Start();
jitter_buffer_->SetNackSettings(max_nack_list_size_,
diff --git a/modules/video_coding/main/source/jitter_estimator.cc b/modules/video_coding/main/source/jitter_estimator.cc
index 083a9e6..71c54a0 100644
--- a/modules/video_coding/main/source/jitter_estimator.cc
+++ b/modules/video_coding/main/source/jitter_estimator.cc
@@ -11,7 +11,6 @@
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
#include "webrtc/modules/video_coding/main/source/jitter_estimator.h"
#include "webrtc/modules/video_coding/main/source/rtt_filter.h"
-#include "webrtc/system_wrappers/interface/trace.h"
#include <assert.h>
#include <math.h>
@@ -20,20 +19,20 @@
namespace webrtc {
-VCMJitterEstimator::VCMJitterEstimator(int32_t vcmId, int32_t receiverId) :
-_vcmId(vcmId),
-_receiverId(receiverId),
-_phi(0.97),
-_psi(0.9999),
-_alphaCountMax(400),
-_thetaLow(0.000001),
-_nackLimit(3),
-_numStdDevDelayOutlier(15),
-_numStdDevFrameSizeOutlier(3),
-_noiseStdDevs(2.33), // ~Less than 1% chance
- // (look up in normal distribution table)...
-_noiseStdDevOffset(30.0), // ...of getting 30 ms freezes
-_rttFilter(vcmId, receiverId) {
+VCMJitterEstimator::VCMJitterEstimator(int32_t vcmId, int32_t receiverId)
+ : _vcmId(vcmId),
+ _receiverId(receiverId),
+ _phi(0.97),
+ _psi(0.9999),
+ _alphaCountMax(400),
+ _thetaLow(0.000001),
+ _nackLimit(3),
+ _numStdDevDelayOutlier(15),
+ _numStdDevFrameSizeOutlier(3),
+ _noiseStdDevs(2.33), // ~Less than 1% chance
+ // (look up in normal distribution table)...
+ _noiseStdDevOffset(30.0), // ...of getting 30 ms freezes
+ _rttFilter() {
Reset();
}
@@ -108,10 +107,6 @@
VCMJitterEstimator::UpdateEstimate(int64_t frameDelayMS, uint32_t frameSizeBytes,
bool incompleteFrame /* = false */)
{
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(_vcmId, _receiverId),
- "Jitter estimate updated with: frameSize=%d frameDelayMS=%d",
- frameSizeBytes, frameDelayMS);
if (frameSizeBytes == 0)
{
return;
@@ -195,16 +190,6 @@
{
_startupCount++;
}
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "Framesize statistics: max=%f average=%f", _maxFrameSize, _avgFrameSize);
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "The estimated slope is: theta=(%f, %f)", _theta[0], _theta[1]);
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "Random jitter: mean=%f variance=%f", _avgNoise, _varNoise);
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "Current jitter estimate: %f", _filterJitterEstimate);
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "Current max RTT: %u", _rttFilter.RttMs());
}
// Updates the nack/packet ratio
diff --git a/modules/video_coding/main/source/media_optimization.cc b/modules/video_coding/main/source/media_optimization.cc
index aeffac2..4dc7225 100644
--- a/modules/video_coding/main/source/media_optimization.cc
+++ b/modules/video_coding/main/source/media_optimization.cc
@@ -14,6 +14,7 @@
#include "webrtc/modules/video_coding/main/source/qm_select.h"
#include "webrtc/modules/video_coding/utility/include/frame_dropper.h"
#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
namespace media_optimization {
@@ -73,9 +74,8 @@
int64_t time_complete_ms;
};
-MediaOptimization::MediaOptimization(int32_t id, Clock* clock)
- : id_(id),
- clock_(clock),
+MediaOptimization::MediaOptimization(Clock* clock)
+ : clock_(clock),
max_bit_rate_(0),
send_codec_type_(kVideoCodecUnknown),
codec_width_(0),
@@ -537,13 +537,9 @@
codec_height_ = qm->codec_height;
}
- WEBRTC_TRACE(webrtc::kTraceDebug,
- webrtc::kTraceVideoCoding,
- id_,
- "Resolution change from QM select: W = %d, H = %d, FR = %f",
- qm->codec_width,
- qm->codec_height,
- qm->frame_rate);
+ LOG(LS_INFO) << "Media optimizer requests the video resolution to be changed "
+ "to " << qm->codec_width << "x" << qm->codec_height << "@"
+ << qm->frame_rate;
// Update VPM with new target frame rate and frame size.
// Note: use |qm->frame_rate| instead of |_incoming_frame_rate| for updating
diff --git a/modules/video_coding/main/source/media_optimization.h b/modules/video_coding/main/source/media_optimization.h
index 3c3c8e4..35a4971 100644
--- a/modules/video_coding/main/source/media_optimization.h
+++ b/modules/video_coding/main/source/media_optimization.h
@@ -18,7 +18,6 @@
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
#include "webrtc/modules/video_coding/main/source/qm_select.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
-#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@@ -32,7 +31,7 @@
// TODO(andresp): Make thread safe.
class MediaOptimization {
public:
- MediaOptimization(int32_t id, Clock* clock);
+ explicit MediaOptimization(Clock* clock);
~MediaOptimization();
// TODO(andresp): Can Reset and SetEncodingData be done at construction time
@@ -124,7 +123,6 @@
// the state of |video_suspended_| accordingly.
void CheckSuspendConditions();
- int32_t id_;
Clock* clock_;
int32_t max_bit_rate_;
VideoCodecType send_codec_type_;
diff --git a/modules/video_coding/main/source/media_optimization_unittest.cc b/modules/video_coding/main/source/media_optimization_unittest.cc
index d58ada6..bacfdc6 100644
--- a/modules/video_coding/main/source/media_optimization_unittest.cc
+++ b/modules/video_coding/main/source/media_optimization_unittest.cc
@@ -18,9 +18,6 @@
class TestMediaOptimization : public ::testing::Test {
protected:
enum {
- kId = 4711 // Id number for the MediaOptimization class.
- };
- enum {
kSampleRate = 90000 // RTP timestamps per second.
};
@@ -28,7 +25,7 @@
// a special case (e.g. frame rate in media optimization).
TestMediaOptimization()
: clock_(1000),
- media_opt_(kId, &clock_),
+ media_opt_(&clock_),
frame_time_ms_(33),
next_timestamp_(0) {}
diff --git a/modules/video_coding/main/source/receiver.cc b/modules/video_coding/main/source/receiver.cc
index e959746..e179423 100644
--- a/modules/video_coding/main/source/receiver.cc
+++ b/modules/video_coding/main/source/receiver.cc
@@ -18,7 +18,7 @@
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
#include "webrtc/system_wrappers/interface/clock.h"
-#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
@@ -28,15 +28,11 @@
VCMReceiver::VCMReceiver(VCMTiming* timing,
Clock* clock,
EventFactory* event_factory,
- int32_t vcm_id,
- int32_t receiver_id,
bool master)
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
- vcm_id_(vcm_id),
clock_(clock),
- receiver_id_(receiver_id),
master_(master),
- jitter_buffer_(clock_, event_factory, vcm_id, receiver_id, master),
+ jitter_buffer_(clock_, event_factory),
timing_(timing),
render_wait_event_(event_factory->CreateEvent()),
state_(kPassive),
@@ -78,13 +74,6 @@
int32_t VCMReceiver::InsertPacket(const VCMPacket& packet,
uint16_t frame_width,
uint16_t frame_height) {
- if (packet.frameType == kVideoFrameKey) {
- WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "Inserting key frame packet seqnum=%u, timestamp=%u",
- packet.seqNum, packet.timestamp);
- }
-
// Insert the packet into the jitter buffer. The packet can either be empty or
// contain media at this point.
bool retransmitted = false;
@@ -95,10 +84,6 @@
} else if (ret == kFlushIndicator) {
return VCM_FLUSH_INDICATOR;
} else if (ret < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "Error inserting packet seqnum=%u, timestamp=%u",
- packet.seqNum, packet.timestamp);
return VCM_JITTER_BUFFER_ERROR;
}
if (ret == kCompleteSession && !retransmitted) {
@@ -107,15 +92,6 @@
// delay within the jitter estimate.
timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds());
}
- if (master_) {
- // Only trace the primary receiver to make it possible to parse and plot
- // the trace file.
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "Packet seqnum=%u timestamp=%u inserted at %u",
- packet.seqNum, packet.timestamp,
- MaskWord64ToUWord32(clock_->TimeInMilliseconds()));
- }
return VCM_OK;
}
@@ -159,19 +135,16 @@
if (next_render_time_ms < 0) {
timing_error = true;
} else if (std::abs(next_render_time_ms - now_ms) > max_video_delay_ms_) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "This frame is out of our delay bounds, resetting jitter "
- "buffer: %d > %d",
- static_cast<int>(std::abs(next_render_time_ms - now_ms)),
- max_video_delay_ms_);
+ int frame_delay = static_cast<int>(std::abs(next_render_time_ms - now_ms));
+ LOG(LS_WARNING) << "A frame about to be decoded is out of the configured "
+ << "delay bounds (" << frame_delay << " > "
+ << max_video_delay_ms_
+ << "). Resetting the video jitter buffer.";
timing_error = true;
} else if (static_cast<int>(timing_->TargetVideoDelay()) >
max_video_delay_ms_) {
- WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, receiver_id_),
- "More than %u ms target delay. Flushing jitter buffer and"
- "resetting timing.", max_video_delay_ms_);
+ LOG(LS_WARNING) << "The video target delay has grown larger than "
+ << max_video_delay_ms_ << " ms. Resetting jitter buffer.";
timing_error = true;
}
@@ -280,10 +253,7 @@
bool request_key_frame = false;
uint16_t* internal_nack_list = jitter_buffer_.GetNackList(
nack_list_length, &request_key_frame);
- if (*nack_list_length > size) {
- *nack_list_length = 0;
- return kNackNeedMoreMemory;
- }
+ assert(*nack_list_length <= size);
if (internal_nack_list != NULL && *nack_list_length > 0) {
memcpy(nack_list, internal_nack_list, *nack_list_length * sizeof(uint16_t));
}
diff --git a/modules/video_coding/main/source/receiver.h b/modules/video_coding/main/source/receiver.h
index ac510ea..c037303 100644
--- a/modules/video_coding/main/source/receiver.h
+++ b/modules/video_coding/main/source/receiver.h
@@ -25,7 +25,6 @@
enum VCMNackStatus {
kNackOk,
- kNackNeedMoreMemory,
kNackKeyFrameRequest
};
@@ -40,8 +39,6 @@
VCMReceiver(VCMTiming* timing,
Clock* clock,
EventFactory* event_factory,
- int32_t vcm_id,
- int32_t receiver_id,
bool master);
~VCMReceiver();
@@ -95,9 +92,7 @@
static int32_t GenerateReceiverId();
CriticalSectionWrapper* crit_sect_;
- int32_t vcm_id_;
Clock* clock_;
- int32_t receiver_id_;
bool master_;
VCMJitterBuffer jitter_buffer_;
VCMTiming* timing_;
diff --git a/modules/video_coding/main/source/receiver_unittest.cc b/modules/video_coding/main/source/receiver_unittest.cc
index 33a3d95..e80b9cc 100644
--- a/modules/video_coding/main/source/receiver_unittest.cc
+++ b/modules/video_coding/main/source/receiver_unittest.cc
@@ -31,7 +31,7 @@
TestVCMReceiver()
: clock_(new SimulatedClock(0)),
timing_(clock_.get()),
- receiver_(&timing_, clock_.get(), &event_factory_, 1, 1, true) {
+ receiver_(&timing_, clock_.get(), &event_factory_, true) {
stream_generator_.reset(new
StreamGenerator(0, 0, clock_->TimeInMilliseconds()));
memset(data_buffer_, 0, kDataBufferSize);
diff --git a/modules/video_coding/main/source/rtt_filter.cc b/modules/video_coding/main/source/rtt_filter.cc
index 473c886..739cc82 100644
--- a/modules/video_coding/main/source/rtt_filter.cc
+++ b/modules/video_coding/main/source/rtt_filter.cc
@@ -10,7 +10,6 @@
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
#include "webrtc/modules/video_coding/main/source/rtt_filter.h"
-#include "webrtc/system_wrappers/interface/trace.h"
#include <math.h>
#include <stdlib.h>
@@ -18,15 +17,11 @@
namespace webrtc {
-VCMRttFilter::VCMRttFilter(int32_t vcmId, int32_t receiverId)
-:
-_vcmId(vcmId),
-_receiverId(receiverId),
-_filtFactMax(35),
-_jumpStdDevs(2.5),
-_driftStdDevs(3.5),
-_detectThreshold(kMaxDriftJumpCount)
-{
+VCMRttFilter::VCMRttFilter()
+ : _filtFactMax(35),
+ _jumpStdDevs(2.5),
+ _driftStdDevs(3.5),
+ _detectThreshold(kMaxDriftJumpCount) {
Reset();
}
@@ -105,9 +100,6 @@
_avgRtt = oldAvg;
_varRtt = oldVar;
}
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "RttFilter Update: sample=%u avgRtt=%f varRtt=%f maxRtt=%u",
- rttMs, _avgRtt, _varRtt, _maxRtt);
}
bool
@@ -141,8 +133,6 @@
ShortRttFilter(_jumpBuf, abs(_jumpCount));
_filtFactCount = _detectThreshold + 1;
_jumpCount = 0;
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "Detected an RTT jump");
}
else
{
@@ -174,8 +164,6 @@
ShortRttFilter(_driftBuf, _driftCount);
_filtFactCount = _detectThreshold + 1;
_driftCount = 0;
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _receiverId),
- "Detected an RTT drift");
}
}
else
diff --git a/modules/video_coding/main/source/rtt_filter.h b/modules/video_coding/main/source/rtt_filter.h
index 9ce3798..8b816a0 100644
--- a/modules/video_coding/main/source/rtt_filter.h
+++ b/modules/video_coding/main/source/rtt_filter.h
@@ -19,7 +19,7 @@
class VCMRttFilter
{
public:
- VCMRttFilter(int32_t vcmId = 0, int32_t receiverId = 0);
+ VCMRttFilter();
VCMRttFilter& operator=(const VCMRttFilter& rhs);
@@ -48,8 +48,6 @@
// Computes the short time average and maximum of the vector buf.
void ShortRttFilter(uint32_t* buf, uint32_t length);
- int32_t _vcmId;
- int32_t _receiverId;
bool _gotNonZeroUpdate;
double _avgRtt;
double _varRtt;
diff --git a/modules/video_coding/main/source/session_info.cc b/modules/video_coding/main/source/session_info.cc
index 1cb60d3..dab3da1 100644
--- a/modules/video_coding/main/source/session_info.cc
+++ b/modules/video_coding/main/source/session_info.cc
@@ -11,6 +11,7 @@
#include "webrtc/modules/video_coding/main/source/session_info.h"
#include "webrtc/modules/video_coding/main/source/packet.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
@@ -403,6 +404,7 @@
}
if (packets_.size() == kMaxPacketsInSession) {
+ LOG(LS_ERROR) << "Max number of packets per frame has been reached.";
return -1;
}
@@ -429,6 +431,8 @@
first_packet_seq_num_ = static_cast<int>(packet.seqNum);
} else if (first_packet_seq_num_ != -1 &&
!IsNewerSequenceNumber(packet.seqNum, first_packet_seq_num_)) {
+ LOG(LS_WARNING) << "Received packet with a sequence number which is out of"
+ "frame boundaries";
return -3;
} else if (frame_type_ == kFrameEmpty && packet.frameType != kFrameEmpty) {
// Update the frame type with the type of the first media packet.
@@ -441,6 +445,8 @@
last_packet_seq_num_ = static_cast<int>(packet.seqNum);
} else if (last_packet_seq_num_ != -1 &&
IsNewerSequenceNumber(packet.seqNum, last_packet_seq_num_)) {
+ LOG(LS_WARNING) << "Received packet with a sequence number which is out of"
+ "frame boundaries";
return -3;
}
diff --git a/modules/video_coding/main/source/session_info.h b/modules/video_coding/main/source/session_info.h
index 039f097..cae3ee1 100644
--- a/modules/video_coding/main/source/session_info.h
+++ b/modules/video_coding/main/source/session_info.h
@@ -147,7 +147,6 @@
bool complete_;
bool decodable_;
webrtc::FrameType frame_type_;
- bool previous_frame_loss_;
// Packets in this frame.
PacketList packets_;
int empty_seq_num_low_;
diff --git a/modules/video_coding/main/source/timestamp_extrapolator.cc b/modules/video_coding/main/source/timestamp_extrapolator.cc
index 1d911a5..2243c86 100644
--- a/modules/video_coding/main/source/timestamp_extrapolator.cc
+++ b/modules/video_coding/main/source/timestamp_extrapolator.cc
@@ -11,34 +11,27 @@
#include "webrtc/modules/video_coding/main/source/internal_defines.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 {
-VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock,
- int32_t vcmId,
- int32_t id)
-:
-_rwLock(RWLockWrapper::CreateRWLock()),
-_vcmId(vcmId),
-_id(id),
-_clock(clock),
-_startMs(0),
-_firstTimestamp(0),
-_wrapArounds(0),
-_prevUnwrappedTimestamp(-1),
-_prevWrapTimestamp(-1),
-_lambda(1),
-_firstAfterReset(true),
-_packetCount(0),
-_startUpFilterDelayInPackets(2),
-_detectorAccumulatorPos(0),
-_detectorAccumulatorNeg(0),
-_alarmThreshold(60e3),
-_accDrift(6600), // in timestamp ticks, i.e. 15 ms
-_accMaxError(7000),
-_P11(1e10)
-{
+VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock)
+ : _rwLock(RWLockWrapper::CreateRWLock()),
+ _clock(clock),
+ _startMs(0),
+ _firstTimestamp(0),
+ _wrapArounds(0),
+ _prevUnwrappedTimestamp(-1),
+ _prevWrapTimestamp(-1),
+ _lambda(1),
+ _firstAfterReset(true),
+ _packetCount(0),
+ _startUpFilterDelayInPackets(2),
+ _detectorAccumulatorPos(0),
+ _detectorAccumulatorNeg(0),
+ _alarmThreshold(60e3),
+ _accDrift(6600), // in timestamp ticks, i.e. 15 ms
+ _accMaxError(7000),
+ _P11(1e10) {
Reset();
}
@@ -69,7 +62,7 @@
}
void
-VCMTimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz, bool trace)
+VCMTimestampExtrapolator::Update(int64_t tMs, uint32_t ts90khz)
{
_rwLock->AcquireLockExclusive();
@@ -115,7 +108,7 @@
double residual =
(static_cast<double>(unwrapped_ts90khz) - _firstTimestamp) -
static_cast<double>(tMs) * _w[0] - _w[1];
- if (DelayChangeDetection(residual, trace) &&
+ if (DelayChangeDetection(residual) &&
_packetCount >= _startUpFilterDelayInPackets)
{
// A sudden change of average network delay has been detected.
@@ -147,10 +140,6 @@
{
_packetCount++;
}
- if (trace)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _id), "w[0]=%f w[1]=%f ts=%u tMs=%u", _w[0], _w[1], ts90khz, tMs);
- }
_rwLock->ReleaseLockExclusive();
}
@@ -222,7 +211,7 @@
}
bool
-VCMTimestampExtrapolator::DelayChangeDetection(double error, bool trace)
+VCMTimestampExtrapolator::DelayChangeDetection(double error)
{
// CUSUM detection of sudden delay changes
error = (error > 0) ? VCM_MIN(error, _accMaxError) : VCM_MAX(error, -_accMaxError);
@@ -231,17 +220,9 @@
if (_detectorAccumulatorPos > _alarmThreshold || _detectorAccumulatorNeg < -_alarmThreshold)
{
// Alarm
- if (trace)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _id), "g1=%f g2=%f alarm=1", _detectorAccumulatorPos, _detectorAccumulatorNeg);
- }
_detectorAccumulatorPos = _detectorAccumulatorNeg = 0;
return true;
}
- if (trace)
- {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(_vcmId, _id), "g1=%f g2=%f alarm=0", _detectorAccumulatorPos, _detectorAccumulatorNeg);
- }
return false;
}
diff --git a/modules/video_coding/main/source/timestamp_extrapolator.h b/modules/video_coding/main/source/timestamp_extrapolator.h
index 4565186..f3cf74f 100644
--- a/modules/video_coding/main/source/timestamp_extrapolator.h
+++ b/modules/video_coding/main/source/timestamp_extrapolator.h
@@ -22,20 +22,16 @@
class VCMTimestampExtrapolator
{
public:
- VCMTimestampExtrapolator(Clock* clock,
- int32_t vcmId = 0,
- int32_t receiverId = 0);
+ explicit VCMTimestampExtrapolator(Clock* clock);
~VCMTimestampExtrapolator();
- void Update(int64_t tMs, uint32_t ts90khz, bool trace = true);
+ void Update(int64_t tMs, uint32_t ts90khz);
int64_t ExtrapolateLocalTime(uint32_t timestamp90khz);
void Reset();
private:
void CheckForWrapArounds(uint32_t ts90khz);
- bool DelayChangeDetection(double error, bool trace = true);
+ bool DelayChangeDetection(double error);
RWLockWrapper* _rwLock;
- int32_t _vcmId;
- int32_t _id;
Clock* _clock;
double _w[2];
double _P[2][2];
diff --git a/modules/video_coding/main/source/timing.cc b/modules/video_coding/main/source/timing.cc
index 98a69e9..e5b5635 100644
--- a/modules/video_coding/main/source/timing.cc
+++ b/modules/video_coding/main/source/timing.cc
@@ -15,20 +15,15 @@
#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(Clock* clock,
- int32_t vcm_id,
- int32_t timing_id,
VCMTiming* master_timing)
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
- vcm_id_(vcm_id),
clock_(clock),
- timing_id_(timing_id),
master_(false),
ts_extrapolator_(),
codec_timer_(),
@@ -40,7 +35,7 @@
prev_frame_timestamp_(0) {
if (master_timing == NULL) {
master_ = true;
- ts_extrapolator_ = new VCMTimestampExtrapolator(clock_, vcm_id, timing_id);
+ ts_extrapolator_ = new VCMTimestampExtrapolator(clock_);
} else {
ts_extrapolator_ = master_timing->ts_extrapolator_;
}
@@ -81,11 +76,6 @@
void VCMTiming::SetJitterDelay(uint32_t jitter_delay_ms) {
CriticalSectionScoped cs(crit_sect_);
if (jitter_delay_ms != jitter_delay_ms_) {
- if (master_) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, timing_id_),
- "Desired jitter buffer level: %u ms", jitter_delay_ms);
- }
jitter_delay_ms_ = jitter_delay_ms;
// When in initial state, set current delay to minimum delay.
if (current_delay_ms_ == 0) {
@@ -152,39 +142,21 @@
int64_t start_time_ms,
int64_t now_ms) {
CriticalSectionScoped cs(crit_sect_);
- const int32_t max_dec_time = MaxDecodeTimeMs();
int32_t time_diff_ms = codec_timer_.StopTimer(start_time_ms, now_ms);
- if (time_diff_ms < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding, VCMId(vcm_id_,
- timing_id_), "Codec timer error: %d", time_diff_ms);
- assert(false);
- }
+ assert(time_diff_ms >= 0);
last_decode_ms_ = time_diff_ms;
- if (master_) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(vcm_id_,
- timing_id_),
- "Frame decoded: time_stamp=%u dec_time=%d max_dec_time=%u, at %u",
- time_stamp, time_diff_ms, max_dec_time, MaskWord64ToUWord32(now_ms));
- }
return 0;
}
void VCMTiming::IncomingTimestamp(uint32_t time_stamp, int64_t now_ms) {
CriticalSectionScoped cs(crit_sect_);
- ts_extrapolator_->Update(now_ms, time_stamp, master_);
+ ts_extrapolator_->Update(now_ms, time_stamp);
}
int64_t VCMTiming::RenderTimeMs(uint32_t frame_timestamp, int64_t now_ms)
const {
CriticalSectionScoped cs(crit_sect_);
const int64_t render_time_ms = RenderTimeMsInternal(frame_timestamp, now_ms);
- if (master_) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding, VCMId(vcm_id_,
- timing_id_), "Render frame %u at %u. Render delay %u",
- "jitter delay %u, max decode time %u, playout delay %u",
- frame_timestamp, MaskWord64ToUWord32(render_time_ms), render_delay_ms_,
- jitter_delay_ms_, MaxDecodeTimeMs(), min_playout_delay_ms_);
- }
return render_time_ms;
}
@@ -192,11 +164,6 @@
int64_t now_ms) const {
int64_t estimated_complete_time_ms =
ts_extrapolator_->ExtrapolateLocalTime(frame_timestamp);
- if (master_) {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, timing_id_), "ExtrapolateLocalTime(%u)=%u ms",
- frame_timestamp, MaskWord64ToUWord32(estimated_complete_time_ms));
- }
if (estimated_complete_time_ms == -1) {
estimated_complete_time_ms = now_ms;
}
@@ -210,11 +177,7 @@
int32_t VCMTiming::MaxDecodeTimeMs(FrameType frame_type /*= kVideoFrameDelta*/)
const {
const int32_t decode_time_ms = codec_timer_.RequiredDecodeTimeMs(frame_type);
- if (decode_time_ms < 0) {
- WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding, VCMId(vcm_id_,
- timing_id_), "Negative maximum decode time: %d", decode_time_ms);
- return -1;
- }
+ assert(decode_time_ms >= 0);
return decode_time_ms;
}
@@ -254,11 +217,6 @@
}
uint32_t VCMTiming::TargetDelayInternal() const {
- WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
- VCMId(vcm_id_, timing_id_),
- "Delay: min_playout=%u jitter=%u max_decode=%u render=%u",
- min_playout_delay_ms_, jitter_delay_ms_, MaxDecodeTimeMs(),
- render_delay_ms_);
return std::max(min_playout_delay_ms_,
jitter_delay_ms_ + MaxDecodeTimeMs() + render_delay_ms_);
}
diff --git a/modules/video_coding/main/source/timing.h b/modules/video_coding/main/source/timing.h
index eb251b7..fcb0402 100644
--- a/modules/video_coding/main/source/timing.h
+++ b/modules/video_coding/main/source/timing.h
@@ -25,8 +25,6 @@
// The primary timing component should be passed
// if this is the dual timing component.
VCMTiming(Clock* clock,
- int32_t vcm_id = 0,
- int32_t timing_id = 0,
VCMTiming* master_timing = NULL);
~VCMTiming();
@@ -101,9 +99,7 @@
private:
CriticalSectionWrapper* crit_sect_;
- int32_t vcm_id_;
Clock* clock_;
- int32_t timing_id_;
bool master_;
VCMTimestampExtrapolator* ts_extrapolator_;
VCMCodecTimer codec_timer_;
diff --git a/modules/video_coding/main/source/video_coding_impl.cc b/modules/video_coding/main/source/video_coding_impl.cc
index aea562d..5b93a65 100644
--- a/modules/video_coding/main/source/video_coding_impl.cc
+++ b/modules/video_coding/main/source/video_coding_impl.cc
@@ -16,7 +16,6 @@
#include "webrtc/modules/video_coding/main/source/packet.h"
#include "webrtc/modules/video_coding/main/source/video_coding_impl.h"
#include "webrtc/system_wrappers/interface/clock.h"
-#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
@@ -77,13 +76,12 @@
class VideoCodingModuleImpl : public VideoCodingModule {
public:
- VideoCodingModuleImpl(const int32_t id,
- Clock* clock,
+ VideoCodingModuleImpl(Clock* clock,
EventFactory* event_factory,
bool owns_event_factory)
: VideoCodingModule(),
- sender_(new vcm::VideoSender(id, clock, &post_encode_callback_)),
- receiver_(new vcm::VideoReceiver(id, clock, event_factory)),
+ sender_(new vcm::VideoSender(clock, &post_encode_callback_)),
+ receiver_(new vcm::VideoReceiver(clock, event_factory)),
own_event_factory_(owns_event_factory ? event_factory : NULL) {}
virtual ~VideoCodingModuleImpl() {
@@ -386,17 +384,16 @@
return VCMCodecDataBase::Codec(codecType, codec) ? 0 : -1;
}
-VideoCodingModule* VideoCodingModule::Create(const int32_t id) {
+VideoCodingModule* VideoCodingModule::Create() {
return new VideoCodingModuleImpl(
- id, Clock::GetRealTimeClock(), new EventFactoryImpl, true);
+ Clock::GetRealTimeClock(), new EventFactoryImpl, true);
}
-VideoCodingModule* VideoCodingModule::Create(const int32_t id,
- Clock* clock,
+VideoCodingModule* VideoCodingModule::Create(Clock* clock,
EventFactory* event_factory) {
assert(clock);
assert(event_factory);
- return new VideoCodingModuleImpl(id, clock, event_factory, false);
+ return new VideoCodingModuleImpl(clock, event_factory, false);
}
void VideoCodingModule::Destroy(VideoCodingModule* module) {
diff --git a/modules/video_coding/main/source/video_coding_impl.h b/modules/video_coding/main/source/video_coding_impl.h
index 13fae2b..bf0bc79 100644
--- a/modules/video_coding/main/source/video_coding_impl.h
+++ b/modules/video_coding/main/source/video_coding_impl.h
@@ -54,9 +54,7 @@
public:
typedef VideoCodingModule::SenderNackMode SenderNackMode;
- VideoSender(const int32_t id,
- Clock* clock,
- EncodedImageCallback* post_encode_callback);
+ VideoSender(Clock* clock, EncodedImageCallback* post_encode_callback);
~VideoSender();
@@ -110,7 +108,6 @@
int32_t Process();
private:
- int32_t _id;
Clock* clock_;
scoped_ptr<DebugRecorder> recorder_;
@@ -134,7 +131,7 @@
public:
typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness;
- VideoReceiver(const int32_t id, Clock* clock, EventFactory* event_factory);
+ VideoReceiver(Clock* clock, EventFactory* event_factory);
~VideoReceiver();
int32_t InitializeReceiver();
@@ -202,7 +199,6 @@
// in any frame
};
- int32_t _id;
Clock* clock_;
scoped_ptr<CriticalSectionWrapper> process_crit_sect_;
CriticalSectionWrapper* _receiveCritSect;
diff --git a/modules/video_coding/main/source/video_coding_robustness_unittest.cc b/modules/video_coding/main/source/video_coding_robustness_unittest.cc
index fbb5114..435e182 100644
--- a/modules/video_coding/main/source/video_coding_robustness_unittest.cc
+++ b/modules/video_coding/main/source/video_coding_robustness_unittest.cc
@@ -35,7 +35,7 @@
virtual void SetUp() {
clock_.reset(new SimulatedClock(0));
ASSERT_TRUE(clock_.get() != NULL);
- vcm_ = VideoCodingModule::Create(0, clock_.get(), &event_factory_);
+ vcm_ = VideoCodingModule::Create(clock_.get(), &event_factory_);
ASSERT_TRUE(vcm_ != NULL);
ASSERT_EQ(0, vcm_->InitializeReceiver());
const size_t kMaxNackListSize = 250;
diff --git a/modules/video_coding/main/source/video_receiver.cc b/modules/video_coding/main/source/video_receiver.cc
index a60a6ff..5bc1c90 100644
--- a/modules/video_coding/main/source/video_receiver.cc
+++ b/modules/video_coding/main/source/video_receiver.cc
@@ -16,7 +16,7 @@
#include "webrtc/modules/video_coding/main/source/packet.h"
#include "webrtc/modules/video_coding/main/source/video_coding_impl.h"
#include "webrtc/system_wrappers/interface/clock.h"
-#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
// #define DEBUG_DECODER_BIT_STREAM
@@ -24,18 +24,15 @@
namespace webrtc {
namespace vcm {
-VideoReceiver::VideoReceiver(const int32_t id,
- Clock* clock,
- EventFactory* event_factory)
- : _id(id),
- clock_(clock),
+VideoReceiver::VideoReceiver(Clock* clock, EventFactory* event_factory)
+ : clock_(clock),
process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
_receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_receiverInited(false),
- _timing(clock_, id, 1),
- _dualTiming(clock_, id, 2, &_timing),
- _receiver(&_timing, clock_, event_factory, id, 1, true),
- _dualReceiver(&_dualTiming, clock_, event_factory, id, 2, false),
+ _timing(clock_),
+ _dualTiming(clock_, &_timing),
+ _receiver(&_timing, clock_, event_factory, true),
+ _dualReceiver(&_dualTiming, clock_, event_factory, false),
_decodedFrameCallback(_timing, clock_),
_dualDecodedFrameCallback(_dualTiming, clock_),
_frameTypeCallback(NULL),
@@ -53,7 +50,7 @@
_scheduleKeyRequest(false),
max_nack_list_size_(0),
pre_decode_image_callback_(NULL),
- _codecDataBase(id),
+ _codecDataBase(),
_receiveStatsTimer(1000, clock_),
_retransmissionTimer(10, clock_),
_keyRequestTimer(500, clock_) {
@@ -446,17 +443,9 @@
const int32_t ret =
_frameTypeCallback->SliceLossIndicationRequest(pictureID);
if (ret < 0) {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Failed to request key frame");
return ret;
}
} else {
- WEBRTC_TRACE(webrtc::kTraceWarning,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "No frame type request callback registered");
return VCM_MISSING_CALLBACK;
}
return VCM_OK;
@@ -468,18 +457,10 @@
if (_frameTypeCallback != NULL) {
const int32_t ret = _frameTypeCallback->RequestKeyFrame();
if (ret < 0) {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Failed to request key frame");
return ret;
}
_scheduleKeyRequest = false;
} else {
- WEBRTC_TRACE(webrtc::kTraceWarning,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "No frame type request callback registered");
return VCM_MISSING_CALLBACK;
}
return VCM_OK;
@@ -502,29 +483,18 @@
VCMEncodedFrame* dualFrame =
_dualReceiver.FrameForDecoding(maxWaitTimeMs, dummyRenderTime);
if (dualFrame != NULL && _dualDecoder != NULL) {
- WEBRTC_TRACE(webrtc::kTraceStream,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Decoding frame %u with dual decoder",
- dualFrame->TimeStamp());
// Decode dualFrame and try to catch up
int32_t ret =
_dualDecoder->Decode(*dualFrame, clock_->TimeInMilliseconds());
if (ret != WEBRTC_VIDEO_CODEC_OK) {
- WEBRTC_TRACE(webrtc::kTraceWarning,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Failed to decode frame with dual decoder");
+ LOG(LS_ERROR) << "Failed to decode frame with dual decoder. Error code: "
+ << ret;
_dualReceiver.ReleaseFrame(dualFrame);
return VCM_CODEC_ERROR;
}
if (_receiver.DualDecoderCaughtUp(dualFrame, _dualReceiver)) {
// Copy the complete decoder state of the dual decoder
// to the primary decoder.
- WEBRTC_TRACE(webrtc::kTraceStream,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Dual decoder caught up");
_codecDataBase.CopyDecoder(*_dualDecoder);
_codecDataBase.ReleaseDecoder(_dualDecoder);
_dualDecoder = NULL;
@@ -565,11 +535,6 @@
return RequestSliceLossIndication(
_decodedFrameCallback.LastReceivedPictureID() + 1);
} else {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Failed to decode frame %u, requesting key frame",
- frame.TimeStamp());
request_key_frame = true;
}
} else if (ret == VCM_REQUEST_SLI) {
@@ -730,24 +695,8 @@
nackStatus = _dualReceiver.NackList(nackList, *size, &nack_list_length);
}
*size = nack_list_length;
-
- switch (nackStatus) {
- case kNackNeedMoreMemory: {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Out of memory");
- return VCM_MEMORY;
- }
- case kNackKeyFrameRequest: {
- WEBRTC_TRACE(webrtc::kTraceWarning,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Failed to get NACK list, requesting key frame");
+ if (nackStatus == kNackKeyFrameRequest) {
return RequestKeyFrame();
- }
- default:
- break;
}
return VCM_OK;
}
diff --git a/modules/video_coding/main/source/video_receiver_unittest.cc b/modules/video_coding/main/source/video_receiver_unittest.cc
index 4fd524d..502dfa9 100644
--- a/modules/video_coding/main/source/video_receiver_unittest.cc
+++ b/modules/video_coding/main/source/video_receiver_unittest.cc
@@ -33,7 +33,7 @@
TestVideoReceiver() : clock_(0) {}
virtual void SetUp() {
- receiver_.reset(new VideoReceiver(0, &clock_, &event_factory_));
+ receiver_.reset(new VideoReceiver(&clock_, &event_factory_));
EXPECT_EQ(0, receiver_->InitializeReceiver());
EXPECT_EQ(0,
receiver_->RegisterExternalDecoder(
diff --git a/modules/video_coding/main/source/video_sender.cc b/modules/video_coding/main/source/video_sender.cc
index 52a0f86..38ecc54 100644
--- a/modules/video_coding/main/source/video_sender.cc
+++ b/modules/video_coding/main/source/video_sender.cc
@@ -17,6 +17,7 @@
#include "webrtc/modules/video_coding/main/source/encoded_frame.h"
#include "webrtc/modules/video_coding/main/source/video_coding_impl.h"
#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/logging.h"
namespace webrtc {
namespace vcm {
@@ -57,20 +58,18 @@
FILE* file_ GUARDED_BY(cs_);
};
-VideoSender::VideoSender(const int32_t id,
- Clock* clock,
+VideoSender::VideoSender(Clock* clock,
EncodedImageCallback* post_encode_callback)
- : _id(id),
- clock_(clock),
+ : clock_(clock),
recorder_(new DebugRecorder()),
process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
_sendCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_encoder(),
_encodedFrameCallback(post_encode_callback),
_nextFrameTypes(1, kVideoFrameDelta),
- _mediaOpt(id, clock_),
+ _mediaOpt(clock_),
_sendStatsCallback(NULL),
- _codecDataBase(id),
+ _codecDataBase(),
frame_dropper_enabled_(true),
_sendStatsTimer(1000, clock_),
qm_settings_callback_(NULL),
@@ -132,10 +131,8 @@
_encoder = _codecDataBase.GetEncoder();
if (!ret) {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Failed to initialize encoder");
+ LOG(LS_ERROR) << "Failed to initialize the encoder with payload name "
+ << sendCodec->plName << ". Error code: " << ret;
return VCM_CODEC_ERROR;
}
@@ -363,26 +360,18 @@
return VCM_OK;
}
if (_mediaOpt.DropFrame()) {
- WEBRTC_TRACE(webrtc::kTraceStream,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Drop frame due to bitrate");
- } else {
- _mediaOpt.UpdateContentData(contentMetrics);
- int32_t ret =
- _encoder->Encode(videoFrame, codecSpecificInfo, _nextFrameTypes);
- recorder_->Add(videoFrame);
- if (ret < 0) {
- WEBRTC_TRACE(webrtc::kTraceError,
- webrtc::kTraceVideoCoding,
- VCMId(_id),
- "Encode error: %d",
- ret);
- return ret;
- }
- for (size_t i = 0; i < _nextFrameTypes.size(); ++i) {
- _nextFrameTypes[i] = kVideoFrameDelta; // Default frame type.
- }
+ return VCM_OK;
+ }
+ _mediaOpt.UpdateContentData(contentMetrics);
+ int32_t ret =
+ _encoder->Encode(videoFrame, codecSpecificInfo, _nextFrameTypes);
+ recorder_->Add(videoFrame);
+ if (ret < 0) {
+ LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret;
+ return ret;
+ }
+ for (size_t i = 0; i < _nextFrameTypes.size(); ++i) {
+ _nextFrameTypes[i] = kVideoFrameDelta; // Default frame type.
}
return VCM_OK;
}
diff --git a/modules/video_coding/main/source/video_sender_unittest.cc b/modules/video_coding/main/source/video_sender_unittest.cc
index ca11ec4..1f25aed 100644
--- a/modules/video_coding/main/source/video_sender_unittest.cc
+++ b/modules/video_coding/main/source/video_sender_unittest.cc
@@ -173,7 +173,7 @@
TestVideoSender() : clock_(1000), packetization_callback_(&clock_) {}
virtual void SetUp() {
- sender_.reset(new VideoSender(0, &clock_, &post_encode_callback_));
+ sender_.reset(new VideoSender(&clock_, &post_encode_callback_));
EXPECT_EQ(0, sender_->InitializeSender());
EXPECT_EQ(0, sender_->RegisterTransportCallback(&packetization_callback_));
}
diff --git a/modules/video_coding/main/test/codec_database_test.cc b/modules/video_coding/main/test/codec_database_test.cc
index 84ddcef..3695cc1 100644
--- a/modules/video_coding/main/test/codec_database_test.cc
+++ b/modules/video_coding/main/test/codec_database_test.cc
@@ -29,7 +29,7 @@
int CodecDataBaseTest::RunTest(CmdArgs& args)
{
- VideoCodingModule* vcm = VideoCodingModule::Create(1);
+ VideoCodingModule* vcm = VideoCodingModule::Create();
CodecDataBaseTest* cdbt = new CodecDataBaseTest(vcm);
cdbt->Perform(args);
VideoCodingModule::Destroy(vcm);
diff --git a/modules/video_coding/main/test/generic_codec_test.cc b/modules/video_coding/main/test/generic_codec_test.cc
index ac687c7..27dbb7e 100644
--- a/modules/video_coding/main/test/generic_codec_test.cc
+++ b/modules/video_coding/main/test/generic_codec_test.cc
@@ -28,8 +28,7 @@
{
SimulatedClock clock(0);
NullEventFactory event_factory;
- VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock,
- &event_factory);
+ VideoCodingModule* vcm = VideoCodingModule::Create(&clock, &event_factory);
GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
Trace::CreateTrace();
Trace::SetTraceFile(
diff --git a/modules/video_coding/main/test/media_opt_test.cc b/modules/video_coding/main/test/media_opt_test.cc
index 55dfb8a..a8b8f19 100644
--- a/modules/video_coding/main/test/media_opt_test.cc
+++ b/modules/video_coding/main/test/media_opt_test.cc
@@ -32,7 +32,7 @@
Trace::CreateTrace();
Trace::SetTraceFile((test::OutputPath() + "mediaOptTestTrace.txt").c_str());
Trace::set_level_filter(webrtc::kTraceAll);
- VideoCodingModule* vcm = VideoCodingModule::Create(1);
+ VideoCodingModule* vcm = VideoCodingModule::Create();
Clock* clock = Clock::GetRealTimeClock();
MediaOptTest* mot = new MediaOptTest(vcm, clock);
if (testNum == 0)
diff --git a/modules/video_coding/main/test/mt_rx_tx_test.cc b/modules/video_coding/main/test/mt_rx_tx_test.cc
index 8f3963f..35cd1f3 100644
--- a/modules/video_coding/main/test/mt_rx_tx_test.cc
+++ b/modules/video_coding/main/test/mt_rx_tx_test.cc
@@ -145,7 +145,7 @@
printf("Cannot read file %s.\n", outname.c_str());
return -1;
}
- VideoCodingModule* vcm = VideoCodingModule::Create(1);
+ VideoCodingModule* vcm = VideoCodingModule::Create();
RtpDataCallback dataCallback(vcm);
RTPSendCompleteCallback* outgoingTransport =
diff --git a/modules/video_coding/main/test/normal_test.cc b/modules/video_coding/main/test/normal_test.cc
index 3000a1a..f23682b 100644
--- a/modules/video_coding/main/test/normal_test.cc
+++ b/modules/video_coding/main/test/normal_test.cc
@@ -37,8 +37,7 @@
Trace::SetTraceFile(
(test::OutputPath() + "VCMNormalTestTrace.txt").c_str());
Trace::set_level_filter(webrtc::kTraceAll);
- VideoCodingModule* vcm = VideoCodingModule::Create(1, clock,
- &event_factory);
+ VideoCodingModule* vcm = VideoCodingModule::Create(clock, &event_factory);
NormalTest VCMNTest(vcm, clock);
VCMNTest.Perform(args);
VideoCodingModule::Destroy(vcm);
diff --git a/modules/video_coding/main/test/quality_modes_test.cc b/modules/video_coding/main/test/quality_modes_test.cc
index 0dbf6fd..385f197 100644
--- a/modules/video_coding/main/test/quality_modes_test.cc
+++ b/modules/video_coding/main/test/quality_modes_test.cc
@@ -32,7 +32,7 @@
{
SimulatedClock clock(0);
NullEventFactory event_factory;
- VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock, &event_factory);
+ VideoCodingModule* vcm = VideoCodingModule::Create(&clock, &event_factory);
QualityModesTest QMTest(vcm, &clock);
QMTest.Perform(args);
VideoCodingModule::Destroy(vcm);
diff --git a/modules/video_coding/main/test/vcm_payload_sink_factory.cc b/modules/video_coding/main/test/vcm_payload_sink_factory.cc
index d5877a4..ebd6f05 100644
--- a/modules/video_coding/main/test/vcm_payload_sink_factory.cc
+++ b/modules/video_coding/main/test/vcm_payload_sink_factory.cc
@@ -108,9 +108,13 @@
};
VcmPayloadSinkFactory::VcmPayloadSinkFactory(
- const std::string& base_out_filename, Clock* clock, bool protection_enabled,
- VCMVideoProtection protection_method, uint32_t rtt_ms,
- uint32_t render_delay_ms, uint32_t min_playout_delay_ms)
+ const std::string& base_out_filename,
+ Clock* clock,
+ bool protection_enabled,
+ VCMVideoProtection protection_method,
+ uint32_t rtt_ms,
+ uint32_t render_delay_ms,
+ uint32_t min_playout_delay_ms)
: base_out_filename_(base_out_filename),
clock_(clock),
protection_enabled_(protection_enabled),
@@ -120,8 +124,7 @@
min_playout_delay_ms_(min_playout_delay_ms),
null_event_factory_(new NullEventFactory()),
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
- sinks_(),
- next_id_(1) {
+ sinks_() {
assert(clock);
assert(crit_sect_.get());
}
@@ -136,7 +139,7 @@
CriticalSectionScoped cs(crit_sect_.get());
scoped_ptr<VideoCodingModule> vcm(
- VideoCodingModule::Create(next_id_++, clock_, null_event_factory_.get()));
+ VideoCodingModule::Create(clock_, null_event_factory_.get()));
if (vcm.get() == NULL) {
return NULL;
}
diff --git a/modules/video_coding/main/test/vcm_payload_sink_factory.h b/modules/video_coding/main/test/vcm_payload_sink_factory.h
index a891b5c..26dc889 100644
--- a/modules/video_coding/main/test/vcm_payload_sink_factory.h
+++ b/modules/video_coding/main/test/vcm_payload_sink_factory.h
@@ -56,7 +56,6 @@
scoped_ptr<NullEventFactory> null_event_factory_;
scoped_ptr<CriticalSectionWrapper> crit_sect_;
Sinks sinks_;
- int next_id_;
DISALLOW_IMPLICIT_CONSTRUCTORS(VcmPayloadSinkFactory);
};
diff --git a/video_engine/vie_channel.cc b/video_engine/vie_channel.cc
index 4ff52bc..b520fb2 100644
--- a/video_engine/vie_channel.cc
+++ b/video_engine/vie_channel.cc
@@ -76,7 +76,7 @@
callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),
rtp_rtcp_cs_(CriticalSectionWrapper::CreateCriticalSection()),
default_rtp_rtcp_(default_rtp_rtcp),
- vcm_(*VideoCodingModule::Create(ViEModuleId(engine_id, channel_id))),
+ vcm_(*VideoCodingModule::Create()),
vie_receiver_(channel_id, &vcm_, remote_bitrate_estimator, this),
vie_sender_(channel_id),
vie_sync_(&vcm_, this),
diff --git a/video_engine/vie_encoder.cc b/video_engine/vie_encoder.cc
index aa20573..9257c92 100644
--- a/video_engine/vie_encoder.cc
+++ b/video_engine/vie_encoder.cc
@@ -139,8 +139,7 @@
: engine_id_(engine_id),
channel_id_(channel_id),
number_of_cores_(number_of_cores),
- vcm_(*webrtc::VideoCodingModule::Create(ViEModuleId(engine_id,
- channel_id))),
+ vcm_(*webrtc::VideoCodingModule::Create()),
vpm_(*webrtc::VideoProcessingModule::Create(ViEModuleId(engine_id,
channel_id))),
callback_cs_(CriticalSectionWrapper::CreateCriticalSection()),