Remove WEBRTC_TRACE uses in video_engine/

Complements fixes by mflodman@.

BUG=3153
R=mflodman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/11159004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6136 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org 2014-05-14 08:02:22 +00:00
parent 98c76a120d
commit 4e2806d85f
13 changed files with 182 additions and 882 deletions

View File

@ -20,7 +20,6 @@
#include "webrtc/common_video/interface/video_image.h" #include "webrtc/common_video/interface/video_image.h"
#include "webrtc/common_video/jpeg/include/jpeg.h" #include "webrtc/common_video/jpeg/include/jpeg.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc { namespace webrtc {
@ -32,38 +31,25 @@ int ViEFileImage::ConvertJPEGToVideoFrame(int engine_id,
FILE* image_file = fopen(file_nameUTF8, "rb"); FILE* image_file = fopen(file_nameUTF8, "rb");
if (!image_file) { if (!image_file) {
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"%s could not open file %s", __FUNCTION__, file_nameUTF8);
return -1; return -1;
} }
if (fseek(image_file, 0, SEEK_END) != 0) { if (fseek(image_file, 0, SEEK_END) != 0) {
fclose(image_file); fclose(image_file);
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"ConvertJPEGToVideoFrame fseek SEEK_END error for file %s",
file_nameUTF8);
return -1; return -1;
} }
int buffer_size = ftell(image_file); int buffer_size = ftell(image_file);
if (buffer_size == -1) { if (buffer_size == -1) {
fclose(image_file); fclose(image_file);
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"ConvertJPEGToVideoFrame could tell file size for file %s",
file_nameUTF8);
return -1; return -1;
} }
image_buffer._size = buffer_size; image_buffer._size = buffer_size;
if (fseek(image_file, 0, SEEK_SET) != 0) { if (fseek(image_file, 0, SEEK_SET) != 0) {
fclose(image_file); fclose(image_file);
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"ConvertJPEGToVideoFrame fseek SEEK_SET error for file %s",
file_nameUTF8);
return -1; return -1;
} }
image_buffer._buffer = new uint8_t[ image_buffer._size + 1]; image_buffer._buffer = new uint8_t[ image_buffer._size + 1];
if (image_buffer._size != fread(image_buffer._buffer, sizeof(uint8_t), if (image_buffer._size != fread(image_buffer._buffer, sizeof(uint8_t),
image_buffer._size, image_file)) { image_buffer._size, image_file)) {
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"%s could not read file %s", __FUNCTION__, file_nameUTF8);
fclose(image_file); fclose(image_file);
delete [] image_buffer._buffer; delete [] image_buffer._buffer;
return -1; return -1;
@ -76,14 +62,8 @@ int ViEFileImage::ConvertJPEGToVideoFrame(int engine_id,
image_buffer._buffer = NULL; image_buffer._buffer = NULL;
if (ret == -1) { if (ret == -1) {
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"%s could decode file %s from jpeg format", __FUNCTION__,
file_nameUTF8);
return -1; return -1;
} else if (ret == -3) { } else if (ret == -3) {
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
"%s could not convert jpeg's data to i420 format",
__FUNCTION__, file_nameUTF8);
} }
return 0; return 0;
} }

View File

