diff options
author | mflodman@webrtc.org <mflodman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-04-07 10:56:31 +0000 |
---|---|---|
committer | mflodman@webrtc.org <mflodman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-04-07 10:56:31 +0000 |
commit | 022615bd918aec7671968ad2b873d1487365980c (patch) | |
tree | 1f6ece2db8aa993a19171b13ec2561df595dc916 | |
parent | a6948e269792dd3f4b56bb667abcf9f331d4d466 (diff) | |
download | webrtc-022615bd918aec7671968ad2b873d1487365980c.tar.gz |
Log Fixit for parts of video_engine folder.
BUG=3153
R=pbos@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/11179004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5853 4adac7df-926f-26a2-2b94-8c16560cd09d
-rw-r--r-- | video_engine/call_stats.cc | 1 | ||||
-rw-r--r-- | video_engine/overuse_frame_detector.cc | 22 | ||||
-rw-r--r-- | video_engine/stream_synchronization.cc | 25 | ||||
-rw-r--r-- | video_engine/test/auto_test/source/vie_autotest_image_process.cc | 9 | ||||
-rw-r--r-- | video_engine/vie_base_impl.cc | 136 | ||||
-rw-r--r-- | video_engine/vie_capture_impl.cc | 157 | ||||
-rw-r--r-- | video_engine/vie_capturer.cc | 112 | ||||
-rw-r--r-- | video_engine/vie_channel.cc | 491 | ||||
-rw-r--r-- | video_engine/vie_channel_group.cc | 11 | ||||
-rw-r--r-- | video_engine/vie_channel_manager.cc | 39 | ||||
-rw-r--r-- | video_engine/vie_codec_impl.cc | 326 | ||||
-rw-r--r-- | video_engine/vie_encoder.cc | 272 | ||||
-rw-r--r-- | video_engine/vie_external_codec_impl.cc | 75 | ||||
-rw-r--r-- | video_engine/vie_frame_provider_base.cc | 24 | ||||
-rw-r--r-- | video_engine/vie_input_manager.cc | 5 |
15 files changed, 267 insertions, 1438 deletions
diff --git a/video_engine/call_stats.cc b/video_engine/call_stats.cc index a79a7d2f..05385c35 100644 --- a/video_engine/call_stats.cc +++ b/video_engine/call_stats.cc @@ -15,7 +15,6 @@ #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/tick_util.h" -#include "webrtc/system_wrappers/interface/trace.h" namespace webrtc { diff --git a/video_engine/overuse_frame_detector.cc b/video_engine/overuse_frame_detector.cc index bfecbb5b..191ae6db 100644 --- a/video_engine/overuse_frame_detector.cc +++ b/video_engine/overuse_frame_detector.cc @@ -19,7 +19,7 @@ #include "webrtc/modules/video_coding/utility/include/exp_filter.h" #include "webrtc/system_wrappers/interface/clock.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/interface/logging.h" namespace webrtc { @@ -438,19 +438,13 @@ int32_t OveruseFrameDetector::Process() { observer_->NormalUsage(); } - WEBRTC_TRACE( - webrtc::kTraceInfo, - webrtc::kTraceVideo, - -1, - "Capture input stats: avg: %.2fms, std_dev: %.2fms (rampup delay: " - "%dms, overuse: >=%.2fms, " - "underuse: <%.2fms)", - capture_deltas_.Mean(), - capture_deltas_.StdDev(), - in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_, - options_.high_capture_jitter_threshold_ms, - options_.low_capture_jitter_threshold_ms); - + int rampup_delay = + in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; + LOG(LS_VERBOSE) << "Capture input stats: avg: " << capture_deltas_.Mean() + << " std_dev " << capture_deltas_.StdDev() + << " rampup delay " << rampup_delay + << " overuse >= " << options_.high_capture_jitter_threshold_ms + << " underuse < " << options_.low_capture_jitter_threshold_ms; return 0; } diff --git a/video_engine/stream_synchronization.cc b/video_engine/stream_synchronization.cc index 6192dfa5..a877c7fa 100644 --- a/video_engine/stream_synchronization.cc +++ b/video_engine/stream_synchronization.cc @@ -16,7 +16,7 @@ #include <algorithm> -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/interface/logging.h" namespace webrtc { @@ -96,18 +96,12 @@ bool StreamSynchronization::ComputeDelays(int relative_delay_ms, assert(total_audio_delay_target_ms && total_video_delay_target_ms); int current_video_delay_ms = *total_video_delay_target_ms; - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, video_channel_id_, - "Audio delay is: %d for voice channel: %d", - current_audio_delay_ms, audio_channel_id_); - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, video_channel_id_, - "Network delay diff is: %d for voice channel: %d", - channel_delay_->network_delay, audio_channel_id_); + LOG(LS_VERBOSE) << "Audio delay: " << current_audio_delay_ms + << ", network delay diff: " << channel_delay_->network_delay + << " current diff: " << relative_delay_ms + << " for channel " << audio_channel_id_; // Calculate the difference between the lowest possible video delay and // the current audio delay. - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, video_channel_id_, - "Current diff is: %d for audio channel: %d", - relative_delay_ms, audio_channel_id_); - int current_diff_ms = current_video_delay_ms - current_audio_delay_ms + relative_delay_ms; @@ -198,11 +192,10 @@ bool StreamSynchronization::ComputeDelays(int relative_delay_ms, channel_delay_->last_video_delay_ms = new_video_delay_ms; channel_delay_->last_audio_delay_ms = new_audio_delay_ms; - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, video_channel_id_, - "Sync video delay %d ms for video channel and audio delay %d for audio " - "channel %d", - new_video_delay_ms, channel_delay_->extra_audio_delay_ms, - audio_channel_id_); + LOG(LS_VERBOSE) << "Sync video delay " << new_video_delay_ms + << " and audio delay " << channel_delay_->extra_audio_delay_ms + << " for video channel " << video_channel_id_ + << " for audio channel " << audio_channel_id_; // Return values. *total_video_delay_target_ms = new_video_delay_ms; diff --git a/video_engine/test/auto_test/source/vie_autotest_image_process.cc b/video_engine/test/auto_test/source/vie_autotest_image_process.cc index 8fa25fc3..8da2d91d 100644 --- a/video_engine/test/auto_test/source/vie_autotest_image_process.cc +++ b/video_engine/test/auto_test/source/vie_autotest_image_process.cc @@ -157,10 +157,9 @@ void ViEAutoTest::ViEImageProcessAPITest() tbCapture.captureId, effectFilter)); EXPECT_EQ(0, ViE.image_process->DeregisterCaptureEffectFilter( tbCapture.captureId)); - - // Double deregister - EXPECT_NE(0, ViE.image_process->DeregisterCaptureEffectFilter( + EXPECT_EQ(0, ViE.image_process->DeregisterCaptureEffectFilter( tbCapture.captureId)); + // Non-existing capture device EXPECT_NE(0, ViE.image_process->RegisterCaptureEffectFilter( tbChannel.videoChannel, effectFilter)); @@ -174,7 +173,7 @@ void ViEAutoTest::ViEImageProcessAPITest() tbChannel.videoChannel, effectFilter)); EXPECT_EQ(0, ViE.image_process->DeregisterRenderEffectFilter( tbChannel.videoChannel)); - EXPECT_NE(0, ViE.image_process->DeregisterRenderEffectFilter( + EXPECT_EQ(0, ViE.image_process->DeregisterRenderEffectFilter( tbChannel.videoChannel)); // Non-existing channel id @@ -190,7 +189,7 @@ void ViEAutoTest::ViEImageProcessAPITest() tbChannel.videoChannel, effectFilter)); EXPECT_EQ(0, ViE.image_process->DeregisterSendEffectFilter( tbChannel.videoChannel)); - EXPECT_NE(0, ViE.image_process->DeregisterSendEffectFilter( + EXPECT_EQ(0, ViE.image_process->DeregisterSendEffectFilter( tbChannel.videoChannel)); EXPECT_NE(0, ViE.image_process->RegisterSendEffectFilter( tbCapture.captureId, effectFilter)); diff --git a/video_engine/vie_base_impl.cc b/video_engine/vie_base_impl.cc index a1f3fc26..2e486f0f 100644 --- a/video_engine/vie_base_impl.cc +++ b/video_engine/vie_base_impl.cc @@ -20,7 +20,7 @@ #include "webrtc/modules/video_processing/main/interface/video_processing.h" #include "webrtc/modules/video_render/include/video_render.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/video_engine/include/vie_errors.h" #include "webrtc/video_engine/vie_capturer.h" #include "webrtc/video_engine/vie_channel.h" @@ -45,42 +45,27 @@ ViEBase* ViEBase::GetInterface(VideoEngine* video_engine) { } int ViEBaseImpl::Release() { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_.instance_id(), - "ViEBase::Release()"); (*this)--; // Decrease ref count. int32_t ref_count = GetCount(); if (ref_count < 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_.instance_id(), - "ViEBase release too many times"); - shared_data_.SetLastError(kViEAPIDoesNotExist); + LOG(LS_WARNING) << "ViEBase released too many times."; return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_.instance_id(), - "ViEBase reference count: %d", ref_count); return ref_count; } ViEBaseImpl::ViEBaseImpl(const Config& config) - : shared_data_(config) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_.instance_id(), - "ViEBaseImpl::ViEBaseImpl() Ctor"); -} + : shared_data_(config) {} -ViEBaseImpl::~ViEBaseImpl() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_.instance_id(), - "ViEBaseImpl::ViEBaseImpl() Dtor"); -} +ViEBaseImpl::~ViEBaseImpl() {} int ViEBaseImpl::Init() { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_.instance_id(), - "Init"); return 0; } int ViEBaseImpl::SetVoiceEngine(VoiceEngine* voice_engine) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s", __FUNCTION__); + LOG_F(LS_INFO) << "SetVoiceEngine"; if (shared_data_.channel_manager()->SetVoiceEngine(voice_engine) != 0) { shared_data_.SetLastError(kViEBaseVoEFailure); return -1; @@ -90,15 +75,10 @@ int ViEBaseImpl::SetVoiceEngine(VoiceEngine* voice_engine) { int ViEBaseImpl::RegisterCpuOveruseObserver(int video_channel, CpuOveruseObserver* observer) { + LOG_F(LS_INFO) << "RegisterCpuOveruseObserver on channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, - kTraceVideo, - ViEId(shared_data_.instance_id()), - "%s: channel %d doesn't exist", - __FUNCTION__, - video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -123,12 +103,6 @@ int ViEBaseImpl::SetCpuOveruseOptions(int video_channel, ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, - kTraceVideo, - ViEId(shared_data_.instance_id()), - "%s: channel %d doesn't exist", - __FUNCTION__, - video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -155,12 +129,6 @@ int ViEBaseImpl::CpuOveruseMeasures(int video_channel, ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, - kTraceVideo, - ViEId(shared_data_.instance_id()), - "%s: channel %d doesn't exist", - __FUNCTION__, - video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -188,18 +156,13 @@ int ViEBaseImpl::CreateChannel(int& video_channel) { // NOLINT int ViEBaseImpl::CreateChannel(int& video_channel, // NOLINT const Config* config) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s", __FUNCTION__); if (shared_data_.channel_manager()->CreateChannel(&video_channel, config) == -1) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: Could not create channel", __FUNCTION__); video_channel = -1; shared_data_.SetLastError(kViEBaseChannelCreationFailed); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: channel created: %d", __FUNCTION__, video_channel); + LOG(LS_INFO) << "Video channel created: " << video_channel; return 0; } @@ -214,15 +177,10 @@ int ViEBaseImpl::CreateReceiveChannel(int& video_channel, // NOLINT } int ViEBaseImpl::DeleteChannel(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s(%d)", __FUNCTION__, video_channel); { ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id()), - "%s: channel %d doesn't exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -239,25 +197,19 @@ int ViEBaseImpl::DeleteChannel(const int video_channel) { } if (shared_data_.channel_manager()->DeleteChannel(video_channel) == -1) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: Could not delete channel %d", __FUNCTION__, - video_channel); shared_data_.SetLastError(kViEBaseUnknownError); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: channel deleted: %d", __FUNCTION__, video_channel); + LOG(LS_INFO) << "Channel deleted " << video_channel; return 0; } int ViEBaseImpl::ConnectAudioChannel(const int video_channel, const int audio_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s(%d)", __FUNCTION__, video_channel); + LOG_F(LS_INFO) << "ConnectAudioChannel, video channel " << video_channel + << ", audio channel " << audio_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); if (!cs.Channel(video_channel)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: channel %d doesn't exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -271,12 +223,9 @@ int ViEBaseImpl::ConnectAudioChannel(const int video_channel, } int ViEBaseImpl::DisconnectAudioChannel(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s(%d)", __FUNCTION__, video_channel); + LOG_F(LS_INFO) << "DisconnectAudioChannel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); if (!cs.Channel(video_channel)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: channel %d doesn't exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -290,16 +239,10 @@ int ViEBaseImpl::DisconnectAudioChannel(const int video_channel) { } int ViEBaseImpl::StartSend(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s(channel: %d)", __FUNCTION__, video_channel); - + LOG_F(LS_INFO) << "StartSend: " << video_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s: Channel %d does not exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -307,9 +250,7 @@ int ViEBaseImpl::StartSend(const int video_channel) { ViEEncoder* vie_encoder = cs.Encoder(video_channel); assert(vie_encoder != NULL); if (vie_encoder->Owner() != video_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "Can't start ssend on a receive only channel."); + LOG_F(LS_ERROR) << "Can't start send on a receive only channel."; shared_data_.SetLastError(kViEBaseReceiveOnlyChannel); return -1; } @@ -319,13 +260,10 @@ int ViEBaseImpl::StartSend(const int video_channel) { int32_t error = vie_channel->StartSend(); if (error != 0) { vie_encoder->Restart(); - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s: Could not start sending on channel %d", __FUNCTION__, - video_channel); if (error == kViEBaseAlreadySending) { shared_data_.SetLastError(kViEBaseAlreadySending); } + LOG_F(LS_ERROR) << "Could not start sending " << video_channel; shared_data_.SetLastError(kViEBaseUnknownError); return -1; } @@ -335,29 +273,21 @@ int ViEBaseImpl::StartSend(const int video_channel) { } int ViEBaseImpl::StopSend(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s(channel: %d)", __FUNCTION__, video_channel); + LOG_F(LS_INFO) << "StopSend " << video_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s: Channel %d does not exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } int32_t error = vie_channel->StopSend(); if (error != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s: Could not stop sending on channel %d", __FUNCTION__, - video_channel); if (error == kViEBaseNotSending) { shared_data_.SetLastError(kViEBaseNotSending); } else { + LOG_F(LS_ERROR) << "Could not stop sending " << video_channel; shared_data_.SetLastError(kViEBaseUnknownError); } return -1; @@ -366,16 +296,11 @@ int ViEBaseImpl::StopSend(const int video_channel) { } int ViEBaseImpl::StartReceive(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s(channel: %d)", __FUNCTION__, video_channel); + LOG_F(LS_INFO) << "StartReceive " << video_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s: Channel %d does not exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -387,16 +312,10 @@ int ViEBaseImpl::StartReceive(const int video_channel) { } int ViEBaseImpl::StopReceive(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s(channel: %d)", __FUNCTION__, video_channel); - + LOG_F(LS_INFO) << "StopReceive " << video_channel; ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_.instance_id(), video_channel), - "%s: Channel %d does not exist", __FUNCTION__, video_channel); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -408,8 +327,6 @@ int ViEBaseImpl::StopReceive(const int video_channel) { } int ViEBaseImpl::GetVersion(char version[1024]) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_.instance_id()), - "GetVersion(version=?)"); assert(kViEVersionMaxMessageSize == 1024); if (!version) { shared_data_.SetLastError(kViEBaseInvalidArgument); @@ -423,17 +340,10 @@ int ViEBaseImpl::GetVersion(char version[1024]) { // Add build info. version_stream << "Build: " << BUILDINFO << std::endl; -#ifdef WEBRTC_EXTERNAL_TRANSPORT - version_stream << "External transport build" << std::endl; -#endif int version_length = version_stream.tellp(); assert(version_length < 1024); memcpy(version, version_stream.str().c_str(), version_length); version[version_length] = '\0'; - - WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, - ViEId(shared_data_.instance_id()), "GetVersion() => %s", - version); return 0; } @@ -445,9 +355,6 @@ int ViEBaseImpl::CreateChannel(int& video_channel, // NOLINT int original_channel, bool sender) { ViEChannelManagerScoped cs(*(shared_data_.channel_manager())); if (!cs.Channel(original_channel)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s - original_channel does not exist.", __FUNCTION__, - shared_data_.instance_id()); shared_data_.SetLastError(kViEBaseInvalidChannelId); return -1; } @@ -455,14 +362,13 @@ int ViEBaseImpl::CreateChannel(int& video_channel, // NOLINT if (shared_data_.channel_manager()->CreateChannel(&video_channel, original_channel, sender) == -1) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: Could not create channel", __FUNCTION__); video_channel = -1; shared_data_.SetLastError(kViEBaseChannelCreationFailed); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(shared_data_.instance_id()), - "%s: channel created: %d", __FUNCTION__, video_channel); + LOG_F(LS_INFO) << "VideoChannel created: " << video_channel + << ", base channel " << original_channel + << ", is send channel : " << sender; return 0; } diff --git a/video_engine/vie_capture_impl.cc b/video_engine/vie_capture_impl.cc index 85353c30..c4f43446 100644 --- a/video_engine/vie_capture_impl.cc +++ b/video_engine/vie_capture_impl.cc @@ -12,7 +12,7 @@ #include <map> -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/video_engine/include/vie_errors.h" #include "webrtc/video_engine/vie_capturer.h" #include "webrtc/video_engine/vie_channel.h" @@ -43,37 +43,24 @@ ViECapture* ViECapture::GetInterface(VideoEngine* video_engine) { } int ViECaptureImpl::Release() { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(), - "ViECapture::Release()"); // Decrease ref count (*this)--; int32_t ref_count = GetCount(); if (ref_count < 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), - "ViECapture release too many times"); + LOG(LS_WARNING) << "ViECapture released too many times."; shared_data_->SetLastError(kViEAPIDoesNotExist); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(), - "ViECapture reference count: %d", ref_count); return ref_count; } ViECaptureImpl::ViECaptureImpl(ViESharedData* shared_data) - : shared_data_(shared_data) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), - "ViECaptureImpl::ViECaptureImpl() Ctor"); -} + : shared_data_(shared_data) {} -ViECaptureImpl::~ViECaptureImpl() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), - "ViECaptureImpl::~ViECaptureImpl() Dtor"); -} +ViECaptureImpl::~ViECaptureImpl() {} int ViECaptureImpl::NumberOfCaptureDevices() { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); return shared_data_->input_manager()->NumberOfCaptureDevices(); } @@ -83,8 +70,6 @@ int ViECaptureImpl::GetCaptureDevice(unsigned int list_number, unsigned int device_nameUTF8Length, char* unique_idUTF8, unsigned int unique_idUTF8Length) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(list_number: %d)", __FUNCTION__, list_number); return shared_data_->input_manager()->GetDeviceName( list_number, device_nameUTF8, device_nameUTF8Length, @@ -95,8 +80,7 @@ int ViECaptureImpl::AllocateCaptureDevice( const char* unique_idUTF8, const unsigned int unique_idUTF8Length, int& capture_id) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(unique_idUTF8: %s)", __FUNCTION__, unique_idUTF8); + LOG(LS_INFO) << "AllocateCaptureDevice " << unique_idUTF8; const int32_t result = shared_data_->input_manager()->CreateCaptureDevice( unique_idUTF8, @@ -111,8 +95,6 @@ int ViECaptureImpl::AllocateCaptureDevice( int ViECaptureImpl::AllocateExternalCaptureDevice( int& capture_id, ViEExternalCapture*& external_capture) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); const int32_t result = shared_data_->input_manager()->CreateExternalCaptureDevice( external_capture, capture_id); @@ -121,56 +103,45 @@ int ViECaptureImpl::AllocateExternalCaptureDevice( shared_data_->SetLastError(result); return -1; } + LOG(LS_INFO) << "External capture device allocated: " << capture_id; return 0; } int ViECaptureImpl::AllocateCaptureDevice( VideoCaptureModule& capture_module, int& capture_id) { // NOLINT - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); int32_t result = shared_data_->input_manager()->CreateCaptureDevice( &capture_module, capture_id); if (result != 0) { shared_data_->SetLastError(result); return -1; } + LOG(LS_INFO) << "External capture device, by module, allocated: " + << capture_id; return 0; } int ViECaptureImpl::ReleaseCaptureDevice(const int capture_id) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(capture_id: %d)", __FUNCTION__, capture_id); + LOG(LS_INFO) << "ReleaseCaptureDevice " << capture_id; { ViEInputManagerScoped is((*(shared_data_->input_manager()))); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } } - - // Destroy the capture device. return shared_data_->input_manager()->DestroyCaptureDevice(capture_id); } int ViECaptureImpl::ConnectCaptureDevice(const int capture_id, const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(capture_id: %d, video_channel: %d)", __FUNCTION__, - capture_id, video_channel); + LOG(LS_INFO) << "Connect capture id " << capture_id + << " to channel " << video_channel; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } @@ -178,26 +149,18 @@ int ViECaptureImpl::ConnectCaptureDevice(const int capture_id, ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Channel %d doesn't exist", __FUNCTION__, - video_channel); + LOG(LS_ERROR) << "Channel doesn't exist."; shared_data_->SetLastError(kViECaptureDeviceInvalidChannelId); return -1; } if (vie_encoder->Owner() != video_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "Can't connect capture device to a receive only channel."); + LOG(LS_ERROR) << "Can't connect capture device to a receive device."; shared_data_->SetLastError(kViECaptureDeviceInvalidChannelId); return -1; } // Check if the encoder already has a connected frame provider if (is.FrameProvider(vie_encoder) != NULL) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Channel %d already connected to a capture device.", - __FUNCTION__, video_channel); + LOG(LS_ERROR) << "Channel already connected to capture device."; shared_data_->SetLastError(kViECaptureDeviceAlreadyConnected); return -1; } @@ -215,17 +178,12 @@ int ViECaptureImpl::ConnectCaptureDevice(const int capture_id, int ViECaptureImpl::DisconnectCaptureDevice(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d)", __FUNCTION__, video_channel); + LOG(LS_INFO) << "DisconnectCaptureDevice " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id()), - "%s: Channel %d doesn't exist", __FUNCTION__, - video_channel); + LOG(LS_ERROR) << "Channel doesn't exist."; shared_data_->SetLastError(kViECaptureDeviceInvalidChannelId); return -1; } @@ -233,19 +191,11 @@ int ViECaptureImpl::DisconnectCaptureDevice(const int video_channel) { ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEFrameProviderBase* frame_provider = is.FrameProvider(vie_encoder); if (!frame_provider) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, - ViEId(shared_data_->instance_id()), - "%s: No capture device connected to channel %d", - __FUNCTION__, video_channel); shared_data_->SetLastError(kViECaptureDeviceNotConnected); return -1; } if (frame_provider->Id() < kViECaptureIdBase || frame_provider->Id() > kViECaptureIdMax) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, - ViEId(shared_data_->instance_id()), - "%s: No capture device connected to channel %d", - __FUNCTION__, video_channel); shared_data_->SetLastError(kViECaptureDeviceNotConnected); return -1; } @@ -263,16 +213,11 @@ int ViECaptureImpl::DisconnectCaptureDevice(const int video_channel) { int ViECaptureImpl::StartCapture(const int capture_id, const CaptureCapability& capture_capability) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(capture_id: %d)", __FUNCTION__, capture_id); + LOG(LS_ERROR) << "StartCapture " << capture_id; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } @@ -288,28 +233,22 @@ int ViECaptureImpl::StartCapture(const int capture_id, } int ViECaptureImpl::StopCapture(const int capture_id) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(capture_id: %d)", __FUNCTION__, capture_id); + LOG(LS_INFO) << "StopCapture " << capture_id; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } if (!vie_capture->Started()) { shared_data_->SetLastError(kViECaptureDeviceNotStarted); - return -1; + return 0; } if (vie_capture->Stop() != 0) { shared_data_->SetLastError(kViECaptureDeviceUnknownError); return -1; } - return 0; } @@ -331,16 +270,12 @@ int ViECaptureImpl::SetRotateCapturedFrames( i_rotation = 270; break; } - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(rotation: %d)", __FUNCTION__, i_rotation); + LOG(LS_INFO) << "SetRotateCaptureFrames for " << capture_id + << ", rotation " << i_rotation; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } @@ -353,17 +288,12 @@ int ViECaptureImpl::SetRotateCapturedFrames( int ViECaptureImpl::SetCaptureDelay(const int capture_id, const unsigned int capture_delay_ms) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(capture_id: %d, capture_delay_ms %u)", __FUNCTION__, - capture_id, capture_delay_ms); + LOG(LS_INFO) << "SetCaptureDelay " << capture_delay_ms + << ", for device " << capture_id; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } @@ -378,8 +308,6 @@ int ViECaptureImpl::SetCaptureDelay(const int capture_id, int ViECaptureImpl::NumberOfCapabilities( const char* unique_idUTF8, const unsigned int unique_idUTF8Length) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(capture_device_name: %s)", __FUNCTION__, unique_idUTF8); #if defined(WEBRTC_MAC) // TODO(mflodman) Move to capture module! @@ -387,9 +315,7 @@ int ViECaptureImpl::NumberOfCapabilities( // automatically (mandatory). // Thus this function cannot be supported on the Mac platform. shared_data_->SetLastError(kViECaptureDeviceMacQtkitNotSupported); - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s This API is not supported on Mac OS", __FUNCTION__, - shared_data_->instance_id()); + LOG_F(LS_ERROR) << "API not supported on Mac OS X."; return -1; #endif return shared_data_->input_manager()->NumberOfCaptureCapabilities( @@ -401,18 +327,14 @@ int ViECaptureImpl::GetCaptureCapability(const char* unique_idUTF8, const unsigned int unique_idUTF8Length, const unsigned int capability_number, CaptureCapability& capability) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(capture_device_name: %s)", __FUNCTION__, unique_idUTF8); #if defined(WEBRTC_MAC) // TODO(mflodman) Move to capture module! // QTKit framework handles all capabilities and capture settings // automatically (mandatory). // Thus this function cannot be supported on the Mac platform. + LOG_F(LS_ERROR) << "API not supported on Mac OS X."; shared_data_->SetLastError(kViECaptureDeviceMacQtkitNotSupported); - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s This API is not supported on Mac OS", __FUNCTION__, - shared_data_->instance_id()); return -1; #endif if (shared_data_->input_manager()->GetCaptureCapability( @@ -436,15 +358,9 @@ int ViECaptureImpl::ShowCaptureSettingsDialogBox( // automatically (mandatory). // Thus this function cannot be supported on the Mac platform. shared_data_->SetLastError(kViECaptureDeviceMacQtkitNotSupported); - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s This API is not supported on Mac OS", __FUNCTION__, - shared_data_->instance_id()); + LOG_F(LS_ERROR) << "API not supported on Mac OS X."; return -1; #endif - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s capture_id (capture_device_name: %s)", __FUNCTION__, - unique_idUTF8); - return shared_data_->input_manager()->DisplayCaptureSettingsDialogBox( unique_idUTF8, dialog_title, parent_window, x, y); @@ -452,8 +368,6 @@ int ViECaptureImpl::ShowCaptureSettingsDialogBox( int ViECaptureImpl::GetOrientation(const char* unique_idUTF8, RotateCapturedFrame& orientation) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s (capture_device_name: %s)", __FUNCTION__, unique_idUTF8); if (shared_data_->input_manager()->GetOrientation( unique_idUTF8, orientation) != 0) { @@ -466,13 +380,11 @@ int ViECaptureImpl::GetOrientation(const char* unique_idUTF8, int ViECaptureImpl::EnableBrightnessAlarm(const int capture_id, const bool enable) { + LOG(LS_INFO) << "EnableBrightnessAlarm for device " << capture_id + << ", status " << enable; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } @@ -485,20 +397,15 @@ int ViECaptureImpl::EnableBrightnessAlarm(const int capture_id, int ViECaptureImpl::RegisterObserver(const int capture_id, ViECaptureObserver& observer) { + LOG(LS_INFO) << "Register capture observer " << capture_id; ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } if (vie_capture->IsObserverRegistered()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Observer already registered", __FUNCTION__); + LOG_F(LS_ERROR) << "Observer already registered."; shared_data_->SetLastError(kViECaptureObserverAlreadyRegistered); return -1; } @@ -513,10 +420,6 @@ int ViECaptureImpl::DeregisterObserver(const int capture_id) { ViEInputManagerScoped is(*(shared_data_->input_manager())); ViECapturer* vie_capture = is.Capture(capture_id); if (!vie_capture) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), capture_id), - "%s: Capture device %d doesn't exist", __FUNCTION__, - capture_id); shared_data_->SetLastError(kViECaptureDeviceDoesNotExist); return -1; } diff --git a/video_engine/vie_capturer.cc b/video_engine/vie_capturer.cc index d8f81e34..5f0696dd 100644 --- a/video_engine/vie_capturer.cc +++ b/video_engine/vie_capturer.cc @@ -19,8 +19,8 @@ #include "webrtc/system_wrappers/interface/clock.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/thread_wrapper.h" -#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/system_wrappers/interface/trace_event.h" #include "webrtc/video_engine/include/vie_image_process.h" #include "webrtc/video_engine/overuse_frame_detector.h" @@ -59,23 +59,14 @@ ViECapturer::ViECapturer(int capture_id, observer_cs_(CriticalSectionWrapper::CreateCriticalSection()), observer_(NULL), overuse_detector_(new OveruseFrameDetector(Clock::GetRealTimeClock())) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id, capture_id), - "ViECapturer::ViECapturer(capture_id: %d, engine_id: %d)", - capture_id, engine_id); unsigned int t_id = 0; - if (capture_thread_.Start(t_id)) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id, capture_id), - "%s: thread started: %u", __FUNCTION__, t_id); - } else { + if (!capture_thread_.Start(t_id)) { assert(false); } module_process_thread_.RegisterModule(overuse_detector_.get()); } ViECapturer::~ViECapturer() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id_, capture_id_), - "ViECapturer::~ViECapturer() - capture_id: %d, engine_id: %d", - capture_id_, engine_id_); module_process_thread_.DeRegisterModule(overuse_detector_.get()); // Stop the thread. @@ -100,10 +91,6 @@ ViECapturer::~ViECapturer() { delete &deliver_event_; } else { assert(false); - WEBRTC_TRACE(kTraceMemory, kTraceVideoRenderer, - ViEId(engine_id_, capture_id_), - "%s: Not able to stop capture thread for device %d, leaking", - __FUNCTION__, capture_id_); } if (image_proc_module_) { @@ -206,8 +193,6 @@ int ViECapturer::FrameCallbackChanged() { } int32_t ViECapturer::Start(const CaptureCapability& capture_capability) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), "%s", - __FUNCTION__); int width; int height; int frame_rate; @@ -244,15 +229,11 @@ int32_t ViECapturer::Start(const CaptureCapability& capture_capability) { } int32_t ViECapturer::Stop() { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), "%s", - __FUNCTION__); requested_capability_ = CaptureCapability(); return capture_module_->StopCapture(); } bool ViECapturer::Started() { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), "%s", - __FUNCTION__); return capture_module_->CaptureStarted(); } @@ -310,10 +291,6 @@ int ViECapturer::IncomingFrame(unsigned char* video_frame, uint16_t height, RawVideoType video_type, unsigned long long capture_time) { // NOLINT - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "ExternalCapture::IncomingFrame width %d, height %d, " - "capture_time %u", width, height, capture_time); - if (!external_capture_module_) { return -1; } @@ -328,11 +305,6 @@ int ViECapturer::IncomingFrame(unsigned char* video_frame, int ViECapturer::IncomingFrameI420(const ViEVideoFrameI420& video_frame, unsigned long long capture_time) { // NOLINT - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "ExternalCapture::IncomingFrame width %d, height %d, " - " capture_time %u", video_frame.width, video_frame.height, - capture_time); - if (!external_capture_module_) { return -1; } @@ -354,10 +326,7 @@ int ViECapturer::IncomingFrameI420(const ViEVideoFrameI420& video_frame, video_frame.v_pitch); if (ret < 0) { - WEBRTC_TRACE(kTraceError, - kTraceVideo, - ViEId(engine_id_, capture_id_), - "Failed to create I420VideoFrame"); + LOG_F(LS_ERROR) << "Could not create I420Frame."; return -1; } @@ -372,8 +341,6 @@ void ViECapturer::SwapFrame(I420VideoFrame* frame) { void ViECapturer::OnIncomingCapturedFrame(const int32_t capture_id, I420VideoFrame& video_frame) { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s(capture_id: %d)", __FUNCTION__, capture_id); CriticalSectionScoped cs(capture_cs_.get()); // Make sure we render this frame earlier since we know the render time set // is slightly off since it's being set when the frame has been received from @@ -392,9 +359,8 @@ void ViECapturer::OnIncomingCapturedFrame(const int32_t capture_id, void ViECapturer::OnCaptureDelayChanged(const int32_t id, const int32_t delay) { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s(capture_id: %d) delay %d", __FUNCTION__, capture_id_, - delay); + LOG(LS_INFO) << "Capture delayed change to " << delay + << " for device " << id; // Deliver the network delay to all registered callbacks. ViEFrameProviderBase::SetFrameDelay(delay); @@ -404,26 +370,9 @@ int32_t ViECapturer::RegisterEffectFilter( ViEEffectFilter* effect_filter) { CriticalSectionScoped cs(deliver_cs_.get()); - if (!effect_filter) { - if (!effect_filter_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: no effect filter added for capture device %d", - __FUNCTION__, capture_id_); - return -1; - } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: deregister effect filter for device %d", __FUNCTION__, - capture_id_); - } else { - if (effect_filter_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: effect filter already added for capture device %d", - __FUNCTION__, capture_id_); - return -1; - } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: register effect filter for device %d", __FUNCTION__, - capture_id_); + if (effect_filter != NULL && effect_filter_ != NULL) { + LOG_F(LS_ERROR) << "Effect filter already registered."; + return -1; } effect_filter_ = effect_filter; return 0; @@ -435,9 +384,7 @@ int32_t ViECapturer::IncImageProcRefCount() { image_proc_module_ = VideoProcessingModule::Create( ViEModuleId(engine_id_, capture_id_)); if (!image_proc_module_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: could not create video processing module", - __FUNCTION__); + LOG_F(LS_ERROR) << "Could not create video processing module."; return -1; } } @@ -456,10 +403,6 @@ int32_t ViECapturer::DecImageProcRefCount() { } int32_t ViECapturer::EnableDenoising(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s(capture_device_id: %d, enable: %d)", __FUNCTION__, - capture_id_, enable); - CriticalSectionScoped cs(deliver_cs_.get()); if (enable) { if (denoising_enabled_) { @@ -478,20 +421,13 @@ int32_t ViECapturer::EnableDenoising(bool enable) { denoising_enabled_ = false; DecImageProcRefCount(); } - return 0; } int32_t ViECapturer::EnableDeflickering(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s(capture_device_id: %d, enable: %d)", __FUNCTION__, - capture_id_, enable); - CriticalSectionScoped cs(deliver_cs_.get()); if (enable) { if (deflicker_frame_stats_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: deflickering already enabled", __FUNCTION__); return -1; } if (IncImageProcRefCount() != 0) { @@ -500,8 +436,6 @@ int32_t ViECapturer::EnableDeflickering(bool enable) { deflicker_frame_stats_ = new VideoProcessingModule::FrameStats(); } else { if (deflicker_frame_stats_ == NULL) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: deflickering not enabled", __FUNCTION__); return -1; } DecImageProcRefCount(); @@ -512,15 +446,9 @@ int32_t ViECapturer::EnableDeflickering(bool enable) { } int32_t ViECapturer::EnableBrightnessAlarm(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s(capture_device_id: %d, enable: %d)", __FUNCTION__, - capture_id_, enable); - CriticalSectionScoped cs(deliver_cs_.get()); if (enable) { if (brightness_frame_stats_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: BrightnessAlarm already enabled", __FUNCTION__); return -1; } if (IncImageProcRefCount() != 0) { @@ -530,8 +458,6 @@ int32_t ViECapturer::EnableBrightnessAlarm(bool enable) { } else { DecImageProcRefCount(); if (brightness_frame_stats_ == NULL) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: deflickering not enabled", __FUNCTION__); return -1; } delete brightness_frame_stats_; @@ -578,9 +504,7 @@ void ViECapturer::DeliverI420Frame(I420VideoFrame* video_frame) { *video_frame) == 0) { image_proc_module_->Deflickering(video_frame, deflicker_frame_stats_); } else { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: could not get frame stats for captured frame", - __FUNCTION__); + LOG_F(LS_ERROR) << "Could not get frame stats."; } } if (denoising_enabled_) { @@ -603,8 +527,7 @@ void ViECapturer::DeliverI420Frame(I420VideoFrame* video_frame) { current_brightness_level_ = Bright; break; default: - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, capture_id_), - "%s: Brightness detection failed", __FUNCTION__); + break; } } } @@ -643,12 +566,7 @@ int32_t ViECapturer::RegisterObserver(ViECaptureObserver* observer) { { CriticalSectionScoped cs(observer_cs_.get()); if (observer_) { - WEBRTC_TRACE(kTraceError, - kTraceVideo, - ViEId(engine_id_, capture_id_), - "%s Observer already registered", - __FUNCTION__, - capture_id_); + LOG_F(LS_ERROR) << "Observer already registered."; return -1; } observer_ = observer; @@ -676,17 +594,13 @@ bool ViECapturer::IsObserverRegistered() { void ViECapturer::OnCaptureFrameRate(const int32_t id, const uint32_t frame_rate) { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_), - "OnCaptureFrameRate %d", frame_rate); - CriticalSectionScoped cs(observer_cs_.get()); observer_->CapturedFrameRate(id_, static_cast<uint8_t>(frame_rate)); } void ViECapturer::OnNoPictureAlarm(const int32_t id, const VideoCaptureAlarm alarm) { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, capture_id_), - "OnNoPictureAlarm %d", alarm); + LOG(LS_WARNING) << "OnNoPictureAlarm " << id; CriticalSectionScoped cs(observer_cs_.get()); CaptureAlarm vie_alarm = (alarm == Raised) ? AlarmRaised : AlarmCleared; diff --git a/video_engine/vie_channel.cc b/video_engine/vie_channel.cc index 17573af0..615b2b1c 100644 --- a/video_engine/vie_channel.cc +++ b/video_engine/vie_channel.cc @@ -24,8 +24,8 @@ #include "webrtc/modules/video_processing/main/interface/video_processing.h" #include "webrtc/modules/video_render/include/video_render_defines.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/thread_wrapper.h" -#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/video_engine/call_stats.h" #include "webrtc/video_engine/include/vie_codec.h" #include "webrtc/video_engine/include/vie_errors.h" @@ -104,10 +104,6 @@ ViEChannel::ViEChannel(int32_t channel_id, max_nack_reordering_threshold_(kMaxPacketAgeToNack), pre_render_callback_(NULL), config_(config) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id, channel_id), - "ViEChannel::ViEChannel(channel_id: %d, engine_id: %d)", - channel_id, engine_id); - RtpRtcp::Configuration configuration; configuration.id = ViEModuleId(engine_id, channel_id); configuration.audio = false; @@ -127,81 +123,36 @@ ViEChannel::ViEChannel(int32_t channel_id, } int32_t ViEChannel::Init() { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: channel_id: %d, engine_id: %d)", __FUNCTION__, channel_id_, - engine_id_); - if (module_process_thread_.RegisterModule( vie_receiver_.GetReceiveStatistics()) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Failed to register receive-statistics to process thread", - __FUNCTION__); return -1; } // RTP/RTCP initialization. if (rtp_rtcp_->SetSendingMediaStatus(false) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP::SetSendingMediaStatus failure", __FUNCTION__); return -1; } if (module_process_thread_.RegisterModule(rtp_rtcp_.get()) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP::RegisterModule failure", __FUNCTION__); return -1; } - if (rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqFirRtp) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP::SetKeyFrameRequestMethod failure", __FUNCTION__); - } - if (rtp_rtcp_->SetRTCPStatus(kRtcpCompound) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP::SetRTCPStatus failure", __FUNCTION__); - } + rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqFirRtp); + rtp_rtcp_->SetRTCPStatus(kRtcpCompound); if (paced_sender_) { - if (rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_) != - 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s:SetStorePacketsStatus failure", __FUNCTION__); - } + rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_); } - // VCM initialization if (vcm_.InitializeReceiver() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: VCM::InitializeReceiver failure", __FUNCTION__); return -1; } if (vcm_.SetVideoProtection(kProtectionKeyOnLoss, true)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::SetVideoProtection failure", __FUNCTION__); return -1; } if (vcm_.RegisterReceiveCallback(this) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::RegisterReceiveCallback failure", __FUNCTION__); return -1; } - if (vcm_.RegisterFrameTypeCallback(this) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::RegisterFrameTypeCallback failure", __FUNCTION__); - } - if (vcm_.RegisterReceiveStatisticsCallback(this) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::RegisterReceiveStatisticsCallback failure", - __FUNCTION__); - } - if (vcm_.RegisterDecoderTimingCallback(this) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::RegisterDecoderTimingCallback failure", - __FUNCTION__); - } - if (vcm_.SetRenderDelay(kViEDefaultRenderDelayMs) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::SetRenderDelay failure", __FUNCTION__); - } + vcm_.RegisterFrameTypeCallback(this); + vcm_.RegisterReceiveStatisticsCallback(this); + vcm_.RegisterDecoderTimingCallback(this); + vcm_.SetRenderDelay(kViEDefaultRenderDelayMs); if (module_process_thread_.RegisterModule(&vcm_) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: VCM::RegisterModule(vcm) failure", __FUNCTION__); return -1; } #ifdef VIDEOCODEC_VP8 @@ -224,10 +175,6 @@ int32_t ViEChannel::Init() { } ViEChannel::~ViEChannel() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id_, channel_id_), - "ViEChannel Destructor, channel_id: %d, engine_id: %d", - channel_id_, engine_id_); - // Make sure we don't get more callbacks from the RTP module. module_process_thread_.DeRegisterModule(vie_receiver_.GetReceiveStatistics()); module_process_thread_.DeRegisterModule(rtp_rtcp_.get()); @@ -254,22 +201,17 @@ ViEChannel::~ViEChannel() { int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, bool new_stream) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: codec_type: %d", __FUNCTION__, video_codec.codecType); - if (!sender_) { return 0; } if (video_codec.codecType == kVideoCodecRED || video_codec.codecType == kVideoCodecULPFEC) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: codec_type: %d is not a valid send codec.", __FUNCTION__, - video_codec.codecType); + LOG_F(LS_ERROR) << "Not a valid send codec " << video_codec.codecType; return -1; } if (kMaxSimulcastStreams < video_codec.numberOfSimulcastStreams) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Too many simulcast streams", __FUNCTION__); + LOG_F(LS_ERROR) << "Incorrect config " + << video_codec.numberOfSimulcastStreams; return -1; } // Update the RTP module with the settings. @@ -327,10 +269,7 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, // Silently ignore error. module_process_thread_.RegisterModule(rtp_rtcp); - if (rtp_rtcp->SetRTCPStatus(rtp_rtcp_->RTCP()) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTP::SetRTCPStatus failure", __FUNCTION__); - } + rtp_rtcp->SetRTCPStatus(rtp_rtcp_->RTCP()); if (rtp_rtcp_->StorePackets()) { rtp_rtcp->SetStorePacketsStatus(true, nack_history_size_sender_); @@ -370,8 +309,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, RtpRtcp* rtp_rtcp = *it; rtp_rtcp->DeRegisterSendPayload(video_codec.plType); if (rtp_rtcp->RegisterSendPayload(video_codec) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not register payload type", __FUNCTION__); return -1; } if (mtu_ != 0) { @@ -388,9 +325,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, if (rtp_rtcp->RegisterSendRtpHeaderExtension( kRtpExtensionTransmissionTimeOffset, send_timestamp_extension_id_) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not register transmission time extension", - __FUNCTION__); } } else { rtp_rtcp->DeregisterSendRtpHeaderExtension( @@ -403,9 +337,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, if (rtp_rtcp->RegisterSendRtpHeaderExtension( kRtpExtensionAbsoluteSendTime, absolute_send_time_extension_id_) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not register absolute send time extension", - __FUNCTION__); } } else { rtp_rtcp->DeregisterSendRtpHeaderExtension( @@ -456,8 +387,6 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, // registered or not... rtp_rtcp_->DeRegisterSendPayload(video_codec.plType); if (rtp_rtcp_->RegisterSendPayload(video_codec) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not register payload type", __FUNCTION__); return -1; } if (restart_rtp) { @@ -472,13 +401,7 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, } int32_t ViEChannel::SetReceiveCodec(const VideoCodec& video_codec) { - // We will not receive simulcast streams, so no need to handle that use case. - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - if (!vie_receiver_.SetReceiveCodec(video_codec)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not register receive payload type", __FUNCTION__); return -1; } @@ -487,8 +410,6 @@ int32_t ViEChannel::SetReceiveCodec(const VideoCodec& video_codec) { // Register codec type with VCM, but do not register RED or ULPFEC. if (vcm_.RegisterReceiveCodec(&video_codec, number_of_cores_, wait_for_key_frame_) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not register decoder", __FUNCTION__); return -1; } } @@ -496,12 +417,7 @@ int32_t ViEChannel::SetReceiveCodec(const VideoCodec& video_codec) { } int32_t ViEChannel::GetReceiveCodec(VideoCodec* video_codec) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - if (vcm_.ReceiveCodec(video_codec) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get receive codec", __FUNCTION__); return -1; } return 0; @@ -511,21 +427,11 @@ int32_t ViEChannel::RegisterCodecObserver(ViEDecoderObserver* observer) { CriticalSectionScoped cs(callback_cs_.get()); if (observer) { if (codec_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: already added", __FUNCTION__); + LOG_F(LS_ERROR) << "Observer already registered."; return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer added", __FUNCTION__); codec_observer_ = observer; } else { - if (!codec_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: no observer added", __FUNCTION__); - return -1; - } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer removed", __FUNCTION__); codec_observer_ = NULL; } return 0; @@ -535,25 +441,15 @@ int32_t ViEChannel::RegisterExternalDecoder(const uint8_t pl_type, VideoDecoder* decoder, bool buffered_rendering, int32_t render_delay) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - int32_t result; result = vcm_.RegisterExternalDecoder(decoder, pl_type, buffered_rendering); if (result != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not register external decoder with VCM.", - __FUNCTION__); return result; } return vcm_.SetRenderDelay(render_delay); } -int32_t ViEChannel::DeRegisterExternalDecoder( - const uint8_t pl_type) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s pl_type", __FUNCTION__, pl_type); - +int32_t ViEChannel::DeRegisterExternalDecoder(const uint8_t pl_type) { VideoCodec current_receive_codec; int32_t result = 0; result = vcm_.ReceiveCodec(¤t_receive_codec); @@ -568,15 +464,10 @@ int32_t ViEChannel::DeRegisterExternalDecoder( return result; } -int32_t ViEChannel::ReceiveCodecStatistics( - uint32_t* num_key_frames, uint32_t* num_delta_frames) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - +int32_t ViEChannel::ReceiveCodecStatistics(uint32_t* num_key_frames, + uint32_t* num_delta_frames) { VCMFrameCount received_frames; if (vcm_.ReceivedFrameCount(received_frames) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get received frame information", __FUNCTION__); return -1; } *num_key_frames = received_frames.numKeyFrames; @@ -585,8 +476,6 @@ int32_t ViEChannel::ReceiveCodecStatistics( } uint32_t ViEChannel::DiscardedPackets() const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); return vcm_.DiscardedPackets(); } @@ -595,29 +484,21 @@ int ViEChannel::ReceiveDelay() const { } int32_t ViEChannel::WaitForKeyFrame(bool wait) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(wait: %d)", __FUNCTION__, wait); wait_for_key_frame_ = wait; return 0; } int32_t ViEChannel::SetSignalPacketLossStatus(bool enable, bool only_key_frames) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(enable: %d)", __FUNCTION__, enable); if (enable) { if (only_key_frames) { vcm_.SetVideoProtection(kProtectionKeyOnLoss, false); if (vcm_.SetVideoProtection(kProtectionKeyOnKeyLoss, true) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s failed %d", __FUNCTION__, enable); return -1; } } else { vcm_.SetVideoProtection(kProtectionKeyOnKeyLoss, false); if (vcm_.SetVideoProtection(kProtectionKeyOnLoss, true) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s failed %d", __FUNCTION__, enable); return -1; } } @@ -629,9 +510,6 @@ int32_t ViEChannel::SetSignalPacketLossStatus(bool enable, } int32_t ViEChannel::SetRTCPMode(const RTCPMethod rtcp_mode) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %d", __FUNCTION__, rtcp_mode); - CriticalSectionScoped cs(rtp_rtcp_cs_.get()); for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin(); it != simulcast_rtp_rtcp_.end(); @@ -643,21 +521,13 @@ int32_t ViEChannel::SetRTCPMode(const RTCPMethod rtcp_mode) { } int32_t ViEChannel::GetRTCPMode(RTCPMethod* rtcp_mode) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); *rtcp_mode = rtp_rtcp_->RTCP(); return 0; } int32_t ViEChannel::SetNACKStatus(const bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(enable: %d)", __FUNCTION__, enable); - // Update the decoding VCM. if (vcm_.SetVideoProtection(kProtectionNack, enable) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not set VCM NACK protection: %d", __FUNCTION__, - enable); return -1; } if (enable) { @@ -666,31 +536,19 @@ int32_t ViEChannel::SetNACKStatus(const bool enable) { } // Update the decoding VCM. if (vcm_.SetVideoProtection(kProtectionNack, enable) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not set VCM NACK protection: %d", __FUNCTION__, - enable); return -1; } return ProcessNACKRequest(enable); } int32_t ViEChannel::ProcessNACKRequest(const bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(enable: %d)", __FUNCTION__, enable); - if (enable) { // Turn on NACK. - NACKMethod nackMethod = kNackRtcp; if (rtp_rtcp_->RTCP() == kRtcpOff) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not enable NACK, RTPC not on ", __FUNCTION__); return -1; } vie_receiver_.SetNackStatus(true, max_nack_reordering_threshold_); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Using NACK method %d", __FUNCTION__, nackMethod); rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_); - vcm_.RegisterPacketRequestCallback(this); CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -740,15 +598,8 @@ int32_t ViEChannel::ProcessFECRequest( const bool enable, const unsigned char payload_typeRED, const unsigned char payload_typeFEC) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(enable: %d, payload_typeRED: %u, payload_typeFEC: %u)", - __FUNCTION__, enable, payload_typeRED, payload_typeFEC); - if (rtp_rtcp_->SetGenericFECStatus(enable, payload_typeRED, payload_typeFEC) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not change FEC status to %d", __FUNCTION__, - enable); return -1; } CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -765,11 +616,7 @@ int32_t ViEChannel::SetHybridNACKFECStatus( const bool enable, const unsigned char payload_typeRED, const unsigned char payload_typeFEC) { - // Update the decoding VCM with hybrid mode. if (vcm_.SetVideoProtection(kProtectionNackFEC, enable) != VCM_OK) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not set VCM NACK protection: %d", __FUNCTION__, - enable); return -1; } @@ -783,9 +630,7 @@ int32_t ViEChannel::SetHybridNACKFECStatus( int ViEChannel::SetSenderBufferingMode(int target_delay_ms) { if ((target_delay_ms < 0) || (target_delay_ms > kMaxTargetDelayMs)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Target sender buffering delay out of bounds: %d", - __FUNCTION__, target_delay_ms); + LOG(LS_ERROR) << "Invalid send buffer value."; return -1; } if (target_delay_ms == 0) { @@ -801,13 +646,9 @@ int ViEChannel::SetSenderBufferingMode(int target_delay_ms) { // Setting nack_history_size_. // First disabling (forcing free) and then resetting to desired value. if (rtp_rtcp_->SetStorePacketsStatus(false, 0) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s:SetStorePacketsStatus failure", __FUNCTION__); return -1; } if (rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s:SetStorePacketsStatus failure", __FUNCTION__); return -1; } return 0; @@ -815,9 +656,7 @@ int ViEChannel::SetSenderBufferingMode(int target_delay_ms) { int ViEChannel::SetReceiverBufferingMode(int target_delay_ms) { if ((target_delay_ms < 0) || (target_delay_ms > kMaxTargetDelayMs)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Target receiver buffering delay out of bounds: %d", - __FUNCTION__, target_delay_ms); + LOG(LS_ERROR) << "Invalid receive buffer delay value."; return -1; } int max_nack_list_size; @@ -851,14 +690,10 @@ int ViEChannel::GetRequiredNackListSize(int target_delay_ms) { int32_t ViEChannel::SetKeyFrameRequestMethod( const KeyFrameRequestMethod method) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %d", __FUNCTION__, method); return rtp_rtcp_->SetKeyFrameRequestMethod(method); } bool ViEChannel::EnableRemb(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "ViEChannel::EnableRemb: %d", enable); if (rtp_rtcp_->SetREMBStatus(enable) != 0) return false; return true; @@ -945,19 +780,14 @@ void ViEChannel::SetTransmissionSmoothingStatus(bool enable) { } int32_t ViEChannel::EnableTMMBR(const bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %d", __FUNCTION__, enable); return rtp_rtcp_->SetTMMBRStatus(enable); } int32_t ViEChannel::EnableKeyFrameRequestCallback(const bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %d", __FUNCTION__, enable); CriticalSectionScoped cs(callback_cs_.get()); if (enable && !codec_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: No ViECodecObserver set", __FUNCTION__, enable); + LOG(LS_ERROR) << "No ViECodecObserver set."; return -1; } do_key_frame_callbackRequest_ = enable; @@ -967,11 +797,6 @@ int32_t ViEChannel::EnableKeyFrameRequestCallback(const bool enable) { int32_t ViEChannel::SetSSRC(const uint32_t SSRC, const StreamType usage, const uint8_t simulcast_idx) { - WEBRTC_TRACE(webrtc::kTraceInfo, - webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s(usage:%d, SSRC: 0x%x, idx:%u)", - __FUNCTION__, usage, SSRC, simulcast_idx); int rtx_settings = kRtxRetransmitted; if (config_.Get<PaddingStrategy>().redundant_payloads) rtx_settings |= kRtxRedundantPayloads; @@ -1000,21 +825,11 @@ int32_t ViEChannel::SetSSRC(const uint32_t SSRC, int32_t ViEChannel::SetRemoteSSRCType(const StreamType usage, const uint32_t SSRC) { - WEBRTC_TRACE(webrtc::kTraceInfo, - webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s(usage:%d, SSRC: 0x%x)", - __FUNCTION__, usage, SSRC); - vie_receiver_.SetRtxStatus(true, SSRC); return 0; } -// TODO(mflodman) Add kViEStreamTypeRtx. int32_t ViEChannel::GetLocalSSRC(uint8_t idx, unsigned int* ssrc) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - if (idx == 0) { *ssrc = rtp_rtcp_->SSRC(); return 0; @@ -1034,38 +849,23 @@ int32_t ViEChannel::GetLocalSSRC(uint8_t idx, unsigned int* ssrc) { } int32_t ViEChannel::GetRemoteSSRC(uint32_t* ssrc) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - *ssrc = vie_receiver_.GetRemoteSsrc(); return 0; } int32_t ViEChannel::GetRemoteCSRC(uint32_t CSRCs[kRtpCsrcSize]) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - uint32_t arrayCSRC[kRtpCsrcSize]; memset(arrayCSRC, 0, sizeof(arrayCSRC)); int num_csrcs = vie_receiver_.GetCsrcs(arrayCSRC); if (num_csrcs > 0) { memcpy(CSRCs, arrayCSRC, num_csrcs * sizeof(uint32_t)); - for (int idx = 0; idx < num_csrcs; idx++) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "\tCSRC[%d] = %lu", idx, CSRCs[idx]); - } - } else { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: CSRC list is empty", __FUNCTION__); } return 0; } int ViEChannel::SetRtxSendPayloadType(int payload_type) { if (rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: already sending", __FUNCTION__); return -1; } rtp_rtcp_->SetRtxSendPayloadType(payload_type); @@ -1082,38 +882,24 @@ void ViEChannel::SetRtxReceivePayloadType(int payload_type) { } int32_t ViEChannel::SetStartSequenceNumber(uint16_t sequence_number) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - if (rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: already sending", __FUNCTION__); return -1; } return rtp_rtcp_->SetSequenceNumber(sequence_number); } int32_t ViEChannel::SetRTCPCName(const char rtcp_cname[]) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); if (rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: already sending", __FUNCTION__); return -1; } return rtp_rtcp_->SetCNAME(rtcp_cname); } int32_t ViEChannel::GetRTCPCName(char rtcp_cname[]) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); return rtp_rtcp_->CNAME(rtcp_cname); } int32_t ViEChannel::GetRemoteRTCPCName(char rtcp_cname[]) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - uint32_t remoteSSRC = vie_receiver_.GetRemoteSsrc(); return rtp_rtcp_->RemoteCNAME(remoteSSRC, rtcp_cname); } @@ -1122,21 +908,11 @@ int32_t ViEChannel::RegisterRtpObserver(ViERTPObserver* observer) { CriticalSectionScoped cs(callback_cs_.get()); if (observer) { if (rtp_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer alread added", __FUNCTION__); + LOG_F(LS_ERROR) << "Observer already registered."; return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer added", __FUNCTION__); rtp_observer_ = observer; } else { - if (!rtp_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: no observer added", __FUNCTION__); - return -1; - } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer removed", __FUNCTION__); rtp_observer_ = NULL; } return 0; @@ -1146,21 +922,11 @@ int32_t ViEChannel::RegisterRtcpObserver(ViERTCPObserver* observer) { CriticalSectionScoped cs(callback_cs_.get()); if (observer) { if (rtcp_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer alread added", __FUNCTION__); + LOG_F(LS_ERROR) << "Observer already registered."; return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer added", __FUNCTION__); rtcp_observer_ = observer; } else { - if (!rtcp_observer_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: no observer added", __FUNCTION__); - return -1; - } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: observer removed", __FUNCTION__); rtcp_observer_ = NULL; } return 0; @@ -1171,34 +937,25 @@ int32_t ViEChannel::SendApplicationDefinedRTCPPacket( uint32_t name, const uint8_t* data, uint16_t data_length_in_bytes) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); if (!rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: not sending", __FUNCTION__); return -1; } if (!data) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: no input argument", __FUNCTION__); + LOG_F(LS_ERROR) << "Invalid input."; return -1; } if (data_length_in_bytes % 4 != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: input length error", __FUNCTION__); + LOG(LS_ERROR) << "Invalid input length."; return -1; } RTCPMethod rtcp_method = rtp_rtcp_->RTCP(); if (rtcp_method == kRtcpOff) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: RTCP not enabled", __FUNCTION__); + LOG_F(LS_ERROR) << "RTCP not enable."; return -1; } // Create and send packet. if (rtp_rtcp_->SetRTCPApplicationSpecificData(sub_type, name, data, data_length_in_bytes) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not send RTCP application data", __FUNCTION__); return -1; } return 0; @@ -1209,9 +966,6 @@ int32_t ViEChannel::GetSendRtcpStatistics(uint16_t* fraction_lost, uint32_t* extended_max, uint32_t* jitter_samples, int32_t* rtt_ms) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - // TODO(pwestin) how do we do this for simulcast ? average for all // except cumulative_lost that is the sum ? // CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -1229,8 +983,6 @@ int32_t ViEChannel::GetSendRtcpStatistics(uint16_t* fraction_lost, // Otherwise use the first report block. std::vector<RTCPReportBlock> remote_stats; if (rtp_rtcp_->RemoteRTCPStat(&remote_stats) != 0 || remote_stats.empty()) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get remote stats", __FUNCTION__); return -1; } std::vector<RTCPReportBlock>::const_iterator statistics = @@ -1256,8 +1008,6 @@ int32_t ViEChannel::GetSendRtcpStatistics(uint16_t* fraction_lost, uint16_t dummy; uint16_t rtt = 0; if (rtp_rtcp_->RTT(remote_ssrc, &rtt, &dummy, &dummy, &dummy) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get RTT", __FUNCTION__); return -1; } *rtt_ms = rtt; @@ -1266,8 +1016,6 @@ int32_t ViEChannel::GetSendRtcpStatistics(uint16_t* fraction_lost, void ViEChannel::RegisterSendChannelRtcpStatisticsCallback( RtcpStatisticsCallback* callback) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); rtp_rtcp_->RegisterSendChannelRtcpStatisticsCallback(callback); CriticalSectionScoped cs(rtp_rtcp_cs_.get()); for (std::list<RtpRtcp*>::const_iterator it = simulcast_rtp_rtcp_.begin(); @@ -1285,17 +1033,12 @@ int32_t ViEChannel::GetReceivedRtcpStatistics(uint16_t* fraction_lost, uint32_t* extended_max, uint32_t* jitter_samples, int32_t* rtt_ms) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - uint32_t remote_ssrc = vie_receiver_.GetRemoteSsrc(); StreamStatistician* statistician = vie_receiver_.GetReceiveStatistics()->GetStatistician(remote_ssrc); RtcpStatistics receive_stats; if (!statistician || !statistician->GetStatistics( &receive_stats, rtp_rtcp_->RTCP() == kRtcpOff)) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get received RTP statistics", __FUNCTION__); return -1; } *fraction_lost = receive_stats.fraction_lost; @@ -1305,21 +1048,13 @@ int32_t ViEChannel::GetReceivedRtcpStatistics(uint16_t* fraction_lost, uint16_t dummy = 0; uint16_t rtt = 0; - if (rtp_rtcp_->RTT(remote_ssrc, &rtt, &dummy, &dummy, &dummy) != 0) { - WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get RTT", __FUNCTION__); - } + rtp_rtcp_->RTT(remote_ssrc, &rtt, &dummy, &dummy, &dummy); *rtt_ms = rtt; return 0; } void ViEChannel::RegisterReceiveChannelRtcpStatisticsCallback( RtcpStatisticsCallback* callback) { - WEBRTC_TRACE(kTraceInfo, - kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s", - __FUNCTION__); vie_receiver_.GetReceiveStatistics()->RegisterRtcpStatisticsCallback( callback); } @@ -1328,9 +1063,6 @@ int32_t ViEChannel::GetRtpStatistics(uint32_t* bytes_sent, uint32_t* packets_sent, uint32_t* bytes_received, uint32_t* packets_received) const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - StreamStatistician* statistician = vie_receiver_.GetReceiveStatistics()-> GetStatistician(vie_receiver_.GetRemoteSsrc()); *bytes_received = 0; @@ -1338,8 +1070,6 @@ int32_t ViEChannel::GetRtpStatistics(uint32_t* bytes_sent, if (statistician) statistician->GetDataCounters(bytes_received, packets_received); if (rtp_rtcp_->DataCountersRTP(bytes_sent, packets_sent) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not get counters", __FUNCTION__); return -1; } CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -1358,8 +1088,6 @@ int32_t ViEChannel::GetRtpStatistics(uint32_t* bytes_sent, void ViEChannel::RegisterSendChannelRtpStatisticsCallback( StreamDataCountersCallback* callback) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); rtp_rtcp_->RegisterSendChannelRtpStatisticsCallback(callback); { CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -1373,11 +1101,6 @@ void ViEChannel::RegisterSendChannelRtpStatisticsCallback( void ViEChannel::RegisterReceiveChannelRtpStatisticsCallback( StreamDataCountersCallback* callback) { - WEBRTC_TRACE(kTraceInfo, - kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s", - __FUNCTION__); vie_receiver_.GetReceiveStatistics()->RegisterRtpStatisticsCallback(callback); } @@ -1409,9 +1132,6 @@ void ViEChannel::GetBandwidthUsage(uint32_t* total_bitrate_sent, uint32_t* video_bitrate_sent, uint32_t* fec_bitrate_sent, uint32_t* nackBitrateSent) const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - rtp_rtcp_->BitrateSent(total_bitrate_sent, video_bitrate_sent, fec_bitrate_sent, nackBitrateSent); CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -1432,9 +1152,6 @@ void ViEChannel::GetBandwidthUsage(uint32_t* total_bitrate_sent, bool ViEChannel::GetSendSideDelay(int* avg_send_delay, int* max_send_delay) const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - *avg_send_delay = 0; *max_send_delay = 0; bool valid_estimate = false; @@ -1486,16 +1203,7 @@ void ViEChannel::GetReceiveBandwidthEstimatorStats( } int32_t ViEChannel::StartRTPDump(const char file_nameUTF8[1024], - RTPDirections direction) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - - if (direction != kRtpIncoming && direction != kRtpOutgoing) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: invalid input", __FUNCTION__); - return -1; - } - + RTPDirections direction) { if (direction == kRtpIncoming) { return vie_receiver_.StartRTPDump(file_nameUTF8); } else { @@ -1504,15 +1212,6 @@ int32_t ViEChannel::StartRTPDump(const char file_nameUTF8[1024], } int32_t ViEChannel::StopRTPDump(RTPDirections direction) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - - if (direction != kRtpIncoming && direction != kRtpOutgoing) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: invalid input", __FUNCTION__); - return -1; - } - if (direction == kRtpIncoming) { return vie_receiver_.StopRTPDump(); } else { @@ -1522,25 +1221,16 @@ int32_t ViEChannel::StopRTPDump(RTPDirections direction) { int32_t ViEChannel::StartSend() { CriticalSectionScoped cs(callback_cs_.get()); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); - if (!external_transport_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: send sockets not initialized", __FUNCTION__); + LOG(LS_ERROR) << "No transport set."; return -1; } rtp_rtcp_->SetSendingMediaStatus(true); if (rtp_rtcp_->Sending()) { - // Already sending. - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Already sending", __FUNCTION__); return kViEBaseAlreadySending; } if (rtp_rtcp_->SetSendingStatus(true) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Could not start sending RTP", __FUNCTION__); return -1; } CriticalSectionScoped cs_rtp(rtp_rtcp_cs_.get()); @@ -1555,9 +1245,6 @@ int32_t ViEChannel::StartSend() { } int32_t ViEChannel::StopSend() { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - CriticalSectionScoped cs(rtp_rtcp_cs_.get()); rtp_rtcp_->SetSendingMediaStatus(false); for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin(); @@ -1567,16 +1254,12 @@ int32_t ViEChannel::StopSend() { rtp_rtcp->SetSendingMediaStatus(false); } if (!rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Not sending", __FUNCTION__); return kViEBaseNotSending; } // Reset. rtp_rtcp_->ResetSendDataCountersRTP(); if (rtp_rtcp_->SetSendingStatus(false) != 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not stop RTP sending", __FUNCTION__); return -1; } for (std::list<RtpRtcp*>::iterator it = simulcast_rtp_rtcp_.begin(); @@ -1595,13 +1278,7 @@ bool ViEChannel::Sending() { int32_t ViEChannel::StartReceive() { CriticalSectionScoped cs(callback_cs_.get()); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - if (StartDecodeThread() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not start decoder thread", __FUNCTION__); - vie_receiver_.StopReceive(); return -1; } @@ -1610,9 +1287,6 @@ int32_t ViEChannel::StartReceive() { } int32_t ViEChannel::StopReceive() { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - vie_receiver_.StopReceive(); StopDecodeThread(); vcm_.ResetDecoder(); @@ -1620,43 +1294,27 @@ int32_t ViEChannel::StopReceive() { } int32_t ViEChannel::RegisterSendTransport(Transport* transport) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - if (rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Sending", __FUNCTION__); return -1; } CriticalSectionScoped cs(callback_cs_.get()); if (external_transport_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: transport already registered", __FUNCTION__); + LOG_F(LS_ERROR) << "Transport already registered."; return -1; } external_transport_ = transport; vie_sender_.RegisterSendTransport(transport); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Transport registered: 0x%p", __FUNCTION__, - &external_transport_); - return 0; } int32_t ViEChannel::DeregisterSendTransport() { CriticalSectionScoped cs(callback_cs_.get()); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - if (!external_transport_) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: no transport registered", __FUNCTION__); - return -1; + return 0; } if (rtp_rtcp_->Sending()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: Sending", __FUNCTION__); + LOG_F(LS_ERROR) << "Can't deregister transport when sending."; return -1; } external_transport_ = NULL; @@ -1689,10 +1347,7 @@ int32_t ViEChannel::ReceivedRTCPPacket( } int32_t ViEChannel::SetMTU(uint16_t mtu) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); if (rtp_rtcp_->SetMaxTransferUnit(mtu) != 0) { - // Logging done. return -1; } CriticalSectionScoped cs(rtp_rtcp_cs_.get()); @@ -1707,15 +1362,10 @@ int32_t ViEChannel::SetMTU(uint16_t mtu) { } uint16_t ViEChannel::MaxDataPayloadLength() const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); return rtp_rtcp_->MaxDataPayloadLength(); } int32_t ViEChannel::EnableColorEnhancement(bool enable) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(enable: %d)", __FUNCTION__, enable); - CriticalSectionScoped cs(callback_cs_.get()); color_enhancement_ = enable; return 0; @@ -1773,8 +1423,6 @@ int32_t ViEChannel::FrameToRender( arr_ofCSRC[0] = vie_receiver_.GetRemoteSsrc(); no_of_csrcs = 1; } - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(timestamp:%u)", __FUNCTION__, video_frame.timestamp()); DeliverFrame(&video_frame, no_of_csrcs, arr_ofCSRC); return 0; } @@ -1793,9 +1441,6 @@ int32_t ViEChannel::OnReceiveStatisticsUpdate(const uint32_t bit_rate, const uint32_t frame_rate) { CriticalSectionScoped cs(callback_cs_.get()); if (codec_observer_) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: bitrate %u, framerate %u", __FUNCTION__, bit_rate, - frame_rate); codec_observer_->IncomingRate(channel_id_, frame_rate, bit_rate); } return 0; @@ -1821,8 +1466,6 @@ void ViEChannel::OnDecoderTiming(int decode_ms, } int32_t ViEChannel::RequestKeyFrame() { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); { CriticalSectionScoped cs(callback_cs_.get()); if (codec_observer_ && do_key_frame_callbackRequest_) { @@ -1839,8 +1482,6 @@ int32_t ViEChannel::SliceLossIndicationRequest( int32_t ViEChannel::ResendPackets(const uint16_t* sequence_numbers, uint16_t length) { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s(length: %d)", __FUNCTION__, length); return rtp_rtcp_->SendNACK(sequence_numbers, length); } @@ -1867,8 +1508,6 @@ int32_t ViEChannel::StartDecodeThread() { this, kHighestPriority, "DecodingThread"); if (!decode_thread_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not create decode thread", __FUNCTION__); return -1; } @@ -1876,20 +1515,14 @@ int32_t ViEChannel::StartDecodeThread() { if (decode_thread_->Start(thread_id) == false) { delete decode_thread_; decode_thread_ = NULL; - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not start decode thread", __FUNCTION__); + LOG(LS_ERROR) << "Could not start decode thread."; return -1; } - - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: decode thread with id %u started", __FUNCTION__); return 0; } int32_t ViEChannel::StopDecodeThread() { if (!decode_thread_) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: decode thread not running", __FUNCTION__); return 0; } @@ -1897,9 +1530,6 @@ int32_t ViEChannel::StopDecodeThread() { if (decode_thread_->Stop()) { delete decode_thread_; } else { - // Couldn't stop the thread, leak instead of crash. - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: could not stop decode thread", __FUNCTION__); assert(false && "could not stop decode thread"); } decode_thread_ = NULL; @@ -1908,10 +1538,6 @@ int32_t ViEChannel::StopDecodeThread() { int32_t ViEChannel::SetVoiceChannel(int32_t ve_channel_id, VoEVideoSync* ve_sync_interface) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s, audio channel %d, video channel %d", __FUNCTION__, - ve_channel_id, channel_id_); - if (ve_sync_interface) { // Register lip sync module_process_thread_.RegisterModule(&vie_sync_); @@ -1930,26 +1556,9 @@ int32_t ViEChannel::VoiceChannel() { int32_t ViEChannel::RegisterEffectFilter(ViEEffectFilter* effect_filter) { CriticalSectionScoped cs(callback_cs_.get()); - if (!effect_filter) { - if (!effect_filter_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: no effect filter added for channel %d", - __FUNCTION__, channel_id_); - return -1; - } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: deregister effect filter for device %d", __FUNCTION__, - channel_id_); - } else { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: register effect filter for device %d", __FUNCTION__, - channel_id_); - if (effect_filter_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: effect filter already added for channel %d", - __FUNCTION__, channel_id_); - return -1; - } + if (effect_filter && effect_filter_) { + LOG(LS_ERROR) << "Effect filter already registered."; + return -1; } effect_filter_ = effect_filter; return 0; @@ -1973,8 +1582,6 @@ void ViEChannel::OnApplicationDataReceived(const int32_t id, const uint16_t length, const uint8_t* data) { if (channel_id_ != ChannelId(id)) { - WEBRTC_TRACE(kTraceStream, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s, incorrect id", __FUNCTION__, id); return; } CriticalSectionScoped cs(callback_cs_.get()); @@ -1994,9 +1601,8 @@ int32_t ViEChannel::OnInitializeDecoder( const int frequency, const uint8_t channels, const uint32_t rate) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: payload_type %d, payload_name %s", __FUNCTION__, - payload_type, payload_name); + LOG(LS_INFO) << "OnInitializeDecoder " << payload_type << " " + << payload_name; vcm_.ResetDecoder(); CriticalSectionScoped cs(callback_cs_.get()); @@ -2005,16 +1611,7 @@ int32_t ViEChannel::OnInitializeDecoder( } void ViEChannel::OnIncomingSSRCChanged(const int32_t id, const uint32_t ssrc) { - if (channel_id_ != ChannelId(id)) { - assert(false); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s, incorrect id", __FUNCTION__, id); - return; - } - - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %u", __FUNCTION__, ssrc); - + assert(channel_id_ == ChannelId(id)); rtp_rtcp_->SetRemoteSSRC(ssrc); CriticalSectionScoped cs(callback_cs_.get()); @@ -2028,19 +1625,7 @@ void ViEChannel::OnIncomingSSRCChanged(const int32_t id, const uint32_t ssrc) { void ViEChannel::OnIncomingCSRCChanged(const int32_t id, const uint32_t CSRC, const bool added) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %u added: %d", __FUNCTION__, CSRC, added); - - if (channel_id_ != ChannelId(id)) { - assert(false); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s, incorrect id", __FUNCTION__, id); - return; - } - - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), - "%s: %u", __FUNCTION__, CSRC); - + assert(channel_id_ == ChannelId(id)); CriticalSectionScoped cs(callback_cs_.get()); { if (rtp_observer_) { diff --git a/video_engine/vie_channel_group.cc b/video_engine/vie_channel_group.cc index 7cfb4459..35df3bbf 100644 --- a/video_engine/vie_channel_group.cc +++ b/video_engine/vie_channel_group.cc @@ -17,8 +17,8 @@ #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" #include "webrtc/modules/utility/interface/process_thread.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/thread_annotations.h" -#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/video_engine/call_stats.h" #include "webrtc/video_engine/encoder_state_feedback.h" #include "webrtc/video_engine/vie_channel.h" @@ -111,8 +111,8 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator { if (header.extension.hasAbsoluteSendTime) { // If we see AST in header, switch RBE strategy immediately. if (!using_absolute_send_time_) { - WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_), - "WrappingBitrateEstimator: Switching to absolute send time RBE."); + LOG(LS_INFO) << + "WrappingBitrateEstimator: Switching to absolute send time RBE."; using_absolute_send_time_ = true; PickEstimator(); } @@ -122,9 +122,8 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator { if (using_absolute_send_time_) { ++packets_since_absolute_send_time_; if (packets_since_absolute_send_time_ >= kTimeOffsetSwitchThreshold) { - WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, ViEId(engine_id_), - "WrappingBitrateEstimator: Switching to transmission time offset " - "RBE."); + LOG(LS_INFO) << "WrappingBitrateEstimator: Switching to transmission " + << "time offset RBE."; using_absolute_send_time_ = false; PickEstimator(); } diff --git a/video_engine/vie_channel_manager.cc b/video_engine/vie_channel_manager.cc index 2e838724..b2591f4b 100644 --- a/video_engine/vie_channel_manager.cc +++ b/video_engine/vie_channel_manager.cc @@ -15,7 +15,7 @@ #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" #include "webrtc/modules/utility/interface/process_thread.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/video_engine/call_stats.h" #include "webrtc/video_engine/encoder_state_feedback.h" #include "webrtc/video_engine/vie_channel.h" @@ -39,18 +39,12 @@ ViEChannelManager::ViEChannelManager( voice_engine_(NULL), module_process_thread_(NULL), engine_config_(config) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id), - "ViEChannelManager::ViEChannelManager(engine_id: %d)", - engine_id); for (int idx = 0; idx < free_channel_ids_size_; idx++) { free_channel_ids_[idx] = true; } } ViEChannelManager::~ViEChannelManager() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, ViEId(engine_id_), - "ViEChannelManager Destructor, engine_id: %d", engine_id_); - while (channel_map_.size() > 0) { ChannelMap::iterator it = channel_map_.begin(); // DeleteChannel will erase this channel from the map and invalidate |it|. @@ -225,8 +219,6 @@ int ViEChannelManager::DeleteChannel(int channel_id) { ChannelMap::iterator c_it = channel_map_.find(channel_id); if (c_it == channel_map_.end()) { // No such channel. - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_), - "%s Channel doesn't exist: %d", __FUNCTION__, channel_id); return -1; } vie_channel = c_it->second; @@ -276,22 +268,17 @@ int ViEChannelManager::DeleteChannel(int channel_id) { // deleted, which might take time. // If statment just to show that this object is not always deleted. if (vie_encoder) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_), - "%s ViEEncoder deleted for channel %d", __FUNCTION__, - channel_id); + LOG(LS_VERBOSE) << "ViEEncoder deleted for channel " << channel_id; delete vie_encoder; } // If statment just to show that this object is not always deleted. if (group) { // Delete the group if empty last since the encoder holds a pointer to the // BitrateController object that the group owns. - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_), - "%s ChannelGroup deleted for channel %d", __FUNCTION__, - channel_id); + LOG(LS_VERBOSE) << "Channel group deleted for channel " << channel_id; delete group; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_), - "%s Channel %d deleted", __FUNCTION__, channel_id); + LOG(LS_VERBOSE) << "Channel deleted " << channel_id; return 0; } @@ -306,9 +293,6 @@ int ViEChannelManager::SetVoiceEngine(VoiceEngine* voice_engine) { // Get new sync interface. sync_interface = VoEVideoSync::GetInterface(voice_engine); if (!sync_interface) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_), - "%s Can't get audio sync interface from VoiceEngine.", - __FUNCTION__); return -1; } } @@ -329,8 +313,7 @@ int ViEChannelManager::ConnectVoiceChannel(int channel_id, int audio_channel_id) { CriticalSectionScoped cs(channel_id_critsect_); if (!voice_sync_interface_) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id), - "No VoE set"); + LOG_F(LS_ERROR) << "No VoE set."; return -1; } ViEChannel* channel = ViEChannelPtr(channel_id); @@ -438,21 +421,15 @@ bool ViEChannelManager::CreateChannelObject( send_rtp_rtcp_module, sender); if (vie_channel->Init() != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_), - "%s could not init channel", __FUNCTION__, channel_id); delete vie_channel; return false; } VideoCodec encoder; if (vie_encoder->GetEncoder(&encoder) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id), - "%s: Could not GetEncoder.", __FUNCTION__); delete vie_channel; return false; } if (sender && vie_channel->SetSendCodec(encoder) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id), - "%s: Could not SetSendCodec.", __FUNCTION__); delete vie_channel; return false; } @@ -466,8 +443,7 @@ ViEChannel* ViEChannelManager::ViEChannelPtr(int channel_id) const { CriticalSectionScoped cs(channel_id_critsect_); ChannelMap::const_iterator it = channel_map_.find(channel_id); if (it == channel_map_.end()) { - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_), - "%s Channel doesn't exist: %d", __FUNCTION__, channel_id); + LOG(LS_ERROR) << "Channel doesn't exist " << channel_id; return NULL; } return it->second; @@ -492,8 +468,7 @@ int ViEChannelManager::FreeChannelId() { } idx++; } - WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_), - "Max number of channels reached: %d", channel_map_.size()); + LOG(LS_ERROR) << "Max number of channels reached."; return -1; } diff --git a/video_engine/vie_codec_impl.cc b/video_engine/vie_codec_impl.cc index 07aaf72a..d2aaab9e 100644 --- a/video_engine/vie_codec_impl.cc +++ b/video_engine/vie_codec_impl.cc @@ -15,7 +15,6 @@ #include "webrtc/engine_configurations.h" #include "webrtc/modules/video_coding/main/interface/video_coding.h" #include "webrtc/system_wrappers/interface/logging.h" -#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/video_engine/include/vie_errors.h" #include "webrtc/video_engine/vie_capturer.h" #include "webrtc/video_engine/vie_channel.h" @@ -28,6 +27,51 @@ namespace webrtc { +static void LogCodec(const VideoCodec& codec) { + LOG(LS_INFO) << "CodecType " << codec.codecType + << ", pl_type " << codec.plType + << ", resolution " << codec.width + << " x " << codec.height + << ", start br " << codec.startBitrate + << ", min br " << codec.minBitrate + << ", max br " << codec.maxBitrate + << ", max fpr " << codec.maxFramerate + << ", max qp " << codec.qpMax + << ", number of streams " + << codec.numberOfSimulcastStreams; + if (codec.codecType == kVideoCodecVP8) { + LOG(LS_INFO) << "VP8 specific settings"; + LOG(LS_INFO) << "pivtureLossIndicationOn " + << codec.codecSpecific.VP8.pictureLossIndicationOn + << ", feedbackModeOn " + << codec.codecSpecific.VP8.feedbackModeOn + << ", complexity " + << codec.codecSpecific.VP8.complexity + << ", resilience " + << codec.codecSpecific.VP8.resilience + << ", numberOfTeporalLayers " + << codec.codecSpecific.VP8.numberOfTemporalLayers + << ", keyFrameinterval " + << codec.codecSpecific.VP8.keyFrameInterval; + for (int idx = 0; idx < codec.numberOfSimulcastStreams; ++idx) { + LOG(LS_INFO) << "Stream " << codec.simulcastStream[idx].width + << " x " << codec.simulcastStream[idx].height; + LOG(LS_INFO) << "Temporal layers " + << codec.simulcastStream[idx].numberOfTemporalLayers + << ", min br " + << codec.simulcastStream[idx].minBitrate + << ", target br " + << codec.simulcastStream[idx].targetBitrate + << ", max br " + << codec.simulcastStream[idx].maxBitrate + << ", qp max " + << codec.simulcastStream[idx].qpMax; + + } + } +} + + ViECodec* ViECodec::GetInterface(VideoEngine* video_engine) { #ifdef WEBRTC_VIDEO_ENGINE_CODEC_API if (!video_engine) { @@ -44,45 +88,33 @@ ViECodec* ViECodec::GetInterface(VideoEngine* video_engine) { } int ViECodecImpl::Release() { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(), - "ViECodecImpl::Release()"); + LOG(LS_INFO) << "ViECodec::Release."; // Decrease ref count. (*this)--; int32_t ref_count = GetCount(); if (ref_count < 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), - "ViECodec released too many times"); + LOG(LS_WARNING) << "ViECodec released too many times."; shared_data_->SetLastError(kViEAPIDoesNotExist); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(), - "ViECodec reference count: %d", ref_count); return ref_count; } ViECodecImpl::ViECodecImpl(ViESharedData* shared_data) : shared_data_(shared_data) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), - "ViECodecImpl::ViECodecImpl() Ctor"); } ViECodecImpl::~ViECodecImpl() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), - "ViECodecImpl::~ViECodecImpl() Dtor"); } int ViECodecImpl::NumberOfCodecs() const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); // +2 because of FEC(RED and ULPFEC) return static_cast<int>((VideoCodingModule::NumberOfCodecs() + 2)); } int ViECodecImpl::GetCodec(const unsigned char list_number, VideoCodec& video_codec) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(list_number: %d)", __FUNCTION__, list_number); if (list_number == VideoCodingModule::NumberOfCodecs()) { memset(&video_codec, 0, sizeof(VideoCodec)); strcpy(video_codec.plName, "red"); @@ -94,9 +126,6 @@ int ViECodecImpl::GetCodec(const unsigned char list_number, video_codec.codecType = kVideoCodecULPFEC; video_codec.plType = VCM_ULPFEC_PAYLOAD_TYPE; } else if (VideoCodingModule::Codec(list_number, &video_codec) != VCM_OK) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s: Could not get codec for list_number: %u", __FUNCTION__, - list_number); shared_data_->SetLastError(kViECodecInvalidArgument); return -1; } @@ -105,33 +134,8 @@ int ViECodecImpl::GetCodec(const unsigned char list_number, int ViECodecImpl::SetSendCodec(const int video_channel, const VideoCodec& video_codec) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, codec_type: %d)", __FUNCTION__, - video_channel, video_codec.codecType); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: codec: %d, pl_type: %d, width: %d, height: %d, bitrate: %d" - "maxBr: %d, min_br: %d, frame_rate: %d, qpMax: %u," - "numberOfSimulcastStreams: %u )", __FUNCTION__, - video_codec.codecType, video_codec.plType, video_codec.width, - video_codec.height, video_codec.startBitrate, - video_codec.maxBitrate, video_codec.minBitrate, - video_codec.maxFramerate, video_codec.qpMax, - video_codec.numberOfSimulcastStreams); - if (video_codec.codecType == kVideoCodecVP8) { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "pictureLossIndicationOn: %d, feedbackModeOn: %d, " - "complexity: %d, resilience: %d, numberOfTemporalLayers: %u" - "keyFrameInterval %d", - video_codec.codecSpecific.VP8.pictureLossIndicationOn, - video_codec.codecSpecific.VP8.feedbackModeOn, - video_codec.codecSpecific.VP8.complexity, - video_codec.codecSpecific.VP8.resilience, - video_codec.codecSpecific.VP8.numberOfTemporalLayers, - video_codec.codecSpecific.VP8.keyFrameInterval); - } + LOG(LS_INFO) << "SetSendCodec for channel " << video_channel; + LogCodec(video_codec); if (!CodecValid(video_codec)) { // Error logged. shared_data_->SetLastError(kViECodecInvalidCodec); @@ -141,9 +145,6 @@ int ViECodecImpl::SetSendCodec(const int video_channel, ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -151,9 +152,7 @@ int ViECodecImpl::SetSendCodec(const int video_channel, ViEEncoder* vie_encoder = cs.Encoder(video_channel); assert(vie_encoder); if (vie_encoder->Owner() != video_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Receive only channel %d", __FUNCTION__, video_channel); + LOG_F(LS_ERROR) << "Receive only channel."; shared_data_->SetLastError(kViECodecReceiveOnlyChannel); return -1; } @@ -166,10 +165,7 @@ int ViECodecImpl::SetSendCodec(const int video_channel, video_codec_internal.height * video_codec_internal.maxFramerate) / 1000; - WEBRTC_TRACE(kTraceInfo, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: New max bitrate set to %d kbps", __FUNCTION__, - video_codec_internal.maxBitrate); + LOG(LS_INFO) << "New max bitrate set " << video_codec_internal.maxBitrate; } if (video_codec_internal.startBitrate > video_codec_internal.maxBitrate) { @@ -192,10 +188,6 @@ int ViECodecImpl::SetSendCodec(const int video_channel, vie_encoder->Pause(); if (vie_encoder->SetEncoder(video_codec_internal) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not change encoder for channel %d", __FUNCTION__, - video_channel); shared_data_->SetLastError(kViECodecUnknownError); return -1; } @@ -207,10 +199,6 @@ int ViECodecImpl::SetSendCodec(const int video_channel, ++it) { bool ret = true; if ((*it)->SetSendCodec(video_codec_internal, new_rtp_stream) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not set send codec for channel %d", __FUNCTION__, - video_channel); ret = false; } if (!ret) { @@ -225,9 +213,7 @@ int ViECodecImpl::SetSendCodec(const int video_channel, if (video_codec_internal.numberOfSimulcastStreams == 0) { unsigned int ssrc = 0; if (vie_channel->GetLocalSSRC(0, &ssrc) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not get ssrc", __FUNCTION__); + LOG_F(LS_ERROR) << "Could not get ssrc."; } ssrcs.push_back(ssrc); } else { @@ -235,9 +221,7 @@ int ViECodecImpl::SetSendCodec(const int video_channel, ++idx) { unsigned int ssrc = 0; if (vie_channel->GetLocalSSRC(idx, &ssrc) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not get ssrc for idx %d", __FUNCTION__, idx); + LOG_F(LS_ERROR) << "Could not get ssrc for stream " << idx; } ssrcs.push_back(ssrc); } @@ -264,16 +248,9 @@ int ViECodecImpl::SetSendCodec(const int video_channel, int ViECodecImpl::GetSendCodec(const int video_channel, VideoCodec& video_codec) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d)", __FUNCTION__, video_channel); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder for channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -282,21 +259,11 @@ int ViECodecImpl::GetSendCodec(const int video_channel, int ViECodecImpl::SetReceiveCodec(const int video_channel, const VideoCodec& video_codec) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, codec_type: %d)", __FUNCTION__, - video_channel, video_codec.codecType); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: codec: %d, pl_type: %d, width: %d, height: %d, bitrate: %d," - "maxBr: %d, min_br: %d, frame_rate: %d", __FUNCTION__, - video_codec.codecType, video_codec.plType, video_codec.width, - video_codec.height, video_codec.startBitrate, - video_codec.maxBitrate, video_codec.minBitrate, - video_codec.maxFramerate); + LOG(LS_INFO) << "SetReceiveCodec for channel " << video_channel; + LOG(LS_INFO) << "Codec type " << video_codec.codecType + << ", payload type " << video_codec.plType; if (CodecValid(video_codec) == false) { - // Error logged. shared_data_->SetLastError(kViECodecInvalidCodec); return -1; } @@ -304,18 +271,11 @@ int ViECodecImpl::SetReceiveCodec(const int video_channel, ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } if (vie_channel->SetReceiveCodec(video_codec) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not set receive codec for channel %d", - __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecUnknownError); return -1; } @@ -324,17 +284,9 @@ int ViECodecImpl::SetReceiveCodec(const int video_channel, int ViECodecImpl::GetReceiveCodec(const int video_channel, VideoCodec& video_codec) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, codec_type: %d)", __FUNCTION__, - video_channel, video_codec.codecType); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -350,16 +302,11 @@ int ViECodecImpl::GetCodecConfigParameters( const int video_channel, unsigned char config_parameters[kConfigParameterSize], unsigned char& config_parameters_size) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d)", __FUNCTION__, video_channel); + LOG(LS_INFO) << "GetCodecConfigParameters " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder for channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -374,17 +321,12 @@ int ViECodecImpl::GetCodecConfigParameters( int ViECodecImpl::SetImageScaleStatus(const int video_channel, const bool enable) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, enable: %d)", __FUNCTION__, video_channel, - enable); + LOG(LS_INFO) << "SetImageScaleStates for channel " << video_channel + << ", enable: " << enable; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -399,17 +341,9 @@ int ViECodecImpl::SetImageScaleStatus(const int video_channel, int ViECodecImpl::GetSendCodecStastistics(const int video_channel, unsigned int& key_frames, unsigned int& delta_frames) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel %d)", __FUNCTION__, video_channel); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No send codec for channel %d", __FUNCTION__, - video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -424,17 +358,9 @@ int ViECodecImpl::GetSendCodecStastistics(const int video_channel, int ViECodecImpl::GetReceiveCodecStastistics(const int video_channel, unsigned int& key_frames, unsigned int& delta_frames) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d)", __FUNCTION__, - video_channel); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -447,20 +373,11 @@ int ViECodecImpl::GetReceiveCodecStastistics(const int video_channel, int ViECodecImpl::GetReceiveSideDelay(const int video_channel, int* delay_ms) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d)", __FUNCTION__, video_channel); - if (delay_ms == NULL) { - LOG_F(LS_ERROR) << "NULL pointer argument."; - return -1; - } + assert(delay_ms != NULL); ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -474,18 +391,9 @@ int ViECodecImpl::GetReceiveSideDelay(const int video_channel, int ViECodecImpl::GetCodecTargetBitrate(const int video_channel, unsigned int* bitrate) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, codec_type: %d)", __FUNCTION__, - video_channel); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No send codec for channel %d", __FUNCTION__, - video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -493,17 +401,9 @@ int ViECodecImpl::GetCodecTargetBitrate(const int video_channel, } unsigned int ViECodecImpl::GetDiscardedPackets(const int video_channel) const { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, codec_type: %d)", __FUNCTION__, - video_channel); - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -512,16 +412,12 @@ unsigned int ViECodecImpl::GetDiscardedPackets(const int video_channel) const { int ViECodecImpl::SetKeyFrameRequestCallbackStatus(const int video_channel, const bool enable) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d)", __FUNCTION__, video_channel); + LOG(LS_INFO) << "SetKeyFrameRequestCallbackStatus for " << video_channel + << ", enacle " << enable; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -535,17 +431,13 @@ int ViECodecImpl::SetKeyFrameRequestCallbackStatus(const int video_channel, int ViECodecImpl::SetSignalKeyPacketLossStatus(const int video_channel, const bool enable, const bool only_key_frames) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s(video_channel: %d, enable: %d, only_key_frames: %d)", - __FUNCTION__, video_channel, enable); + LOG(LS_INFO) << "SetSignalKeyPacketLossStatus for " << video_channel + << "enable, " << enable + << ", only key frames " << only_key_frames; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -558,23 +450,15 @@ int ViECodecImpl::SetSignalKeyPacketLossStatus(const int video_channel, int ViECodecImpl::RegisterEncoderObserver(const int video_channel, ViEEncoderObserver& observer) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); + LOG(LS_INFO) << "RegisterEncoderObserver for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder for channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } if (vie_encoder->RegisterCodecObserver(&observer) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not register codec observer at channel", - __FUNCTION__); shared_data_->SetLastError(kViECodecObserverAlreadyRegistered); return -1; } @@ -582,15 +466,11 @@ int ViECodecImpl::RegisterEncoderObserver(const int video_channel, } int ViECodecImpl::DeregisterEncoderObserver(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); + LOG(LS_INFO) << "DeregisterEncoderObserver for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder for channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -603,23 +483,15 @@ int ViECodecImpl::DeregisterEncoderObserver(const int video_channel) { int ViECodecImpl::RegisterDecoderObserver(const int video_channel, ViEDecoderObserver& observer) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s", __FUNCTION__); + LOG(LS_INFO) << "RegisterDecoderObserver for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } if (vie_channel->RegisterCodecObserver(&observer) != 0) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Could not register codec observer at channel", - __FUNCTION__); shared_data_->SetLastError(kViECodecObserverAlreadyRegistered); return -1; } @@ -627,16 +499,11 @@ int ViECodecImpl::RegisterDecoderObserver(const int video_channel, } int ViECodecImpl::DeregisterDecoderObserver(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id()), "%s", - __FUNCTION__); + LOG(LS_INFO) << "DeregisterDecodeObserver for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -648,15 +515,11 @@ int ViECodecImpl::DeregisterDecoderObserver(const int video_channel) { } int ViECodecImpl::SendKeyFrame(const int video_channel) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s(video_channel: %d)", __FUNCTION__, video_channel); + LOG(LS_INFO) << "SendKeyFrame on channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -669,17 +532,12 @@ int ViECodecImpl::SendKeyFrame(const int video_channel) { int ViECodecImpl::WaitForFirstKeyFrame(const int video_channel, const bool wait) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, - ViEId(shared_data_->instance_id()), - "%s(video_channel: %d, wait: %d)", __FUNCTION__, video_channel, - wait); + LOG(LS_INFO) << "WaitForFirstKeyFrame for channel " << video_channel + << ", wait " << wait; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return -1; } @@ -692,44 +550,35 @@ int ViECodecImpl::WaitForFirstKeyFrame(const int video_channel, int ViECodecImpl::StartDebugRecording(int video_channel, const char* file_name_utf8) { + LOG(LS_INFO) << "StartDebugRecording for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder %d", __FUNCTION__, video_channel); return -1; } return vie_encoder->StartDebugRecording(file_name_utf8); } int ViECodecImpl::StopDebugRecording(int video_channel) { + LOG(LS_INFO) << "StopDebugRecording for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder %d", __FUNCTION__, video_channel); return -1; } return vie_encoder->StopDebugRecording(); } void ViECodecImpl::SuspendBelowMinBitrate(int video_channel) { + LOG(LS_INFO) << "SuspendBelowMinBitrate for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No encoder %d", __FUNCTION__, video_channel); return; } vie_encoder->SuspendBelowMinBitrate(); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); return; } // Must enable pacing when enabling SuspendBelowMinBitrate. Otherwise, no @@ -743,9 +592,6 @@ bool ViECodecImpl::GetSendSideDelay(int video_channel, int* avg_delay_ms, ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: No channel %d", __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidChannelId); return false; } @@ -763,8 +609,7 @@ bool ViECodecImpl::CodecValid(const VideoCodec& video_codec) { // We only care about the type and name for red. return true; } - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, - "Codec type doesn't match pl_name", video_codec.plType); + LOG_F(LS_ERROR) << "Invalid RED configuration."; return false; } else if (video_codec.codecType == kVideoCodecULPFEC) { #if defined(WIN32) @@ -775,8 +620,7 @@ bool ViECodecImpl::CodecValid(const VideoCodec& video_codec) { // We only care about the type and name for ULPFEC. return true; } - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, - "Codec type doesn't match pl_name", video_codec.plType); + LOG_F(LS_ERROR) << "Invalid ULPFEC configuration."; return false; } else if ((video_codec.codecType == kVideoCodecVP8 && strncmp(video_codec.plName, "VP8", 4) == 0) || @@ -784,32 +628,28 @@ bool ViECodecImpl::CodecValid(const VideoCodec& video_codec) { strncmp(video_codec.plName, "I420", 4) == 0)) { // OK. } else if (video_codec.codecType != kVideoCodecGeneric) { - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, - "Codec type doesn't match pl_name", video_codec.plType); + LOG(LS_ERROR) << "Codec type and name mismatch."; return false; } if (video_codec.plType == 0 || video_codec.plType > 127) { - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, - "Invalid codec payload type: %d", video_codec.plType); + LOG(LS_ERROR) << "Invalif payload type: " << video_codec.plType; return false; } if (video_codec.width > kViEMaxCodecWidth || video_codec.height > kViEMaxCodecHeight) { - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, "Invalid codec size: %u x %u", - video_codec.width, video_codec.height); + LOG(LS_ERROR) << "Invalid codec resolution " << video_codec.width + << " x " << video_codec.height; return false; } if (video_codec.startBitrate < kViEMinCodecBitrate) { - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, "Invalid start_bitrate: %u", - video_codec.startBitrate); + LOG(LS_ERROR) << "Invalid start bitrate."; return false; } if (video_codec.minBitrate < kViEMinCodecBitrate) { - WEBRTC_TRACE(kTraceError, kTraceVideo, -1, "Invalid min_bitrate: %u", - video_codec.minBitrate); + LOG(LS_ERROR) << "Invalid min bitrate."; return false; } return true; diff --git a/video_engine/vie_encoder.cc b/video_engine/vie_encoder.cc index 620972b0..aa20573d 100644 --- a/video_engine/vie_encoder.cc +++ b/video_engine/vie_encoder.cc @@ -26,7 +26,6 @@ #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/tick_util.h" -#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/system_wrappers/interface/trace_event.h" #include "webrtc/video_engine/include/vie_codec.h" #include "webrtc/video_engine/include/vie_image_process.h" @@ -166,11 +165,6 @@ ViEEncoder::ViEEncoder(int32_t engine_id, qm_callback_(NULL), video_suspended_(false), pre_encode_callback_(NULL) { - WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, - ViEId(engine_id, channel_id), - "%s(engine_id: %d) 0x%p - Constructor", __FUNCTION__, engine_id, - this); - RtpRtcp::Configuration configuration; configuration.id = ViEModuleId(engine_id_, channel_id_); configuration.audio = false; // Video. @@ -184,9 +178,6 @@ ViEEncoder::ViEEncoder(int32_t engine_id, bool ViEEncoder::Init() { if (vcm_.InitializeSender() != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s InitializeSender failure", __FUNCTION__); return false; } vpm_.EnableTemporalDecimation(true); @@ -197,9 +188,6 @@ bool ViEEncoder::Init() { if (module_process_thread_.RegisterModule(&vcm_) != 0 || module_process_thread_.RegisterModule(default_rtp_rtcp_.get()) != 0 || module_process_thread_.RegisterModule(paced_sender_.get()) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s RegisterModule failure", __FUNCTION__); return false; } if (qm_callback_) { @@ -210,9 +198,6 @@ bool ViEEncoder::Init() { #ifdef VIDEOCODEC_VP8 VideoCodec video_codec; if (vcm_.Codec(webrtc::kVideoCodecVP8, &video_codec) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s Codec failure", __FUNCTION__); return false; } { @@ -221,15 +206,9 @@ bool ViEEncoder::Init() { } if (vcm_.RegisterSendCodec(&video_codec, number_of_cores_, default_rtp_rtcp_->MaxDataPayloadLength()) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s RegisterSendCodec failure", __FUNCTION__); return false; } if (default_rtp_rtcp_->RegisterSendPayload(video_codec) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s RegisterSendPayload failure", __FUNCTION__); return false; } #else @@ -248,30 +227,18 @@ bool ViEEncoder::Init() { #endif if (vcm_.RegisterTransportCallback(this) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "ViEEncoder: VCM::RegisterTransportCallback failure"); return false; } if (vcm_.RegisterSendStatisticsCallback(this) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "ViEEncoder: VCM::RegisterSendStatisticsCallback failure"); return false; } if (vcm_.RegisterVideoQMCallback(qm_callback_) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "VCM::RegisterQMCallback failure"); return false; } return true; } ViEEncoder::~ViEEncoder() { - WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "ViEEncoder Destructor 0x%p, engine_id: %d", this, engine_id_); if (bitrate_controller_) { bitrate_controller_->RemoveBitrateObserver(bitrate_observer_.get()); } @@ -289,10 +256,6 @@ int ViEEncoder::Owner() const { } void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s(%s)", __FUNCTION__, - is_transmitting ? "transmitting" : "not transmitting"); { CriticalSectionScoped cs(data_cs_.get()); network_is_transmitting_ = is_transmitting; @@ -305,17 +268,11 @@ void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { } void ViEEncoder::Pause() { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); CriticalSectionScoped cs(data_cs_.get()); encoder_paused_ = true; } void ViEEncoder::Restart() { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s", __FUNCTION__); CriticalSectionScoped cs(data_cs_.get()); encoder_paused_ = false; } @@ -326,9 +283,6 @@ uint8_t ViEEncoder::NumberOfCodecs() { int32_t ViEEncoder::GetCodec(uint8_t list_index, VideoCodec* video_codec) { if (vcm_.Codec(list_index, video_codec) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: Could not get codec", - __FUNCTION__); return -1; } return 0; @@ -337,43 +291,27 @@ int32_t ViEEncoder::GetCodec(uint8_t list_index, VideoCodec* video_codec) { int32_t ViEEncoder::RegisterExternalEncoder(webrtc::VideoEncoder* encoder, uint8_t pl_type, bool internal_source) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: pltype %u", __FUNCTION__, - pl_type); - if (encoder == NULL) return -1; if (vcm_.RegisterExternalEncoder(encoder, pl_type, internal_source) != - VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not register external encoder"); + VCM_OK) { return -1; } return 0; } int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: pltype %u", __FUNCTION__, pl_type); - webrtc::VideoCodec current_send_codec; if (vcm_.SendCodec(¤t_send_codec) == VCM_OK) { uint32_t current_bitrate_bps = 0; if (vcm_.Bitrate(¤t_bitrate_bps) != 0) { - WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Failed to get the current encoder target bitrate."); + LOG(LS_WARNING) << "Failed to get the current encoder target bitrate."; } current_send_codec.startBitrate = (current_bitrate_bps + 500) / 1000; } if (vcm_.RegisterExternalEncoder(NULL, pl_type) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not deregister external encoder"); return -1; } @@ -393,9 +331,6 @@ int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { current_send_codec.extra_options = NULL; if (vcm_.RegisterSendCodec(¤t_send_codec, number_of_cores_, max_data_payload_length) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not use internal encoder"); return -1; } } @@ -403,23 +338,13 @@ int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { } int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: CodecType: %d, width: %u, height: %u", __FUNCTION__, - video_codec.codecType, video_codec.width, video_codec.height); // Setting target width and height for VPM. if (vpm_.SetTargetResolution(video_codec.width, video_codec.height, video_codec.maxFramerate) != VPM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not set VPM target dimensions"); return -1; } if (default_rtp_rtcp_->RegisterSendPayload(video_codec) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could register RTP module video payload"); return -1; } // Convert from kbps to bps. @@ -438,9 +363,6 @@ int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { } if (vcm_.RegisterSendCodec(&video_codec, number_of_cores_, max_data_payload_length) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not register send codec"); return -1; } @@ -448,9 +370,6 @@ int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { // start and stop sending. if (default_rtp_rtcp_->Sending() == false) { if (default_rtp_rtcp_->SetSendingStatus(true) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could start RTP module sending"); return -1; } } @@ -472,13 +391,7 @@ int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { } int32_t ViEEncoder::GetEncoder(VideoCodec* video_codec) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); - if (vcm_.SendCodec(video_codec) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not get VCM send codec"); return -1; } return 0; @@ -487,16 +400,10 @@ int32_t ViEEncoder::GetEncoder(VideoCodec* video_codec) { int32_t ViEEncoder::GetCodecConfigParameters( unsigned char config_parameters[kConfigParameterSize], unsigned char& config_parameters_size) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); - int32_t num_parameters = vcm_.CodecConfigParameters(config_parameters, kConfigParameterSize); if (num_parameters <= 0) { config_parameters_size = 0; - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not get config parameters"); return -1; } config_parameters_size = static_cast<unsigned char>(num_parameters); @@ -504,16 +411,11 @@ int32_t ViEEncoder::GetCodecConfigParameters( } int32_t ViEEncoder::ScaleInputImage(bool enable) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s(enable %d)", __FUNCTION__, - enable); - VideoFrameResampling resampling_mode = kFastRescaling; - if (enable == true) { + // TODO(mflodman) What? + if (enable) { // kInterpolation is currently not supported. - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s not supported", - __FUNCTION__, enable); + LOG_F(LS_ERROR) << "Not supported."; return -1; } vpm_.SetInputFrameResampleMode(resampling_mode); @@ -560,9 +462,6 @@ bool ViEEncoder::EncoderPaused() const { } RtpRtcp* ViEEncoder::SendRtpRtcpModule() { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); - return default_rtp_rtcp_.get(); } @@ -570,11 +469,6 @@ void ViEEncoder::DeliverFrame(int id, I420VideoFrame* video_frame, int num_csrcs, const uint32_t CSRC[kRtpCsrcSize]) { - WEBRTC_TRACE(webrtc::kTraceStream, - webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: %llu", __FUNCTION__, - video_frame->timestamp()); if (default_rtp_rtcp_->SendingMedia() == false) { // We've paused or we have no channels attached, don't encode. return; @@ -640,11 +534,6 @@ void ViEEncoder::DeliverFrame(int id, return; } if (ret != VPM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, - webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Error preprocessing frame %u", __FUNCTION__, - video_frame->timestamp()); return; } // Frame was not sampled => use original. @@ -673,47 +562,24 @@ void ViEEncoder::DeliverFrame(int id, has_received_sli_ = false; has_received_rpsi_ = false; - if (vcm_.AddVideoFrame(*decimated_frame, - vpm_.ContentMetrics(), - &codec_specific_info) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, - webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Error encoding frame %u", __FUNCTION__, - video_frame->timestamp()); - } + vcm_.AddVideoFrame(*decimated_frame, vpm_.ContentMetrics(), + &codec_specific_info); return; } #endif - if (vcm_.AddVideoFrame(*decimated_frame) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, - webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Error encoding frame %u", __FUNCTION__, - video_frame->timestamp()); - } + vcm_.AddVideoFrame(*decimated_frame); } void ViEEncoder::DelayChanged(int id, int frame_delay) { - WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: %u", __FUNCTION__, - frame_delay); - default_rtp_rtcp_->SetCameraDelay(frame_delay); } int ViEEncoder::GetPreferedFrameSettings(int* width, int* height, int* frame_rate) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); - webrtc::VideoCodec video_codec; memset(&video_codec, 0, sizeof(video_codec)); if (vcm_.SendCodec(&video_codec) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Could not get VCM send codec"); return -1; } @@ -724,21 +590,13 @@ int ViEEncoder::GetPreferedFrameSettings(int* width, } int ViEEncoder::SendKeyFrame() { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); return vcm_.IntraFrameRequest(0); } int32_t ViEEncoder::SendCodecStatistics( uint32_t* num_key_frames, uint32_t* num_delta_frames) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); - webrtc::VCMFrameCount sent_frames; if (vcm_.SentFrameCount(sent_frames) != VCM_OK) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Could not get sent frame information", __FUNCTION__); return -1; } *num_key_frames = sent_frames.numKeyFrames; @@ -752,9 +610,6 @@ int32_t ViEEncoder::PacerQueuingDelayMs() const { int32_t ViEEncoder::EstimatedSendBandwidth( uint32_t* available_bandwidth) const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); - if (!bitrate_controller_->AvailableBandwidth(available_bandwidth)) { return -1; } @@ -762,8 +617,6 @@ int32_t ViEEncoder::EstimatedSendBandwidth( } int ViEEncoder::CodecTargetBitrate(uint32_t* bitrate) const { - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, channel_id_), "%s", - __FUNCTION__); if (vcm_.Bitrate(bitrate) != 0) return -1; return 0; @@ -799,9 +652,6 @@ int32_t ViEEncoder::UpdateProtectionMethod(bool enable_nack) { } if (fec_enabled_ || nack_enabled_) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: FEC status ", - __FUNCTION__, fec_enabled); vcm_.RegisterProtectionCallback(this); // The send codec must be registered to set correct MTU. webrtc::VideoCodec codec; @@ -809,17 +659,12 @@ int32_t ViEEncoder::UpdateProtectionMethod(bool enable_nack) { uint16_t max_pay_load = default_rtp_rtcp_->MaxDataPayloadLength(); uint32_t current_bitrate_bps = 0; if (vcm_.Bitrate(¤t_bitrate_bps) != 0) { - WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "Failed to get the current encoder target bitrate."); + LOG_F(LS_WARNING) << + "Failed to get the current encoder target bitrate."; } // Convert to start bitrate in kbps. codec.startBitrate = (current_bitrate_bps + 500) / 1000; if (vcm_.RegisterSendCodec(&codec, number_of_cores_, max_pay_load) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Failed to update Sendcodec when enabling FEC", - __FUNCTION__, fec_enabled); return -1; } } @@ -878,30 +723,8 @@ int32_t ViEEncoder::ProtectionRequest( uint32_t* sent_video_rate_bps, uint32_t* sent_nack_rate_bps, uint32_t* sent_fec_rate_bps) { - WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s, deltaFECRate: %u, key_fecrate: %u, " - "delta_use_uep_protection: %d, key_use_uep_protection: %d, " - "delta_max_fec_frames: %d, key_max_fec_frames: %d, " - "delta_mask_type: %d, key_mask_type: %d, ", - __FUNCTION__, - delta_fec_params->fec_rate, - key_fec_params->fec_rate, - delta_fec_params->use_uep_protection, - key_fec_params->use_uep_protection, - delta_fec_params->max_fec_frames, - key_fec_params->max_fec_frames, - delta_fec_params->fec_mask_type, - key_fec_params->fec_mask_type); - if (default_rtp_rtcp_->SetFecParameters(delta_fec_params, - key_fec_params) != 0) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Could not update FEC parameters", __FUNCTION__); - } - default_rtp_rtcp_->BitrateSent(NULL, - sent_video_rate_bps, - sent_fec_rate_bps, + default_rtp_rtcp_->SetFecParameters(delta_fec_params, key_fec_params); + default_rtp_rtcp_->BitrateSent(NULL, sent_video_rate_bps, sent_fec_rate_bps, sent_nack_rate_bps); return 0; } @@ -910,9 +733,6 @@ int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate, const uint32_t frame_rate) { CriticalSectionScoped cs(callback_cs_.get()); if (codec_observer_) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: bitrate %u, framerate %u", - __FUNCTION__, bit_rate, frame_rate); codec_observer_->OutgoingRate(channel_id_, frame_rate, bit_rate); } return 0; @@ -920,29 +740,11 @@ int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate, int32_t ViEEncoder::RegisterCodecObserver(ViEEncoderObserver* observer) { CriticalSectionScoped cs(callback_cs_.get()); - if (observer) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: observer added", - __FUNCTION__); - if (codec_observer_) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: observer already set.", - __FUNCTION__); - return -1; - } - codec_observer_ = observer; - } else { - if (codec_observer_ == NULL) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: observer does not exist.", __FUNCTION__); - return -1; - } - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: observer removed", - __FUNCTION__); - codec_observer_ = NULL; + if (observer && codec_observer_) { + LOG_F(LS_ERROR) << "Observer already set."; + return -1; } + codec_observer_ = observer; return 0; } @@ -960,8 +762,6 @@ void ViEEncoder::OnReceivedRPSI(uint32_t /*ssrc*/, void ViEEncoder::OnReceivedIntraFrameRequest(uint32_t ssrc) { // Key frame request from remote side, signal to VCM. - WEBRTC_TRACE(webrtc::kTraceStateInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s", __FUNCTION__); TRACE_EVENT0("webrtc", "OnKeyFrameRequest"); int idx = 0; @@ -981,9 +781,6 @@ void ViEEncoder::OnReceivedIntraFrameRequest(uint32_t ssrc) { int64_t now = TickTime::MillisecondTimestamp(); if (time_last_intra_request_ms_[ssrc] + kViEMinKeyRequestIntervalMs > now) { - WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: Not encoding new intra due to timing", __FUNCTION__); return; } time_last_intra_request_ms_[ssrc] = now; @@ -1045,11 +842,9 @@ void ViEEncoder::SetMinTransmitBitrate(int min_transmit_bitrate_kbps) { void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps, const uint8_t fraction_lost, const uint32_t round_trip_time_ms) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s(bitrate_bps: %u, fraction_lost: %u, rtt_ms: %u", - __FUNCTION__, bitrate_bps, fraction_lost, round_trip_time_ms); - + LOG(LS_VERBOSE) << "OnNetworkChanged, bitrate" << bitrate_bps + << " packet loss " << fraction_lost + << " rtt " << round_trip_time_ms; vcm_.SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms); bool video_is_suspended = vcm_.VideoSuspended(); int bitrate_kbps = bitrate_bps / 1000; @@ -1109,10 +904,8 @@ void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps, // Video suspend-state changed, inform codec observer. CriticalSectionScoped crit(callback_cs_.get()); if (codec_observer_) { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: video_suspended_ changed to %i", - __FUNCTION__, video_is_suspended); + LOG(LS_INFO) << "Video suspended " << video_is_suspended + << " for channel " << channel_id_; codec_observer_->SuspendChange(channel_id_, video_is_suspended); } } @@ -1123,26 +916,9 @@ PacedSender* ViEEncoder::GetPacedSender() { int32_t ViEEncoder::RegisterEffectFilter(ViEEffectFilter* effect_filter) { CriticalSectionScoped cs(callback_cs_.get()); - if (effect_filter == NULL) { - if (effect_filter_ == NULL) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: no effect filter added", - __FUNCTION__); - return -1; - } - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: deregister effect filter", - __FUNCTION__); - } else { - WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), "%s: register effect", - __FUNCTION__); - if (effect_filter_) { - WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, - ViEId(engine_id_, channel_id_), - "%s: effect filter already added ", __FUNCTION__); - return -1; - } + if (effect_filter != NULL && effect_filter_ != NULL) { + LOG_F(LS_ERROR) << "Filter already set."; + return -1; } effect_filter_ = effect_filter; return 0; diff --git a/video_engine/vie_external_codec_impl.cc b/video_engine/vie_external_codec_impl.cc index 13e421be..7eb015c4 100644 --- a/video_engine/vie_external_codec_impl.cc +++ b/video_engine/vie_external_codec_impl.cc @@ -11,7 +11,7 @@ #include "webrtc/video_engine/vie_external_codec_impl.h" #include "webrtc/engine_configurations.h" -#include "webrtc/system_wrappers/interface/trace.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/video_engine/include/vie_errors.h" #include "webrtc/video_engine/vie_channel.h" #include "webrtc/video_engine/vie_channel_manager.h" @@ -37,62 +37,42 @@ ViEExternalCodec* ViEExternalCodec::GetInterface(VideoEngine* video_engine) { } int ViEExternalCodecImpl::Release() { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(), - "ViEExternalCodec::Release()"); // Decrease ref count. (*this)--; int32_t ref_count = GetCount(); if (ref_count < 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), - "ViEExternalCodec release too many times"); + LOG(LS_WARNING) << "ViEExternalCodec released too many times."; shared_data_->SetLastError(kViEAPIDoesNotExist); return -1; } - WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(), - "ViEExternalCodec reference count: %d", ref_count); return ref_count; } ViEExternalCodecImpl::ViEExternalCodecImpl(ViESharedData* shared_data) : shared_data_(shared_data) { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), - "ViEExternalCodecImpl::ViEExternalCodecImpl() Ctor"); } ViEExternalCodecImpl::~ViEExternalCodecImpl() { - WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(), - "ViEExternalCodecImpl::~ViEExternalCodecImpl() Dtor"); } int ViEExternalCodecImpl::RegisterExternalSendCodec(const int video_channel, const unsigned char pl_type, VideoEncoder* encoder, bool internal_source) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s channel %d pl_type %d encoder 0x%x", __FUNCTION__, - video_channel, pl_type, encoder); + assert(encoder != NULL); + LOG(LS_INFO) << "Register external encoder for channel " << video_channel + << ", pl_type " << static_cast<int>(pl_type) + << ", internal_source " << internal_source; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Invalid argument video_channel %u. Does it exist?", - __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidArgument); return -1; } - if (!encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Invalid argument Encoder 0x%x.", __FUNCTION__, encoder); - shared_data_->SetLastError(kViECodecInvalidArgument); - return -1; - } - - if (vie_encoder->RegisterExternalEncoder(encoder, pl_type, internal_source) - != 0) { + if (vie_encoder->RegisterExternalEncoder(encoder, pl_type, + internal_source) != 0) { shared_data_->SetLastError(kViECodecUnknownError); return -1; } @@ -101,17 +81,11 @@ int ViEExternalCodecImpl::RegisterExternalSendCodec(const int video_channel, int ViEExternalCodecImpl::DeRegisterExternalSendCodec( const int video_channel, const unsigned char pl_type) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s channel %d pl_type %d", __FUNCTION__, video_channel, - pl_type); + LOG(LS_INFO) << "Deregister external encoder for channel " << video_channel; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEEncoder* vie_encoder = cs.Encoder(video_channel); if (!vie_encoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Invalid argument video_channel %u. Does it exist?", - __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidArgument); return -1; } @@ -129,25 +103,15 @@ int ViEExternalCodecImpl::RegisterExternalReceiveCodec( VideoDecoder* decoder, bool decoder_render, int render_delay) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s channel %d pl_type %d decoder 0x%x, decoder_render %d, " - "renderDelay %d", __FUNCTION__, video_channel, pl_type, decoder, - decoder_render, render_delay); + LOG(LS_INFO) << "Register exrernal decoder for channel " << video_channel + << ", pl_type " << pl_type + << ", decoder_render " << decoder_render + << ", render_delay " << render_delay; + assert(decoder != NULL); ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Invalid argument video_channel %u. Does it exist?", - __FUNCTION__, video_channel); - shared_data_->SetLastError(kViECodecInvalidArgument); - return -1; - } - if (!decoder) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Invalid argument decoder 0x%x.", __FUNCTION__, decoder); shared_data_->SetLastError(kViECodecInvalidArgument); return -1; } @@ -161,18 +125,13 @@ int ViEExternalCodecImpl::RegisterExternalReceiveCodec( } int ViEExternalCodecImpl::DeRegisterExternalReceiveCodec( -const int video_channel, const unsigned char pl_type) { - WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), - "%s channel %d pl_type %u", __FUNCTION__, video_channel, - pl_type); + const int video_channel, const unsigned char pl_type) { + LOG(LS_INFO) << "DeRegisterExternalReceiveCodec for channel " << video_channel + << ", pl_type " << pl_type; ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannel* vie_channel = cs.Channel(video_channel); if (!vie_channel) { - WEBRTC_TRACE(kTraceError, kTraceVideo, - ViEId(shared_data_->instance_id(), video_channel), - "%s: Invalid argument video_channel %u. Does it exist?", - __FUNCTION__, video_channel); shared_data_->SetLastError(kViECodecInvalidArgument); return -1; } diff --git a/video_engine/vie_frame_provider_base.cc b/video_engine/vie_frame_provider_base.cc index 1ed09664..3dceb170 100644 --- a/video_engine/vie_frame_provider_base.cc +++ b/video_engine/vie_frame_provider_base.cc @@ -14,8 +14,8 @@ #include "webrtc/common_video/interface/i420_video_frame.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/tick_util.h" -#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/video_engine/vie_defines.h" namespace webrtc { @@ -29,9 +29,8 @@ ViEFrameProviderBase::ViEFrameProviderBase(int Id, int engine_id) ViEFrameProviderBase::~ViEFrameProviderBase() { if (frame_callbacks_.size() > 0) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, id_), - "FrameCallbacks still exist when Provider deleted %d", - frame_callbacks_.size()); + LOG_F(LS_WARNING) << "FrameCallbacks still exist when Provider deleted: " + << frame_callbacks_.size(); } for (FrameCallbacks::iterator it = frame_callbacks_.begin(); @@ -76,8 +75,7 @@ void ViEFrameProviderBase::DeliverFrame( static_cast<int>((TickTime::Now() - start_process_time).Milliseconds()); if (process_time > 25) { // Warn if the delivery time is too long. - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, id_), - "%s Too long time: %ums", __FUNCTION__, process_time); + LOG(LS_WARNING) << "Too long time delivering frame " << process_time; } #endif } @@ -131,16 +129,10 @@ int ViEFrameProviderBase::GetBestFormat(int* best_width, int ViEFrameProviderBase::RegisterFrameCallback( int observer_id, ViEFrameCallback* callback_object) { assert(callback_object); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, id_), "%s(0x%p)", - __FUNCTION__, callback_object); { CriticalSectionScoped cs(provider_cs_.get()); if (std::find(frame_callbacks_.begin(), frame_callbacks_.end(), callback_object) != frame_callbacks_.end()) { - // This object is already registered. - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, id_), - "%s 0x%p already registered", __FUNCTION__, - callback_object); assert(false && "frameObserver already registered"); return -1; } @@ -157,21 +149,15 @@ int ViEFrameProviderBase::RegisterFrameCallback( int ViEFrameProviderBase::DeregisterFrameCallback( const ViEFrameCallback* callback_object) { assert(callback_object); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, id_), "%s(0x%p)", - __FUNCTION__, callback_object); CriticalSectionScoped cs(provider_cs_.get()); FrameCallbacks::iterator it = std::find(frame_callbacks_.begin(), frame_callbacks_.end(), callback_object); if (it == frame_callbacks_.end()) { - WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, id_), - "%s 0x%p not found", __FUNCTION__, callback_object); return -1; } frame_callbacks_.erase(it); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, id_), - "%s 0x%p deregistered", __FUNCTION__, callback_object); // Notify implementer of this class that the callback list have changed. FrameCallbackChanged(); @@ -181,8 +167,6 @@ int ViEFrameProviderBase::DeregisterFrameCallback( bool ViEFrameProviderBase::IsFrameCallbackRegistered( const ViEFrameCallback* callback_object) { assert(callback_object); - WEBRTC_TRACE(kTraceInfo, kTraceVideo, ViEId(engine_id_, id_), - "%s(0x%p)", __FUNCTION__, callback_object); CriticalSectionScoped cs(provider_cs_.get()); return std::find(frame_callbacks_.begin(), frame_callbacks_.end(), diff --git a/video_engine/vie_input_manager.cc b/video_engine/vie_input_manager.cc index f5727c56..80ace3d5 100644 --- a/video_engine/vie_input_manager.cc +++ b/video_engine/vie_input_manager.cc @@ -17,6 +17,7 @@ #include "webrtc/modules/video_coding/main/interface/video_coding.h" #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" +#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" #include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/video_engine/include/vie_errors.h" @@ -420,8 +421,10 @@ ViEFrameProviderBase* ViEInputManager::ViEFrameProvider(int provider_id) const { ViECapturer* ViEInputManager::ViECapturePtr(int capture_id) const { if (!(capture_id >= kViECaptureIdBase && - capture_id <= kViECaptureIdBase + kViEMaxCaptureDevices)) + capture_id <= kViECaptureIdBase + kViEMaxCaptureDevices)) { + LOG(LS_ERROR) << "Capture device doesn't exist " << capture_id << "."; return NULL; + } return static_cast<ViECapturer*>(ViEFrameProvider(capture_id)); } |