@ -10,7 +10,7 @@
#include "webrtc/video_engine/vie_image_process_impl.h" #include "webrtc/video_engine/vie_image_process_impl.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/include/vie_errors.h"
#include "webrtc/video_engine/vie_capturer.h" #include "webrtc/video_engine/vie_capturer.h"
#include "webrtc/video_engine/vie_channel.h" #include "webrtc/video_engine/vie_channel.h"
@ -39,45 +39,30 @@ ViEImageProcess* ViEImageProcess::GetInterface(VideoEngine* video_engine) {
} }
int ViEImageProcessImpl::Release() { int ViEImageProcessImpl::Release() {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
"ViEImageProcess::Release()");
// Decrease ref count. // Decrease ref count.
(*this)--; (*this)--;
int32_t ref_count = GetCount(); int32_t ref_count = GetCount();
if (ref_count < 0) { if (ref_count < 0) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), LOG(LS_ERROR) << "ViEImageProcess release too many times";
"ViEImageProcess release too many times");
shared_data_->SetLastError(kViEAPIDoesNotExist); shared_data_->SetLastError(kViEAPIDoesNotExist);
return -1; return -1;
} }
WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(),
"ViEImageProcess reference count: %d", ref_count);
return ref_count; return ref_count;
} }
ViEImageProcessImpl::ViEImageProcessImpl(ViESharedData* shared_data) ViEImageProcessImpl::ViEImageProcessImpl(ViESharedData* shared_data)
: shared_data_(shared_data) { : shared_data_(shared_data) {}
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
"ViEImageProcessImpl::ViEImageProcessImpl() Ctor");
}
ViEImageProcessImpl::~ViEImageProcessImpl() { ViEImageProcessImpl::~ViEImageProcessImpl() {}
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
"ViEImageProcessImpl::~ViEImageProcessImpl() Dtor");
}
int ViEImageProcessImpl::RegisterCaptureEffectFilter( int ViEImageProcessImpl::RegisterCaptureEffectFilter(
const int capture_id, const int capture_id,
ViEEffectFilter& capture_filter) { ViEEffectFilter& capture_filter) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "capture_id: " << capture_id;
"%s(capture_id: %d)", __FUNCTION__, capture_id);
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViECapturer* vie_capture = is.Capture(capture_id); ViECapturer* vie_capture = is.Capture(capture_id);
if (!vie_capture) { 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(kViEImageProcessInvalidCaptureId); shared_data_->SetLastError(kViEImageProcessInvalidCaptureId);
return -1; return -1;
} }
@ -89,15 +74,11 @@ int ViEImageProcessImpl::RegisterCaptureEffectFilter(
} }
int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int capture_id) { int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int capture_id) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "capture_id: " << capture_id;
"%s(capture_id: %d)", __FUNCTION__, capture_id);
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViECapturer* vie_capture = is.Capture(capture_id); ViECapturer* vie_capture = is.Capture(capture_id);
if (!vie_capture) { 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(kViEImageProcessInvalidCaptureId); shared_data_->SetLastError(kViEImageProcessInvalidCaptureId);
return -1; return -1;
} }
@ -111,14 +92,11 @@ int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int capture_id) {
int ViEImageProcessImpl::RegisterSendEffectFilter( int ViEImageProcessImpl::RegisterSendEffectFilter(
const int video_channel, const int video_channel,
ViEEffectFilter& send_filter) { ViEEffectFilter& send_filter) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "video_channel: " << video_channel;
"%s(video_channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel); ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (vie_encoder == NULL) { if (vie_encoder == NULL) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
"%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
shared_data_->SetLastError(kViEImageProcessInvalidChannelId); shared_data_->SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
@ -131,14 +109,11 @@ int ViEImageProcessImpl::RegisterSendEffectFilter(
} }
int ViEImageProcessImpl::DeregisterSendEffectFilter(const int video_channel) { int ViEImageProcessImpl::DeregisterSendEffectFilter(const int video_channel) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "video_channel: " << video_channel;
"%s(video_channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel); ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (vie_encoder == NULL) { if (vie_encoder == NULL) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
"%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
shared_data_->SetLastError(kViEImageProcessInvalidChannelId); shared_data_->SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
@ -152,14 +127,11 @@ int ViEImageProcessImpl::DeregisterSendEffectFilter(const int video_channel) {
int ViEImageProcessImpl::RegisterRenderEffectFilter( int ViEImageProcessImpl::RegisterRenderEffectFilter(
const int video_channel, const int video_channel,
ViEEffectFilter& render_filter) { ViEEffectFilter& render_filter) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "video_channel: " << video_channel;
"%s(video_channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_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(kViEImageProcessInvalidChannelId); shared_data_->SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
@ -171,14 +143,11 @@ int ViEImageProcessImpl::RegisterRenderEffectFilter(
} }
int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int video_channel) { int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int video_channel) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "video_channel: " << video_channel;
"%s(video_channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_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(kViEImageProcessInvalidChannelId); shared_data_->SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
@ -192,16 +161,12 @@ int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int video_channel) {
int ViEImageProcessImpl::EnableDeflickering(const int capture_id, int ViEImageProcessImpl::EnableDeflickering(const int capture_id,
const bool enable) { const bool enable) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "capture_id: " << capture_id
"%s(capture_id: %d, enable: %d)", __FUNCTION__, capture_id, << " enable: " << (enable ? "on" : "off");
enable);
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViECapturer* vie_capture = is.Capture(capture_id); ViECapturer* vie_capture = is.Capture(capture_id);
if (!vie_capture) { 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(kViEImageProcessInvalidChannelId); shared_data_->SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
@ -219,16 +184,12 @@ int ViEImageProcessImpl::EnableDeflickering(const int capture_id,
int ViEImageProcessImpl::EnableDenoising(const int capture_id, int ViEImageProcessImpl::EnableDenoising(const int capture_id,
const bool enable) { const bool enable) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "capture_id: " << capture_id
"%s(capture_id: %d, enable: %d)", __FUNCTION__, capture_id, << " enable: " << (enable ? "on" : "off");
enable);
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViECapturer* vie_capture = is.Capture(capture_id); ViECapturer* vie_capture = is.Capture(capture_id);
if (!vie_capture) { 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(kViEImageProcessInvalidCaptureId); shared_data_->SetLastError(kViEImageProcessInvalidCaptureId);
return -1; return -1;
} }
@ -246,15 +207,12 @@ int ViEImageProcessImpl::EnableDenoising(const int capture_id,
int ViEImageProcessImpl::EnableColorEnhancement(const int video_channel, int ViEImageProcessImpl::EnableColorEnhancement(const int video_channel,
const bool enable) { const bool enable) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "video_channel: " << video_channel
"%s(video_channel: %d, enable: %d)", __FUNCTION__, video_channel, << " enable: " << (enable ? "on" : "off");
enable);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_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(kViEImageProcessInvalidChannelId); shared_data_->SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }

View File

@ -11,6 +11,7 @@
#include "webrtc/video_engine/vie_impl.h" #include "webrtc/video_engine/vie_impl.h"
#include "webrtc/common.h" #include "webrtc/common.h"
#include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/system_wrappers/interface/trace.h"
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
@ -31,82 +32,71 @@ VideoEngine* VideoEngine::Create(const Config& config) {
} }
bool VideoEngine::Delete(VideoEngine*& video_engine) { bool VideoEngine::Delete(VideoEngine*& video_engine) {
if (!video_engine) { if (!video_engine)
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
"VideoEngine::Delete - No argument");
return false; return false;
}
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId, LOG_F(LS_INFO);
"VideoEngine::Delete(vie = 0x%p)", video_engine);
VideoEngineImpl* vie_impl = static_cast<VideoEngineImpl*>(video_engine); VideoEngineImpl* vie_impl = static_cast<VideoEngineImpl*>(video_engine);
// Check all reference counters. // Check all reference counters.
ViEBaseImpl* vie_base = vie_impl; ViEBaseImpl* vie_base = vie_impl;
if (vie_base->GetCount() > 0) { if (vie_base->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViEBase ref count > 0: " << vie_base->GetCount();
"ViEBase ref count: %d", vie_base->GetCount());
return false; return false;
} }
#ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API #ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API
ViECaptureImpl* vie_capture = vie_impl; ViECaptureImpl* vie_capture = vie_impl;
if (vie_capture->GetCount() > 0) { if (vie_capture->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViECapture ref count > 0: " << vie_capture->GetCount();
"ViECapture ref count: %d", vie_capture->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
ViECodecImpl* vie_codec = vie_impl; ViECodecImpl* vie_codec = vie_impl;
if (vie_codec->GetCount() > 0) { if (vie_codec->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViECodec ref count > 0: " << vie_codec->GetCount();
"ViECodec ref count: %d", vie_codec->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
ViEExternalCodecImpl* vie_external_codec = vie_impl; ViEExternalCodecImpl* vie_external_codec = vie_impl;
if (vie_external_codec->GetCount() > 0) { if (vie_external_codec->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViEExternalCodec ref count > 0: "
"ViEExternalCodec ref count: %d", vie_external_codec->GetCount()); << vie_external_codec->GetCount();
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_FILE_API #ifdef WEBRTC_VIDEO_ENGINE_FILE_API
ViEFileImpl* vie_file = vie_impl; ViEFileImpl* vie_file = vie_impl;
if (vie_file->GetCount() > 0) { if (vie_file->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViEFile ref count > 0: " << vie_file->GetCount();
"ViEFile ref count: %d", vie_file->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API #ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
ViEImageProcessImpl* vie_image_process = vie_impl; ViEImageProcessImpl* vie_image_process = vie_impl;
if (vie_image_process->GetCount() > 0) { if (vie_image_process->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViEImageProcess ref count > 0: "
"ViEImageProcess ref count: %d", << vie_image_process->GetCount();
vie_image_process->GetCount());
return false; return false;
} }
#endif #endif
ViENetworkImpl* vie_network = vie_impl; ViENetworkImpl* vie_network = vie_impl;
if (vie_network->GetCount() > 0) { if (vie_network->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViENetwork ref count > 0: " << vie_network->GetCount();
"ViENetwork ref count: %d", vie_network->GetCount());
return false; return false;
} }
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API #ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
ViERenderImpl* vie_render = vie_impl; ViERenderImpl* vie_render = vie_impl;
if (vie_render->GetCount() > 0) { if (vie_render->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViERender ref count > 0: " << vie_render->GetCount();
"ViERender ref count: %d", vie_render->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API #ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
ViERTP_RTCPImpl* vie_rtp_rtcp = vie_impl; ViERTP_RTCPImpl* vie_rtp_rtcp = vie_impl;
if (vie_rtp_rtcp->GetCount() > 0) { if (vie_rtp_rtcp->GetCount() > 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "ViERTP_RTCP ref count > 0: " << vie_rtp_rtcp->GetCount();
"ViERTP_RTCP ref count: %d", vie_rtp_rtcp->GetCount());
return false; return false;
} }
#endif #endif
@ -115,8 +105,6 @@ bool VideoEngine::Delete(VideoEngine*& video_engine) {
vie_impl = NULL; vie_impl = NULL;
video_engine = NULL; video_engine = NULL;
WEBRTC_TRACE(kTraceInfo, kTraceVideo, kModuleId,
"%s: instance deleted.", __FUNCTION__);
return true; return true;
} }
@ -128,9 +116,8 @@ int VideoEngine::SetTraceFile(const char* file_nameUTF8,
if (Trace::SetTraceFile(file_nameUTF8, add_file_counter) == -1) { if (Trace::SetTraceFile(file_nameUTF8, add_file_counter) == -1) {
return -1; return -1;
} }
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId, LOG_F(LS_INFO) << "filename: " << file_nameUTF8
"SetTraceFileName(file_nameUTF8 = %s, add_file_counter = %d", << " add_file_counter: " << (add_file_counter ? "yes" : "no");
file_nameUTF8, add_file_counter);
return 0; return 0;
} }
@ -139,35 +126,29 @@ int VideoEngine::SetTraceFilter(const unsigned int filter) {
if (filter == kTraceNone && old_filter != kTraceNone) { if (filter == kTraceNone && old_filter != kTraceNone) {
// Do the logging before turning it off. // Do the logging before turning it off.
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId, LOG_F(LS_INFO) << "filter: " << filter;
"SetTraceFilter(filter = 0x%x)", filter);
} }
Trace::set_level_filter(filter); Trace::set_level_filter(filter);
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId, LOG_F(LS_INFO) << "filter: " << filter;
"SetTraceFilter(filter = 0x%x)", filter);
return 0; return 0;
} }
int VideoEngine::SetTraceCallback(TraceCallback* callback) { int VideoEngine::SetTraceCallback(TraceCallback* callback) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId, LOG_F(LS_INFO);
"SetTraceCallback(TraceCallback = 0x%p)", callback);
return Trace::SetTraceCallback(callback); return Trace::SetTraceCallback(callback);
} }
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
int VideoEngine::SetAndroidObjects(JavaVM* javaVM) { int VideoEngine::SetAndroidObjects(JavaVM* javaVM) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId, LOG_F(LS_INFO);
"SetAndroidObjects()");
if (SetCaptureAndroidVM(javaVM) != 0) { if (SetCaptureAndroidVM(javaVM) != 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "Could not set capture Android VM";
"Could not set capture Android VM");
return -1; return -1;
} }
if (SetRenderAndroidVM(javaVM) != 0) { if (SetRenderAndroidVM(javaVM) != 0) {
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId, LOG(LS_ERROR) << "Could not set render Android VM";
"Could not set render Android VM");
return -1; return -1;
} }
return 0; return 0;

View File

@ -19,7 +19,6 @@
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.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" #include "webrtc/video_engine/include/vie_errors.h"
#include "webrtc/video_engine/vie_capturer.h" #include "webrtc/video_engine/vie_capturer.h"
#include "webrtc/video_engine/vie_defines.h" #include "webrtc/video_engine/vie_defines.h"
@ -34,17 +33,12 @@ ViEInputManager::ViEInputManager(const int engine_id, const Config& config)
vie_frame_provider_map_(), vie_frame_provider_map_(),
capture_device_info_(NULL), capture_device_info_(NULL),
module_process_thread_(NULL) { module_process_thread_(NULL) {
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_),
"%s", __FUNCTION__);
for (int idx = 0; idx < kViEMaxCaptureDevices; idx++) { for (int idx = 0; idx < kViEMaxCaptureDevices; idx++) {
free_capture_device_id_[idx] = true; free_capture_device_id_[idx] = true;
} }
} }
ViEInputManager::~ViEInputManager() { ViEInputManager::~ViEInputManager() {
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_),
"%s", __FUNCTION__);
for (FrameProviderMap::iterator it = vie_frame_provider_map_.begin(); for (FrameProviderMap::iterator it = vie_frame_provider_map_.begin();
it != vie_frame_provider_map_.end(); it != vie_frame_provider_map_.end();
++it) { ++it) {
@ -60,8 +54,6 @@ void ViEInputManager::SetModuleProcessThread(
} }
int ViEInputManager::NumberOfCaptureDevices() { int ViEInputManager::NumberOfCaptureDevices() {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
__FUNCTION__);
CriticalSectionScoped cs(device_info_cs_.get()); CriticalSectionScoped cs(device_info_cs_.get());
if (capture_device_info_ == NULL) if (capture_device_info_ == NULL)
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo( capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
@ -75,8 +67,6 @@ int ViEInputManager::GetDeviceName(uint32_t device_number,
uint32_t device_name_length, uint32_t device_name_length,
char* device_unique_idUTF8, char* device_unique_idUTF8,
uint32_t device_unique_idUTF8Length) { uint32_t device_unique_idUTF8Length) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(device_number: %d)", __FUNCTION__, device_number);
CriticalSectionScoped cs(device_info_cs_.get()); CriticalSectionScoped cs(device_info_cs_.get());
if (capture_device_info_ == NULL) if (capture_device_info_ == NULL)
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo( capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
@ -90,8 +80,6 @@ int ViEInputManager::GetDeviceName(uint32_t device_number,
int ViEInputManager::NumberOfCaptureCapabilities( int ViEInputManager::NumberOfCaptureCapabilities(
const char* device_unique_idUTF8) { const char* device_unique_idUTF8) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
__FUNCTION__);
CriticalSectionScoped cs(device_info_cs_.get()); CriticalSectionScoped cs(device_info_cs_.get());
if (capture_device_info_ == NULL) if (capture_device_info_ == NULL)
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo( capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
@ -104,9 +92,6 @@ int ViEInputManager::GetCaptureCapability(
const char* device_unique_idUTF8, const char* device_unique_idUTF8,
const uint32_t device_capability_number, const uint32_t device_capability_number,
CaptureCapability& capability) { CaptureCapability& capability) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(device_unique_idUTF8: %s, device_capability_number: %d)",
__FUNCTION__, device_unique_idUTF8, device_capability_number);
CriticalSectionScoped cs(device_info_cs_.get()); CriticalSectionScoped cs(device_info_cs_.get());
if (capture_device_info_ == NULL) if (capture_device_info_ == NULL)
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo( capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
@ -132,9 +117,6 @@ int ViEInputManager::GetCaptureCapability(
int ViEInputManager::GetOrientation(const char* device_unique_idUTF8, int ViEInputManager::GetOrientation(const char* device_unique_idUTF8,
RotateCapturedFrame& orientation) { RotateCapturedFrame& orientation) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(device_unique_idUTF8: %s,)", __FUNCTION__,
device_unique_idUTF8);
CriticalSectionScoped cs(device_info_cs_.get()); CriticalSectionScoped cs(device_info_cs_.get());
if (capture_device_info_ == NULL) if (capture_device_info_ == NULL)
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo( capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
@ -181,8 +163,6 @@ int ViEInputManager::CreateCaptureDevice(
const char* device_unique_idUTF8, const char* device_unique_idUTF8,
const uint32_t device_unique_idUTF8Length, const uint32_t device_unique_idUTF8Length,
int& capture_id) { int& capture_id) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(device_unique_id: %s)", __FUNCTION__, device_unique_idUTF8);
CriticalSectionScoped cs(map_cs_.get()); CriticalSectionScoped cs(map_cs_.get());
// Make sure the device is not already allocated. // Make sure the device is not already allocated.
@ -228,57 +208,39 @@ int ViEInputManager::CreateCaptureDevice(
const char* cast_id = reinterpret_cast<const char*>(device_unique_idUTF8); const char* cast_id = reinterpret_cast<const char*>(device_unique_idUTF8);
if (strncmp(cast_id, reinterpret_cast<const char*>(found_unique_name), if (strncmp(cast_id, reinterpret_cast<const char*>(found_unique_name),
strlen(cast_id)) == 0) { strlen(cast_id)) == 0) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, ViEId(engine_id_),
"%s:%d Capture device was found by unique ID: %s. Returning",
__FUNCTION__, __LINE__, device_unique_idUTF8);
found_device = true; found_device = true;
break; break;
} }
} }
if (!found_device) { if (!found_device) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, ViEId(engine_id_), LOG(LS_ERROR) << "Capture device not found: " << device_unique_idUTF8;
"%s:%d Capture device NOT found by unique ID: %s. Returning",
__FUNCTION__, __LINE__, device_unique_idUTF8);
return kViECaptureDeviceDoesNotExist; return kViECaptureDeviceDoesNotExist;
} }
int newcapture_id = 0; int newcapture_id = 0;
if (GetFreeCaptureId(&newcapture_id) == false) { if (!GetFreeCaptureId(&newcapture_id)) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), LOG(LS_ERROR) << "All capture devices already allocated.";
"%s: Maximum supported number of capture devices already in "
"use", __FUNCTION__);
return kViECaptureDeviceMaxNoDevicesAllocated; return kViECaptureDeviceMaxNoDevicesAllocated;
} }
ViECapturer* vie_capture = ViECapturer::CreateViECapture( ViECapturer* vie_capture = ViECapturer::CreateViECapture(
newcapture_id, engine_id_, config_, device_unique_idUTF8, newcapture_id, engine_id_, config_, device_unique_idUTF8,
device_unique_idUTF8Length, *module_process_thread_); device_unique_idUTF8Length, *module_process_thread_);
if (!vie_capture) { if (!vie_capture) {
ReturnCaptureId(newcapture_id); ReturnCaptureId(newcapture_id);
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
"%s: Could not create capture module for %s", __FUNCTION__,
device_unique_idUTF8);
return kViECaptureDeviceUnknownError; return kViECaptureDeviceUnknownError;
} }
vie_frame_provider_map_[newcapture_id] = vie_capture; vie_frame_provider_map_[newcapture_id] = vie_capture;
capture_id = newcapture_id; capture_id = newcapture_id;
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(device_unique_id: %s, capture_id: %d)", __FUNCTION__,
device_unique_idUTF8, capture_id);
return 0; return 0;
} }
int ViEInputManager::CreateCaptureDevice(VideoCaptureModule* capture_module, int ViEInputManager::CreateCaptureDevice(VideoCaptureModule* capture_module,
int& capture_id) { int& capture_id) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
__FUNCTION__);
CriticalSectionScoped cs(map_cs_.get()); CriticalSectionScoped cs(map_cs_.get());
int newcapture_id = 0; int newcapture_id = 0;
if (!GetFreeCaptureId(&newcapture_id)) { if (!GetFreeCaptureId(&newcapture_id)) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), LOG(LS_ERROR) << "All capture devices already allocated.";
"%s: Maximum supported number of capture devices already in "
"use", __FUNCTION__);
return kViECaptureDeviceMaxNoDevicesAllocated; return kViECaptureDeviceMaxNoDevicesAllocated;
} }
@ -286,21 +248,15 @@ int ViEInputManager::CreateCaptureDevice(VideoCaptureModule* capture_module,
newcapture_id, engine_id_, config_, newcapture_id, engine_id_, config_,
capture_module, *module_process_thread_); capture_module, *module_process_thread_);
if (!vie_capture) { if (!vie_capture) {
ReturnCaptureId(newcapture_id); ReturnCaptureId(newcapture_id);
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
"%s: Could attach capture module.", __FUNCTION__);
return kViECaptureDeviceUnknownError; return kViECaptureDeviceUnknownError;
} }
vie_frame_provider_map_[newcapture_id] = vie_capture; vie_frame_provider_map_[newcapture_id] = vie_capture;
capture_id = newcapture_id; capture_id = newcapture_id;
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s, capture_id: %d", __FUNCTION__, capture_id);
return 0; return 0;
} }
int ViEInputManager::DestroyCaptureDevice(const int capture_id) { int ViEInputManager::DestroyCaptureDevice(const int capture_id) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(capture_id: %d)", __FUNCTION__, capture_id);
ViECapturer* vie_capture = NULL; ViECapturer* vie_capture = NULL;
{ {
// We need exclusive access to the object to delete it. // We need exclusive access to the object to delete it.
@ -310,18 +266,14 @@ int ViEInputManager::DestroyCaptureDevice(const int capture_id) {
vie_capture = ViECapturePtr(capture_id); vie_capture = ViECapturePtr(capture_id);
if (!vie_capture) { if (!vie_capture) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), LOG(LS_ERROR) << "No such capture device id: " << capture_id;
"%s(capture_id: %d) - No such capture device id",
__FUNCTION__, capture_id);
return -1; return -1;
} }
uint32_t num_callbacks = uint32_t num_callbacks =
vie_capture->NumberOfRegisteredFrameCallbacks(); vie_capture->NumberOfRegisteredFrameCallbacks();
if (num_callbacks > 0) { if (num_callbacks > 0) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, LOG(LS_WARNING) << num_callbacks << " still registered to capture id "
ViEId(engine_id_), "%s(capture_id: %d) - %u registered " << capture_id << " when destroying capture device.";
"callbacks when destroying capture device",
__FUNCTION__, capture_id, num_callbacks);
} }
vie_frame_provider_map_.erase(capture_id); vie_frame_provider_map_.erase(capture_id);
ReturnCaptureId(capture_id); ReturnCaptureId(capture_id);
@ -336,15 +288,11 @@ int ViEInputManager::DestroyCaptureDevice(const int capture_id) {
int ViEInputManager::CreateExternalCaptureDevice( int ViEInputManager::CreateExternalCaptureDevice(
ViEExternalCapture*& external_capture, ViEExternalCapture*& external_capture,
int& capture_id) { int& capture_id) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
__FUNCTION__);
CriticalSectionScoped cs(map_cs_.get()); CriticalSectionScoped cs(map_cs_.get());
int newcapture_id = 0; int newcapture_id = 0;
if (GetFreeCaptureId(&newcapture_id) == false) { if (GetFreeCaptureId(&newcapture_id) == false) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), LOG(LS_ERROR) << "All capture devices already allocated.";
"%s: Maximum supported number of capture devices already in "
"use", __FUNCTION__);
return kViECaptureDeviceMaxNoDevicesAllocated; return kViECaptureDeviceMaxNoDevicesAllocated;
} }
@ -352,30 +300,21 @@ int ViEInputManager::CreateExternalCaptureDevice(
newcapture_id, engine_id_, config_, NULL, 0, *module_process_thread_); newcapture_id, engine_id_, config_, NULL, 0, *module_process_thread_);
if (!vie_capture) { if (!vie_capture) {
ReturnCaptureId(newcapture_id); ReturnCaptureId(newcapture_id);
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
"%s: Could not create capture module for external capture.",
__FUNCTION__);
return kViECaptureDeviceUnknownError; return kViECaptureDeviceUnknownError;
} }
vie_frame_provider_map_[newcapture_id] = vie_capture; vie_frame_provider_map_[newcapture_id] = vie_capture;
capture_id = newcapture_id; capture_id = newcapture_id;
external_capture = vie_capture; external_capture = vie_capture;
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s, capture_id: %d)", __FUNCTION__, capture_id);
return 0; return 0;
} }
bool ViEInputManager::GetFreeCaptureId(int* freecapture_id) { bool ViEInputManager::GetFreeCaptureId(int* freecapture_id) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
__FUNCTION__);
for (int id = 0; id < kViEMaxCaptureDevices; id++) { for (int id = 0; id < kViEMaxCaptureDevices; id++) {
if (free_capture_device_id_[id]) { if (free_capture_device_id_[id]) {
// We found a free capture device id. // We found a free capture device id.
free_capture_device_id_[id] = false; free_capture_device_id_[id] = false;
*freecapture_id = id + kViECaptureIdBase; *freecapture_id = id + kViECaptureIdBase;
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s: new id: %d", __FUNCTION__, *freecapture_id);
return true; return true;
} }
} }
@ -383,8 +322,6 @@ bool ViEInputManager::GetFreeCaptureId(int* freecapture_id) {
} }
void ViEInputManager::ReturnCaptureId(int capture_id) { void ViEInputManager::ReturnCaptureId(int capture_id) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
"%s(%d)", __FUNCTION__, capture_id);
CriticalSectionScoped cs(map_cs_.get()); CriticalSectionScoped cs(map_cs_.get());
if (capture_id >= kViECaptureIdBase && if (capture_id >= kViECaptureIdBase &&
capture_id < kViEMaxCaptureDevices + kViECaptureIdBase) { capture_id < kViEMaxCaptureDevices + kViECaptureIdBase) {

View File

@ -16,7 +16,7 @@
#endif #endif
#include "webrtc/engine_configurations.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/include/vie_errors.h"
#include "webrtc/video_engine/vie_channel.h" #include "webrtc/video_engine/vie_channel.h"
#include "webrtc/video_engine/vie_channel_manager.h" #include "webrtc/video_engine/vie_channel_manager.h"
@ -39,35 +39,25 @@ ViENetwork* ViENetwork::GetInterface(VideoEngine* video_engine) {
} }
int ViENetworkImpl::Release() { int ViENetworkImpl::Release() {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
"ViENetwork::Release()");
// Decrease ref count. // Decrease ref count.
(*this)--; (*this)--;
int32_t ref_count = GetCount(); int32_t ref_count = GetCount();
if (ref_count < 0) { if (ref_count < 0) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), LOG(LS_ERROR) << "ViENetwork release too many times";
"ViENetwork release too many times");
shared_data_->SetLastError(kViEAPIDoesNotExist); shared_data_->SetLastError(kViEAPIDoesNotExist);
return -1; return -1;
} }
WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(),
"ViENetwork reference count: %d", ref_count);
return ref_count; return ref_count;
} }
void ViENetworkImpl::SetNetworkTransmissionState(const int video_channel, void ViENetworkImpl::SetNetworkTransmissionState(const int video_channel,
const bool is_transmitting) { const bool is_transmitting) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "channel: " << video_channel
ViEId(shared_data_->instance_id(), video_channel), << " transmitting: " << (is_transmitting ? "yes" : "no");
"%s(event: Network %s)", __FUNCTION__,
is_transmitting ? "transmitting" : "not transmitting");
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEEncoder* vie_encoder = cs.Encoder(video_channel); ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (!vie_encoder) { if (!vie_encoder) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"An encoder doesn't exist for this channel");
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return; return;
} }
@ -75,34 +65,21 @@ void ViENetworkImpl::SetNetworkTransmissionState(const int video_channel,
} }
ViENetworkImpl::ViENetworkImpl(ViESharedData* shared_data) ViENetworkImpl::ViENetworkImpl(ViESharedData* shared_data)
: shared_data_(shared_data) { : shared_data_(shared_data) {}
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
"ViENetworkImpl::ViENetworkImpl() Ctor");
}
ViENetworkImpl::~ViENetworkImpl() { ViENetworkImpl::~ViENetworkImpl() {}
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
"ViENetworkImpl::~ViENetworkImpl() Dtor");
}
int ViENetworkImpl::RegisterSendTransport(const int video_channel, int ViENetworkImpl::RegisterSendTransport(const int video_channel,
Transport& transport) { Transport& transport) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "channel: " << video_channel;
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) { if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s Channel doesn't exist", __FUNCTION__);
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return -1; return -1;
} }
if (vie_channel->Sending()) { if (vie_channel->Sending()) {
WEBRTC_TRACE(kTraceError, kTraceVideo, LOG_F(LS_ERROR) << "Already sending on channel: " << video_channel;
ViEId(shared_data_->instance_id(), video_channel),
"%s Channel already sending.", __FUNCTION__);
shared_data_->SetLastError(kViENetworkAlreadySending); shared_data_->SetLastError(kViENetworkAlreadySending);
return -1; return -1;
} }
@ -114,22 +91,15 @@ int ViENetworkImpl::RegisterSendTransport(const int video_channel,
} }
int ViENetworkImpl::DeregisterSendTransport(const int video_channel) { int ViENetworkImpl::DeregisterSendTransport(const int video_channel) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "channel: " << video_channel;
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) { if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s Channel doesn't exist", __FUNCTION__);
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return -1; return -1;
} }
if (vie_channel->Sending()) { if (vie_channel->Sending()) {
WEBRTC_TRACE(kTraceError, kTraceVideo, LOG_F(LS_ERROR) << "Actively sending on channel: " << video_channel;
ViEId(shared_data_->instance_id(), video_channel),
"%s Channel already sending", __FUNCTION__);
shared_data_->SetLastError(kViENetworkAlreadySending); shared_data_->SetLastError(kViENetworkAlreadySending);
return -1; return -1;
} }
@ -143,17 +113,9 @@ int ViENetworkImpl::DeregisterSendTransport(const int video_channel) {
int ViENetworkImpl::ReceivedRTPPacket(const int video_channel, const void* data, int ViENetworkImpl::ReceivedRTPPacket(const int video_channel, const void* data,
const int length, const int length,
const PacketTime& packet_time) { const PacketTime& packet_time) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d, data: -, length: %d)", __FUNCTION__,
video_channel, length);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) { if (!vie_channel) {
// The channel doesn't exists
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"Channel doesn't exist");
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return -1; return -1;
} }
@ -162,16 +124,9 @@ int ViENetworkImpl::ReceivedRTPPacket(const int video_channel, const void* data,
int ViENetworkImpl::ReceivedRTCPPacket(const int video_channel, int ViENetworkImpl::ReceivedRTCPPacket(const int video_channel,
const void* data, const int length) { const void* data, const int length) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d, data: -, length: %d)", __FUNCTION__,
video_channel, length);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) { if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"Channel doesn't exist");
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return -1; return -1;
} }
@ -179,15 +134,10 @@ int ViENetworkImpl::ReceivedRTCPPacket(const int video_channel,
} }
int ViENetworkImpl::SetMTU(int video_channel, unsigned int mtu) { int ViENetworkImpl::SetMTU(int video_channel, unsigned int mtu) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "channel: " << video_channel << " mtu: " << mtu;
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d, mtu: %u)", __FUNCTION__, video_channel, mtu);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) { if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"Channel doesn't exist");
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return -1; return -1;
} }
@ -200,16 +150,9 @@ int ViENetworkImpl::SetMTU(int video_channel, unsigned int mtu) {
int ViENetworkImpl::ReceivedBWEPacket(const int video_channel, int ViENetworkImpl::ReceivedBWEPacket(const int video_channel,
int64_t arrival_time_ms, int payload_size, const RTPHeader& header) { int64_t arrival_time_ms, int payload_size, const RTPHeader& header) {
WEBRTC_TRACE(kTraceStream, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d, time: %d, size: %d, ssrc: %u)", __FUNCTION__,
video_channel, arrival_time_ms, payload_size, header.ssrc);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) { if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"Channel doesn't exist");
shared_data_->SetLastError(kViENetworkInvalidChannelId); shared_data_->SetLastError(kViENetworkInvalidChannelId);
return -1; return -1;
} }
@ -220,9 +163,7 @@ int ViENetworkImpl::ReceivedBWEPacket(const int video_channel,
bool ViENetworkImpl::SetBandwidthEstimationConfig( bool ViENetworkImpl::SetBandwidthEstimationConfig(
int video_channel, const webrtc::Config& config) { int video_channel, const webrtc::Config& config) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "channel: " << video_channel;
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
return shared_data_->channel_manager()->SetBandwidthEstimationConfig( return shared_data_->channel_manager()->SetBandwidthEstimationConfig(
video_channel, config); video_channel, config);
} }

View File

@ -25,7 +25,6 @@
#include "webrtc/system_wrappers/interface/logging.h" #include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/system_wrappers/interface/tick_util.h" #include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/system_wrappers/interface/timestamp_extrapolator.h" #include "webrtc/system_wrappers/interface/timestamp_extrapolator.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc { namespace webrtc {
@ -34,7 +33,6 @@ ViEReceiver::ViEReceiver(const int32_t channel_id,
RemoteBitrateEstimator* remote_bitrate_estimator, RemoteBitrateEstimator* remote_bitrate_estimator,
RtpFeedback* rtp_feedback) RtpFeedback* rtp_feedback)
: receive_cs_(CriticalSectionWrapper::CreateCriticalSection()), : receive_cs_(CriticalSectionWrapper::CreateCriticalSection()),
channel_id_(channel_id),
rtp_header_parser_(RtpHeaderParser::Create()), rtp_header_parser_(RtpHeaderParser::Create()),
rtp_payload_registry_(new RTPPayloadRegistry( rtp_payload_registry_(new RTPPayloadRegistry(
RTPPayloadStrategy::CreateStrategy(false))), RTPPayloadStrategy::CreateStrategy(false))),
@ -211,8 +209,6 @@ bool ViEReceiver::OnRecoveredPacket(const uint8_t* rtp_packet,
int rtp_packet_length) { int rtp_packet_length) {
RTPHeader header; RTPHeader header;
if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, &header)) { if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, &header)) {
WEBRTC_TRACE(kTraceDebug, webrtc::kTraceVideo, channel_id_,
"IncomingPacket invalid RTP header");
return false; return false;
} }
header.payload_type_frequency = kVideoPayloadTypeFrequency; header.payload_type_frequency = kVideoPayloadTypeFrequency;
@ -247,8 +243,6 @@ int ViEReceiver::InsertRTPPacket(const uint8_t* rtp_packet,
RTPHeader header; RTPHeader header;
if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length,
&header)) { &header)) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
"Incoming packet: Invalid RTP header");
return -1; return -1;
} }
int payload_length = rtp_packet_length - header.headerLength; int payload_length = rtp_packet_length - header.headerLength;
@ -299,8 +293,6 @@ bool ViEReceiver::ParseAndHandleEncapsulatingHeader(const uint8_t* packet,
rtp_receive_statistics_->FecPacketReceived(header.ssrc); rtp_receive_statistics_->FecPacketReceived(header.ssrc);
if (fec_receiver_->AddReceivedRedPacket( if (fec_receiver_->AddReceivedRedPacket(
header, packet, packet_length, ulpfec_pt) != 0) { header, packet, packet_length, ulpfec_pt) != 0) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
"Incoming RED packet error");
return false; return false;
} }
return fec_receiver_->ProcessReceivedFec() == 0; return fec_receiver_->ProcessReceivedFec() == 0;
@ -317,16 +309,14 @@ bool ViEReceiver::ParseAndHandleEncapsulatingHeader(const uint8_t* packet,
return false; return false;
CriticalSectionScoped cs(receive_cs_.get()); CriticalSectionScoped cs(receive_cs_.get());
if (restored_packet_in_use_) { if (restored_packet_in_use_) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_, LOG(LS_WARNING) << "Multiple RTX headers detected, dropping packet.";
"Multiple RTX headers detected, dropping packet");
return false; return false;
} }
uint8_t* restored_packet_ptr = restored_packet_; uint8_t* restored_packet_ptr = restored_packet_;
if (!rtp_payload_registry_->RestoreOriginalPacket( if (!rtp_payload_registry_->RestoreOriginalPacket(
&restored_packet_ptr, packet, &packet_length, rtp_receiver_->SSRC(), &restored_packet_ptr, packet, &packet_length, rtp_receiver_->SSRC(),
header)) { header)) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_, LOG(LS_WARNING) << "Incoming RTX packet: Invalid RTP header";
"Incoming RTX packet: invalid RTP header");
return false; return false;
} }
restored_packet_in_use_ = true; restored_packet_in_use_ = true;
@ -430,16 +420,12 @@ int ViEReceiver::StartRTPDump(const char file_nameUTF8[1024]) {
} else { } else {
rtp_dump_ = RtpDump::CreateRtpDump(); rtp_dump_ = RtpDump::CreateRtpDump();
if (rtp_dump_ == NULL) { if (rtp_dump_ == NULL) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StartRTPDump: Failed to create RTP dump");
return -1; return -1;
} }
} }
if (rtp_dump_->Start(file_nameUTF8) != 0) { if (rtp_dump_->Start(file_nameUTF8) != 0) {
RtpDump::DestroyRtpDump(rtp_dump_); RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL; rtp_dump_ = NULL;
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StartRTPDump: Failed to start RTP dump");
return -1; return -1;
} }
return 0; return 0;
@ -450,15 +436,10 @@ int ViEReceiver::StopRTPDump() {
if (rtp_dump_) { if (rtp_dump_) {
if (rtp_dump_->IsActive()) { if (rtp_dump_->IsActive()) {
rtp_dump_->Stop(); rtp_dump_->Stop();
} else {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StopRTPDump: Dump not active");
} }
RtpDump::DestroyRtpDump(rtp_dump_); RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL; rtp_dump_ = NULL;
} else { } else {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StopRTPDump: RTP dump not started");
return -1; return -1;
} }
return 0; return 0;

View File

@ -109,7 +109,6 @@ class ViEReceiver : public RtpData {
void CalculateCaptureNtpTime(WebRtcRTPHeader* rtp_header); void CalculateCaptureNtpTime(WebRtcRTPHeader* rtp_header);
scoped_ptr<CriticalSectionWrapper> receive_cs_; scoped_ptr<CriticalSectionWrapper> receive_cs_;
const int32_t channel_id_;
scoped_ptr<RtpHeaderParser> rtp_header_parser_; scoped_ptr<RtpHeaderParser> rtp_header_parser_;
scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
scoped_ptr<RtpReceiver> rtp_receiver_; scoped_ptr<RtpReceiver> rtp_receiver_;

View File

@ -37,15 +37,12 @@ VieRemb::~VieRemb() {}
void VieRemb::AddReceiveChannel(RtpRtcp* rtp_rtcp) { void VieRemb::AddReceiveChannel(RtpRtcp* rtp_rtcp) {
assert(rtp_rtcp); assert(rtp_rtcp);
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
"VieRemb::AddReceiveChannel(%p)", rtp_rtcp);
CriticalSectionScoped cs(list_crit_.get()); CriticalSectionScoped cs(list_crit_.get());
if (std::find(receive_modules_.begin(), receive_modules_.end(), rtp_rtcp) != if (std::find(receive_modules_.begin(), receive_modules_.end(), rtp_rtcp) !=
receive_modules_.end()) receive_modules_.end())
return; return;
WEBRTC_TRACE(kTraceInfo, kTraceVideo, -1, "AddRembChannel");
// The module probably doesn't have a remote SSRC yet, so don't add it to the // The module probably doesn't have a remote SSRC yet, so don't add it to the
// map. // map.
receive_modules_.push_back(rtp_rtcp); receive_modules_.push_back(rtp_rtcp);
@ -53,8 +50,6 @@ void VieRemb::AddReceiveChannel(RtpRtcp* rtp_rtcp) {
void VieRemb::RemoveReceiveChannel(RtpRtcp* rtp_rtcp) { void VieRemb::RemoveReceiveChannel(RtpRtcp* rtp_rtcp) {
assert(rtp_rtcp); assert(rtp_rtcp);
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
"VieRemb::RemoveReceiveChannel(%p)", rtp_rtcp);
CriticalSectionScoped cs(list_crit_.get()); CriticalSectionScoped cs(list_crit_.get());
for (RtpModules::iterator it = receive_modules_.begin(); for (RtpModules::iterator it = receive_modules_.begin();
@ -68,8 +63,6 @@ void VieRemb::RemoveReceiveChannel(RtpRtcp* rtp_rtcp) {
void VieRemb::AddRembSender(RtpRtcp* rtp_rtcp) { void VieRemb::AddRembSender(RtpRtcp* rtp_rtcp) {
assert(rtp_rtcp); assert(rtp_rtcp);
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
"VieRemb::AddRembSender(%p)", rtp_rtcp);
CriticalSectionScoped cs(list_crit_.get()); CriticalSectionScoped cs(list_crit_.get());
@ -82,8 +75,6 @@ void VieRemb::AddRembSender(RtpRtcp* rtp_rtcp) {
void VieRemb::RemoveRembSender(RtpRtcp* rtp_rtcp) { void VieRemb::RemoveRembSender(RtpRtcp* rtp_rtcp) {
assert(rtp_rtcp); assert(rtp_rtcp);
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
"VieRemb::RemoveRembSender(%p)", rtp_rtcp);
CriticalSectionScoped cs(list_crit_.get()); CriticalSectionScoped cs(list_crit_.get());
for (RtpModules::iterator it = rtcp_sender_.begin(); for (RtpModules::iterator it = rtcp_sender_.begin();
@ -105,8 +96,6 @@ bool VieRemb::InUse() const {
void VieRemb::OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs, void VieRemb::OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
unsigned int bitrate) { unsigned int bitrate) {
WEBRTC_TRACE(kTraceStream, kTraceVideo, -1,
"VieRemb::UpdateBitrateEstimate(bitrate: %u)", bitrate);
list_crit_->Enter(); list_crit_->Enter();
// If we already have an estimate, check if the new total estimate is below // If we already have an estimate, check if the new total estimate is below
// kSendThresholdPercent of the previous estimate. // kSendThresholdPercent of the previous estimate.

View File

@ -13,7 +13,7 @@
#include "webrtc/engine_configurations.h" #include "webrtc/engine_configurations.h"
#include "webrtc/modules/video_render/include/video_render.h" #include "webrtc/modules/video_render/include/video_render.h"
#include "webrtc/modules/video_render/include/video_render_defines.h" #include "webrtc/modules/video_render/include/video_render_defines.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/include/vie_errors.h"
#include "webrtc/video_engine/vie_capturer.h" #include "webrtc/video_engine/vie_capturer.h"
#include "webrtc/video_engine/vie_channel.h" #include "webrtc/video_engine/vie_channel.h"
@ -44,36 +44,24 @@ ViERender* ViERender::GetInterface(VideoEngine* video_engine) {
} }
int ViERenderImpl::Release() { int ViERenderImpl::Release() {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
"ViERender::Release()");
// Decrease ref count // Decrease ref count
(*this)--; (*this)--;
int32_t ref_count = GetCount(); int32_t ref_count = GetCount();
if (ref_count < 0) { if (ref_count < 0) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(), LOG(LS_ERROR) << "ViERender release too many times";
"ViERender release too many times");
return -1; return -1;
} }
WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(),
"ViERender reference count: %d", ref_count);
return ref_count; return ref_count;
} }
ViERenderImpl::ViERenderImpl(ViESharedData* shared_data) ViERenderImpl::ViERenderImpl(ViESharedData* shared_data)
: shared_data_(shared_data) { : shared_data_(shared_data) {}
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
"ViERenderImpl::ViERenderImpl() Ctor");
}
ViERenderImpl::~ViERenderImpl() { ViERenderImpl::~ViERenderImpl() {}
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
"ViERenderImpl::~ViERenderImpl() Dtor");
}
int ViERenderImpl::RegisterVideoRenderModule( int ViERenderImpl::RegisterVideoRenderModule(
VideoRender& render_module) { VideoRender& render_module) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO);
"%s (&render_module: %p)", __FUNCTION__, &render_module);
if (shared_data_->render_manager()->RegisterVideoRenderModule( if (shared_data_->render_manager()->RegisterVideoRenderModule(
&render_module) != 0) { &render_module) != 0) {
shared_data_->SetLastError(kViERenderUnknownError); shared_data_->SetLastError(kViERenderUnknownError);
@ -84,8 +72,7 @@ int ViERenderImpl::RegisterVideoRenderModule(
int ViERenderImpl::DeRegisterVideoRenderModule( int ViERenderImpl::DeRegisterVideoRenderModule(
VideoRender& render_module) { VideoRender& render_module) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO);
"%s (&render_module: %p)", __FUNCTION__, &render_module);
if (shared_data_->render_manager()->DeRegisterVideoRenderModule( if (shared_data_->render_manager()->DeRegisterVideoRenderModule(
&render_module) != 0) { &render_module) != 0) {
// Error logging is done in ViERenderManager::DeRegisterVideoRenderModule. // Error logging is done in ViERenderManager::DeRegisterVideoRenderModule.
@ -99,17 +86,14 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
const unsigned int z_order, const float left, const unsigned int z_order, const float left,
const float top, const float right, const float top, const float right,
const float bottom) { const float bottom) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "render_id: " << render_id << " z_order: " << z_order
"%s (render_id: %d, window: 0x%p, z_order: %u, left: %f, " << " left: " << left << " top: " << top << " right: " << right
"top: %f, right: %f, bottom: %f)", << " bottom: " << bottom;
__FUNCTION__, render_id, window, z_order, left, top, right,
bottom);
{ {
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
if (rs.Renderer(render_id)) { if (rs.Renderer(render_id)) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), LOG(LS_ERROR) << "Renderer for render_id: " << render_id
"%s - Renderer already exist %d.", __FUNCTION__, << " already exists.";
render_id);
shared_data_->SetLastError(kViERenderAlreadyExists); shared_data_->SetLastError(kViERenderAlreadyExists);
return -1; return -1;
} }
@ -119,9 +103,6 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
ViEChannelManagerScoped cm(*(shared_data_->channel_manager())); ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
ViEFrameProviderBase* frame_provider = cm.Channel(render_id); ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
if (!frame_provider) { if (!frame_provider) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -137,9 +118,6 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id); ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
if (!frame_provider) { if (!frame_provider) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -154,17 +132,12 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
} }
int ViERenderImpl::RemoveRenderer(const int render_id) { int ViERenderImpl::RemoveRenderer(const int render_id) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_INFO) << "render_id: " << render_id;
"%s(render_id: %d)", __FUNCTION__, render_id);
ViERenderer* renderer = NULL; ViERenderer* renderer = NULL;
{ {
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
renderer = rs.Renderer(render_id); renderer = rs.Renderer(render_id);
if (!renderer) { if (!renderer) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo,
ViEId(shared_data_->instance_id()),
"%s No render exist with render_id: %d", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -176,10 +149,6 @@ int ViERenderImpl::RemoveRenderer(const int render_id) {
ViEChannelManagerScoped cm(*(shared_data_->channel_manager())); ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
ViEChannel* channel = cm.Channel(render_id); ViEChannel* channel = cm.Channel(render_id);
if (!channel) { if (!channel) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo,
ViEId(shared_data_->instance_id()),
"%s: no channel with id %d exists ", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -189,10 +158,6 @@ int ViERenderImpl::RemoveRenderer(const int render_id) {
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViEFrameProviderBase* provider = is.FrameProvider(render_id); ViEFrameProviderBase* provider = is.FrameProvider(render_id);
if (!provider) { if (!provider) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo,
ViEId(shared_data_->instance_id()),
"%s: no provider with id %d exists ", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -206,16 +171,10 @@ int ViERenderImpl::RemoveRenderer(const int render_id) {
} }
int ViERenderImpl::StartRender(const int render_id) { int ViERenderImpl::StartRender(const int render_id) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "render_id: " << render_id;
ViEId(shared_data_->instance_id(), render_id),
"%s(channel: %d)", __FUNCTION__, render_id);
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
ViERenderer* renderer = rs.Renderer(render_id); ViERenderer* renderer = rs.Renderer(render_id);
if (!renderer) { if (!renderer) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), render_id),
"%s: No renderer with render Id %d exist.", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -227,16 +186,10 @@ int ViERenderImpl::StartRender(const int render_id) {
} }
int ViERenderImpl::StopRender(const int render_id) { int ViERenderImpl::StopRender(const int render_id) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "render_id: " << render_id;
ViEId(shared_data_->instance_id(), render_id),
"%s(channel: %d)", __FUNCTION__, render_id);
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
ViERenderer* renderer = rs.Renderer(render_id); ViERenderer* renderer = rs.Renderer(render_id);
if (!renderer) { if (!renderer) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), render_id),
"%s: No renderer with render_id %d exist.", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -248,16 +201,11 @@ int ViERenderImpl::StopRender(const int render_id) {
} }
int ViERenderImpl::SetExpectedRenderDelay(int render_id, int render_delay) { int ViERenderImpl::SetExpectedRenderDelay(int render_id, int render_delay) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "render_id: " << render_id
ViEId(shared_data_->instance_id(), render_id), << " render_delay: " << render_delay;
"%s(channel: %d)", __FUNCTION__, render_id);
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
ViERenderer* renderer = rs.Renderer(render_id); ViERenderer* renderer = rs.Renderer(render_id);
if (!renderer) { if (!renderer) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), render_id),
"%s: No renderer with render_id %d exist.", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -271,16 +219,12 @@ int ViERenderImpl::SetExpectedRenderDelay(int render_id, int render_delay) {
int ViERenderImpl::ConfigureRender(int render_id, const unsigned int z_order, int ViERenderImpl::ConfigureRender(int render_id, const unsigned int z_order,
const float left, const float top, const float left, const float top,
const float right, const float bottom) { const float right, const float bottom) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, LOG_F(LS_INFO) << "render_id: " << render_id << " z_order: " << z_order
ViEId(shared_data_->instance_id(), render_id), << " left: " << left << " top: " << top << " right: " << right
"%s(channel: %d)", __FUNCTION__, render_id); << " bottom: " << bottom;
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
ViERenderer* renderer = rs.Renderer(render_id); ViERenderer* renderer = rs.Renderer(render_id);
if (!renderer) { if (!renderer) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), render_id),
"%s: No renderer with render_id %d exist.", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -298,10 +242,6 @@ int ViERenderImpl::MirrorRenderStream(const int render_id, const bool enable,
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
ViERenderer* renderer = rs.Renderer(render_id); ViERenderer* renderer = rs.Renderer(render_id);
if (!renderer) { if (!renderer) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), render_id),
"%s: No renderer with render_id %d exist.", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -326,10 +266,7 @@ int ViERenderImpl::AddRenderer(const int render_id,
video_input_format != kVideoRGB565 && video_input_format != kVideoRGB565 &&
video_input_format != kVideoARGB4444 && video_input_format != kVideoARGB4444 &&
video_input_format != kVideoARGB1555) { video_input_format != kVideoARGB1555) {
WEBRTC_TRACE(kTraceError, kTraceVideo, LOG(LS_ERROR) << "Unsupported video frame format requested.";
ViEId(shared_data_->instance_id(), render_id),
"%s: Unsupported video frame format requested",
__FUNCTION__, render_id);
shared_data_->SetLastError(kViERenderInvalidFrameFormat); shared_data_->SetLastError(kViERenderInvalidFrameFormat);
return -1; return -1;
} }
@ -337,9 +274,7 @@ int ViERenderImpl::AddRenderer(const int render_id,
// Verify the renderer doesn't exist. // Verify the renderer doesn't exist.
ViERenderManagerScoped rs(*(shared_data_->render_manager())); ViERenderManagerScoped rs(*(shared_data_->render_manager()));
if (rs.Renderer(render_id)) { if (rs.Renderer(render_id)) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()), LOG_F(LS_ERROR) << "Renderer already exists for render_id: " << render_id;
"%s - Renderer already exist %d.", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderAlreadyExists); shared_data_->SetLastError(kViERenderAlreadyExists);
return -1; return -1;
} }
@ -349,9 +284,6 @@ int ViERenderImpl::AddRenderer(const int render_id,
ViEChannelManagerScoped cm(*(shared_data_->channel_manager())); ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
ViEFrameProviderBase* frame_provider = cm.Channel(render_id); ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
if (!frame_provider) { if (!frame_provider) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -373,9 +305,6 @@ int ViERenderImpl::AddRenderer(const int render_id,
ViEInputManagerScoped is(*(shared_data_->input_manager())); ViEInputManagerScoped is(*(shared_data_->input_manager()));
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id); ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
if (!frame_provider) { if (!frame_provider) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }
@ -402,12 +331,6 @@ int ViERenderImpl::AddRenderCallback(int render_id,
ViEChannelManagerScoped cm(*(shared_data_->channel_manager())); ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
ViEFrameProviderBase* frame_provider = cm.Channel(render_id); ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
if (!frame_provider) { if (!frame_provider) {
WEBRTC_TRACE(kTraceError,
kTraceVideo,
ViEId(shared_data_->instance_id()),
"%s: FrameProvider id %d doesn't exist",
__FUNCTION__,
render_id);
shared_data_->SetLastError(kViERenderInvalidRenderId); shared_data_->SetLastError(kViERenderInvalidRenderId);
return -1; return -1;
} }

View File

@ -15,7 +15,7 @@
#include "webrtc/modules/video_render/include/video_render_defines.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/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
#include "webrtc/system_wrappers/interface/trace.h" #include "webrtc/system_wrappers/interface/logging.h"
#include "webrtc/video_engine/vie_defines.h" #include "webrtc/video_engine/vie_defines.h"
#include "webrtc/video_engine/vie_renderer.h" #include "webrtc/video_engine/vie_renderer.h"
@ -35,14 +35,9 @@ ViERenderManager::ViERenderManager(int32_t engine_id)
: list_cs_(CriticalSectionWrapper::CreateCriticalSection()), : list_cs_(CriticalSectionWrapper::CreateCriticalSection()),
engine_id_(engine_id), engine_id_(engine_id),
use_external_render_module_(false) { use_external_render_module_(false) {
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id),
"ViERenderManager::ViERenderManager(engine_id: %d) - "
"Constructor", engine_id);
} }
ViERenderManager::~ViERenderManager() { ViERenderManager::~ViERenderManager() {
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_),
"ViERenderManager Destructor, engine_id: %d", engine_id_);
for (RendererMap::iterator it = stream_to_vie_renderer_.begin(); for (RendererMap::iterator it = stream_to_vie_renderer_.begin();
it != stream_to_vie_renderer_.end(); it != stream_to_vie_renderer_.end();
++it) { ++it) {
@ -57,10 +52,7 @@ int32_t ViERenderManager::RegisterVideoRenderModule(
// the registrant render module is associated with. // the registrant render module is associated with.
VideoRender* current_module = FindRenderModule(render_module->Window()); VideoRender* current_module = FindRenderModule(render_module->Window());
if (current_module) { if (current_module) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), LOG_F(LS_ERROR) << "A render module is already registered for this window.";
"A module is already registered for this window (window=%p, "
"current module=%p, registrant module=%p.",
render_module->Window(), current_module, render_module);
return -1; return -1;
} }
@ -75,9 +67,8 @@ int32_t ViERenderManager::DeRegisterVideoRenderModule(
// Check if there are streams in the module. // Check if there are streams in the module.
uint32_t n_streams = render_module->GetNumIncomingRenderStreams(); uint32_t n_streams = render_module->GetNumIncomingRenderStreams();
if (n_streams != 0) { if (n_streams != 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_), LOG(LS_ERROR) << "There are still " << n_streams
"There are still %d streams in this module, cannot " << "in this module, cannot de-register.";
"de-register", n_streams);
return -1; return -1;
} }
@ -89,8 +80,8 @@ int32_t ViERenderManager::DeRegisterVideoRenderModule(
return 0; return 0;
} }
} }
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
"Module not registered"); LOG(LS_ERROR) << "Module not registered.";
return -1; return -1;
} }
@ -105,9 +96,7 @@ ViERenderer* ViERenderManager::AddRenderStream(const int32_t render_id,
if (stream_to_vie_renderer_.find(render_id) != if (stream_to_vie_renderer_.find(render_id) !=
stream_to_vie_renderer_.end()) { stream_to_vie_renderer_.end()) {
// This stream is already added to a renderer, not allowed! LOG(LS_ERROR) << "Render stream already exists";
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
"Render stream already exists");
return NULL; return NULL;
} }
@ -117,11 +106,9 @@ ViERenderer* ViERenderManager::AddRenderStream(const int32_t render_id,
// No render module for this window, create a new one. // No render module for this window, create a new one.
render_module = VideoRender::CreateVideoRender(ViEModuleId(engine_id_, -1), render_module = VideoRender::CreateVideoRender(ViEModuleId(engine_id_, -1),
window, false); window, false);
if (!render_module) { if (!render_module)
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
"Could not create new render module");
return NULL; return NULL;
}
render_list_.push_back(render_module); render_list_.push_back(render_module);
} }
@ -131,12 +118,9 @@ ViERenderer* ViERenderManager::AddRenderStream(const int32_t render_id,
*this, z_order, *this, z_order,
left, top, right, left, top, right,
bottom); bottom);
if (!vie_renderer) { if (!vie_renderer)
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
ViEId(engine_id_, render_id),
"Could not create new render stream");
return NULL; return NULL;
}
stream_to_vie_renderer_[render_id] = vie_renderer; stream_to_vie_renderer_[render_id] = vie_renderer;
return vie_renderer; return vie_renderer;
} }
@ -149,9 +133,7 @@ int32_t ViERenderManager::RemoveRenderStream(
CriticalSectionScoped cs(list_cs_.get()); CriticalSectionScoped cs(list_cs_.get());
RendererMap::iterator it = stream_to_vie_renderer_.find(render_id); RendererMap::iterator it = stream_to_vie_renderer_.find(render_id);
if (it == stream_to_vie_renderer_.end()) { if (it == stream_to_vie_renderer_.end()) {
// No such stream LOG(LS_ERROR) << "No renderer found for render_id: " << render_id;
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(engine_id_),
"No renderer for this stream found, channel_id");
return 0; return 0;
} }

File diff suppressed because it is too large Load Diff

View File

@ -59,16 +59,12 @@ int ViESender::StartRTPDump(const char file_nameUTF8[1024]) {
} else { } else {
rtp_dump_ = RtpDump::CreateRtpDump(); rtp_dump_ = RtpDump::CreateRtpDump();
if (rtp_dump_ == NULL) { if (rtp_dump_ == NULL) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StartSRTPDump: Failed to create RTP dump");
return -1; return -1;
} }
} }
if (rtp_dump_->Start(file_nameUTF8) != 0) { if (rtp_dump_->Start(file_nameUTF8) != 0) {
RtpDump::DestroyRtpDump(rtp_dump_); RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL; rtp_dump_ = NULL;
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StartRTPDump: Failed to start RTP dump");
return -1; return -1;
} }
return 0; return 0;
@ -79,15 +75,10 @@ int ViESender::StopRTPDump() {
if (rtp_dump_) { if (rtp_dump_) {
if (rtp_dump_->IsActive()) { if (rtp_dump_->IsActive()) {
rtp_dump_->Stop(); rtp_dump_->Stop();
} else {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StopRTPDump: Dump not active");
} }
RtpDump::DestroyRtpDump(rtp_dump_); RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL; rtp_dump_ = NULL;
} else { } else {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
"StopRTPDump: RTP dump not started");
return -1; return -1;
} }
return 0; return 0;
@ -106,12 +97,7 @@ int ViESender::SendPacket(int vie_id, const void* data, int len) {
static_cast<uint16_t>(len)); static_cast<uint16_t>(len));
} }
const int bytes_sent = transport_->SendPacket(channel_id_, data, len); return transport_->SendPacket(channel_id_, data, len);
if (bytes_sent != len) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, channel_id_,
"ViESender::SendPacket - Transport failed to send RTP packet");
}
return bytes_sent;
} }
int ViESender::SendRTCPPacket(int vie_id, const void* data, int len) { int ViESender::SendRTCPPacket(int vie_id, const void* data, int len) {
@ -126,14 +112,7 @@ int ViESender::SendRTCPPacket(int vie_id, const void* data, int len) {
static_cast<uint16_t>(len)); static_cast<uint16_t>(len));
} }
const int bytes_sent = transport_->SendRTCPPacket(channel_id_, data, len); return transport_->SendRTCPPacket(channel_id_, data, len);
if (bytes_sent != len) {
WEBRTC_TRACE(
webrtc::kTraceWarning, webrtc::kTraceVideo, channel_id_,
"ViESender::SendRTCPPacket - Transport failed to send RTCP packet"
" (%d vs %d)", bytes_sent, len);
}
return bytes_sent;
} }
} // namespace webrtc } // namespace webrtc

View File

@ -14,7 +14,7 @@
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
#include "webrtc/modules/video_coding/main/interface/video_coding.h" #include "webrtc/modules/video_coding/main/interface/video_coding.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.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/system_wrappers/interface/trace_event.h" #include "webrtc/system_wrappers/interface/trace_event.h"
#include "webrtc/video_engine/stream_synchronization.h" #include "webrtc/video_engine/stream_synchronization.h"
#include "webrtc/video_engine/vie_channel.h" #include "webrtc/video_engine/vie_channel.h"
@ -103,8 +103,6 @@ int32_t ViESyncModule::Process() {
last_sync_time_ = TickTime::Now(); last_sync_time_ = TickTime::Now();
const int current_video_delay_ms = vcm_->Delay(); const int current_video_delay_ms = vcm_->Delay();
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
"Video delay (JB + decoder) is %d ms", current_video_delay_ms);
if (voe_channel_id_ == -1) { if (voe_channel_id_ == -1) {
return 0; return 0;
@ -117,11 +115,6 @@ int32_t ViESyncModule::Process() {
if (voe_sync_interface_->GetDelayEstimate(voe_channel_id_, if (voe_sync_interface_->GetDelayEstimate(voe_channel_id_,
&audio_jitter_buffer_delay_ms, &audio_jitter_buffer_delay_ms,
&playout_buffer_delay_ms) != 0) { &playout_buffer_delay_ms) != 0) {
// Could not get VoE delay value, probably not a valid channel Id or
// the channel have not received enough packets.
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo, vie_channel_->Id(),
"%s: VE_GetDelayEstimate error for voice_channel %d",
__FUNCTION__, voe_channel_id_);
return 0; return 0;
} }
const int current_audio_delay_ms = audio_jitter_buffer_delay_ms + const int current_audio_delay_ms = audio_jitter_buffer_delay_ms +
@ -167,15 +160,9 @@ int32_t ViESyncModule::Process() {
return 0; return 0;
} }
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
"Set delay current(a=%d v=%d rel=%d) target(a=%d v=%d)",
current_audio_delay_ms, current_video_delay_ms,
relative_delay_ms,
target_audio_delay_ms, target_video_delay_ms);
if (voe_sync_interface_->SetMinimumPlayoutDelay( if (voe_sync_interface_->SetMinimumPlayoutDelay(
voe_channel_id_, target_audio_delay_ms) == -1) { voe_channel_id_, target_audio_delay_ms) == -1) {
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, vie_channel_->Id(), LOG(LS_ERROR) << "Error setting voice delay.";
"Error setting voice delay");
} }
vcm_->SetMinimumPlayoutDelay(target_video_delay_ms); vcm_->SetMinimumPlayoutDelay(target_video_delay_ms);
return 0; return 0;
@ -183,9 +170,8 @@ int32_t ViESyncModule::Process() {
int ViESyncModule::SetTargetBufferingDelay(int target_delay_ms) { int ViESyncModule::SetTargetBufferingDelay(int target_delay_ms) {
CriticalSectionScoped cs(data_cs_.get()); CriticalSectionScoped cs(data_cs_.get());
if (!voe_sync_interface_) { if (!voe_sync_interface_) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(), LOG(LS_ERROR) << "voe_sync_interface_ NULL, can't set playout delay.";
"voe_sync_interface_ NULL, can't set playout delay.");
return -1; return -1;
} }
sync_->SetTargetBufferingDelay(target_delay_ms); sync_->SetTargetBufferingDelay(target_delay_ms);