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:
parent
98c76a120d
commit
4e2806d85f
@ -20,7 +20,6 @@
|
||||
#include "webrtc/common_video/interface/video_image.h"
|
||||
#include "webrtc/common_video/jpeg/include/jpeg.h"
|
||||
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -32,38 +31,25 @@ int ViEFileImage::ConvertJPEGToVideoFrame(int engine_id,
|
||||
|
||||
FILE* image_file = fopen(file_nameUTF8, "rb");
|
||||
if (!image_file) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||
"%s could not open file %s", __FUNCTION__, file_nameUTF8);
|
||||
return -1;
|
||||
}
|
||||
if (fseek(image_file, 0, SEEK_END) != 0) {
|
||||
fclose(image_file);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||
"ConvertJPEGToVideoFrame fseek SEEK_END error for file %s",
|
||||
file_nameUTF8);
|
||||
return -1;
|
||||
}
|
||||
int buffer_size = ftell(image_file);
|
||||
if (buffer_size == -1) {
|
||||
fclose(image_file);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||
"ConvertJPEGToVideoFrame could tell file size for file %s",
|
||||
file_nameUTF8);
|
||||
return -1;
|
||||
}
|
||||
image_buffer._size = buffer_size;
|
||||
if (fseek(image_file, 0, SEEK_SET) != 0) {
|
||||
fclose(image_file);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||
"ConvertJPEGToVideoFrame fseek SEEK_SET error for file %s",
|
||||
file_nameUTF8);
|
||||
return -1;
|
||||
}
|
||||
image_buffer._buffer = new uint8_t[ image_buffer._size + 1];
|
||||
if (image_buffer._size != fread(image_buffer._buffer, sizeof(uint8_t),
|
||||
image_buffer._size, image_file)) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||
"%s could not read file %s", __FUNCTION__, file_nameUTF8);
|
||||
fclose(image_file);
|
||||
delete [] image_buffer._buffer;
|
||||
return -1;
|
||||
@ -76,14 +62,8 @@ int ViEFileImage::ConvertJPEGToVideoFrame(int engine_id,
|
||||
image_buffer._buffer = NULL;
|
||||
|
||||
if (ret == -1) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, engine_id,
|
||||
"%s could decode file %s from jpeg format", __FUNCTION__,
|
||||
file_nameUTF8);
|
||||
return -1;
|
||||
} 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;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#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/vie_capturer.h"
|
||||
#include "webrtc/video_engine/vie_channel.h"
|
||||
@ -39,45 +39,30 @@ ViEImageProcess* ViEImageProcess::GetInterface(VideoEngine* video_engine) {
|
||||
}
|
||||
|
||||
int ViEImageProcessImpl::Release() {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViEImageProcess::Release()");
|
||||
// Decrease ref count.
|
||||
(*this)--;
|
||||
|
||||
int32_t ref_count = GetCount();
|
||||
if (ref_count < 0) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViEImageProcess release too many times");
|
||||
LOG(LS_ERROR) << "ViEImageProcess release too many times";
|
||||
shared_data_->SetLastError(kViEAPIDoesNotExist);
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViEImageProcess reference count: %d", ref_count);
|
||||
return ref_count;
|
||||
}
|
||||
|
||||
ViEImageProcessImpl::ViEImageProcessImpl(ViESharedData* shared_data)
|
||||
: shared_data_(shared_data) {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViEImageProcessImpl::ViEImageProcessImpl() Ctor");
|
||||
}
|
||||
: shared_data_(shared_data) {}
|
||||
|
||||
ViEImageProcessImpl::~ViEImageProcessImpl() {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViEImageProcessImpl::~ViEImageProcessImpl() Dtor");
|
||||
}
|
||||
ViEImageProcessImpl::~ViEImageProcessImpl() {}
|
||||
|
||||
int ViEImageProcessImpl::RegisterCaptureEffectFilter(
|
||||
const int capture_id,
|
||||
ViEEffectFilter& capture_filter) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(capture_id: %d)", __FUNCTION__, capture_id);
|
||||
LOG_F(LS_INFO) << "capture_id: " << 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(kViEImageProcessInvalidCaptureId);
|
||||
return -1;
|
||||
}
|
||||
@ -89,15 +74,11 @@ int ViEImageProcessImpl::RegisterCaptureEffectFilter(
|
||||
}
|
||||
|
||||
int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int capture_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(capture_id: %d)", __FUNCTION__, capture_id);
|
||||
LOG_F(LS_INFO) << "capture_id: " << 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(kViEImageProcessInvalidCaptureId);
|
||||
return -1;
|
||||
}
|
||||
@ -111,14 +92,11 @@ int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int capture_id) {
|
||||
int ViEImageProcessImpl::RegisterSendEffectFilter(
|
||||
const int video_channel,
|
||||
ViEEffectFilter& send_filter) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(video_channel: %d)", __FUNCTION__, video_channel);
|
||||
LOG_F(LS_INFO) << "video_channel: " << video_channel;
|
||||
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -131,14 +109,11 @@ int ViEImageProcessImpl::RegisterSendEffectFilter(
|
||||
}
|
||||
|
||||
int ViEImageProcessImpl::DeregisterSendEffectFilter(const int video_channel) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(video_channel: %d)", __FUNCTION__, video_channel);
|
||||
LOG_F(LS_INFO) << "video_channel: " << video_channel;
|
||||
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -152,14 +127,11 @@ int ViEImageProcessImpl::DeregisterSendEffectFilter(const int video_channel) {
|
||||
int ViEImageProcessImpl::RegisterRenderEffectFilter(
|
||||
const int video_channel,
|
||||
ViEEffectFilter& render_filter) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(video_channel: %d)", __FUNCTION__, video_channel);
|
||||
LOG_F(LS_INFO) << "video_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(kViEImageProcessInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
@ -171,14 +143,11 @@ int ViEImageProcessImpl::RegisterRenderEffectFilter(
|
||||
}
|
||||
|
||||
int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int video_channel) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(video_channel: %d)", __FUNCTION__, video_channel);
|
||||
LOG_F(LS_INFO) << "video_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(kViEImageProcessInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
@ -192,16 +161,12 @@ int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int video_channel) {
|
||||
|
||||
int ViEImageProcessImpl::EnableDeflickering(const int capture_id,
|
||||
const bool enable) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(capture_id: %d, enable: %d)", __FUNCTION__, capture_id,
|
||||
enable);
|
||||
LOG_F(LS_INFO) << "capture_id: " << capture_id
|
||||
<< " enable: " << (enable ? "on" : "off");
|
||||
|
||||
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(kViEImageProcessInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
@ -219,16 +184,12 @@ int ViEImageProcessImpl::EnableDeflickering(const int capture_id,
|
||||
|
||||
int ViEImageProcessImpl::EnableDenoising(const int capture_id,
|
||||
const bool enable) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(capture_id: %d, enable: %d)", __FUNCTION__, capture_id,
|
||||
enable);
|
||||
LOG_F(LS_INFO) << "capture_id: " << capture_id
|
||||
<< " enable: " << (enable ? "on" : "off");
|
||||
|
||||
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(kViEImageProcessInvalidCaptureId);
|
||||
return -1;
|
||||
}
|
||||
@ -246,15 +207,12 @@ int ViEImageProcessImpl::EnableDenoising(const int capture_id,
|
||||
|
||||
int ViEImageProcessImpl::EnableColorEnhancement(const int video_channel,
|
||||
const bool enable) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(video_channel: %d, enable: %d)", __FUNCTION__, video_channel,
|
||||
enable);
|
||||
LOG_F(LS_INFO) << "video_channel: " << video_channel
|
||||
<< " enable: " << (enable ? "on" : "off");
|
||||
|
||||
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(kViEImageProcessInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "webrtc/video_engine/vie_impl.h"
|
||||
|
||||
#include "webrtc/common.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
#ifdef WEBRTC_ANDROID
|
||||
@ -31,82 +32,71 @@ VideoEngine* VideoEngine::Create(const Config& config) {
|
||||
}
|
||||
|
||||
bool VideoEngine::Delete(VideoEngine*& video_engine) {
|
||||
if (!video_engine) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"VideoEngine::Delete - No argument");
|
||||
if (!video_engine)
|
||||
return false;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId,
|
||||
"VideoEngine::Delete(vie = 0x%p)", video_engine);
|
||||
|
||||
LOG_F(LS_INFO);
|
||||
VideoEngineImpl* vie_impl = static_cast<VideoEngineImpl*>(video_engine);
|
||||
|
||||
// Check all reference counters.
|
||||
ViEBaseImpl* vie_base = vie_impl;
|
||||
if (vie_base->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViEBase ref count: %d", vie_base->GetCount());
|
||||
LOG(LS_ERROR) << "ViEBase ref count > 0: " << vie_base->GetCount();
|
||||
return false;
|
||||
}
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API
|
||||
ViECaptureImpl* vie_capture = vie_impl;
|
||||
if (vie_capture->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViECapture ref count: %d", vie_capture->GetCount());
|
||||
LOG(LS_ERROR) << "ViECapture ref count > 0: " << vie_capture->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
|
||||
ViECodecImpl* vie_codec = vie_impl;
|
||||
if (vie_codec->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViECodec ref count: %d", vie_codec->GetCount());
|
||||
LOG(LS_ERROR) << "ViECodec ref count > 0: " << vie_codec->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
|
||||
ViEExternalCodecImpl* vie_external_codec = vie_impl;
|
||||
if (vie_external_codec->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViEExternalCodec ref count: %d", vie_external_codec->GetCount());
|
||||
LOG(LS_ERROR) << "ViEExternalCodec ref count > 0: "
|
||||
<< vie_external_codec->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_FILE_API
|
||||
ViEFileImpl* vie_file = vie_impl;
|
||||
if (vie_file->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViEFile ref count: %d", vie_file->GetCount());
|
||||
LOG(LS_ERROR) << "ViEFile ref count > 0: " << vie_file->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
|
||||
ViEImageProcessImpl* vie_image_process = vie_impl;
|
||||
if (vie_image_process->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViEImageProcess ref count: %d",
|
||||
vie_image_process->GetCount());
|
||||
LOG(LS_ERROR) << "ViEImageProcess ref count > 0: "
|
||||
<< vie_image_process->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
ViENetworkImpl* vie_network = vie_impl;
|
||||
if (vie_network->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViENetwork ref count: %d", vie_network->GetCount());
|
||||
LOG(LS_ERROR) << "ViENetwork ref count > 0: " << vie_network->GetCount();
|
||||
return false;
|
||||
}
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
ViERenderImpl* vie_render = vie_impl;
|
||||
if (vie_render->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViERender ref count: %d", vie_render->GetCount());
|
||||
LOG(LS_ERROR) << "ViERender ref count > 0: " << vie_render->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
|
||||
ViERTP_RTCPImpl* vie_rtp_rtcp = vie_impl;
|
||||
if (vie_rtp_rtcp->GetCount() > 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"ViERTP_RTCP ref count: %d", vie_rtp_rtcp->GetCount());
|
||||
LOG(LS_ERROR) << "ViERTP_RTCP ref count > 0: " << vie_rtp_rtcp->GetCount();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -115,8 +105,6 @@ bool VideoEngine::Delete(VideoEngine*& video_engine) {
|
||||
vie_impl = NULL;
|
||||
video_engine = NULL;
|
||||
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, kModuleId,
|
||||
"%s: instance deleted.", __FUNCTION__);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -128,9 +116,8 @@ int VideoEngine::SetTraceFile(const char* file_nameUTF8,
|
||||
if (Trace::SetTraceFile(file_nameUTF8, add_file_counter) == -1) {
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId,
|
||||
"SetTraceFileName(file_nameUTF8 = %s, add_file_counter = %d",
|
||||
file_nameUTF8, add_file_counter);
|
||||
LOG_F(LS_INFO) << "filename: " << file_nameUTF8
|
||||
<< " add_file_counter: " << (add_file_counter ? "yes" : "no");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -139,35 +126,29 @@ int VideoEngine::SetTraceFilter(const unsigned int filter) {
|
||||
|
||||
if (filter == kTraceNone && old_filter != kTraceNone) {
|
||||
// Do the logging before turning it off.
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId,
|
||||
"SetTraceFilter(filter = 0x%x)", filter);
|
||||
LOG_F(LS_INFO) << "filter: " << filter;
|
||||
}
|
||||
|
||||
Trace::set_level_filter(filter);
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId,
|
||||
"SetTraceFilter(filter = 0x%x)", filter);
|
||||
LOG_F(LS_INFO) << "filter: " << filter;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int VideoEngine::SetTraceCallback(TraceCallback* callback) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId,
|
||||
"SetTraceCallback(TraceCallback = 0x%p)", callback);
|
||||
LOG_F(LS_INFO);
|
||||
return Trace::SetTraceCallback(callback);
|
||||
}
|
||||
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
int VideoEngine::SetAndroidObjects(JavaVM* javaVM) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, kModuleId,
|
||||
"SetAndroidObjects()");
|
||||
LOG_F(LS_INFO);
|
||||
|
||||
if (SetCaptureAndroidVM(javaVM) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"Could not set capture Android VM");
|
||||
LOG(LS_ERROR) << "Could not set capture Android VM";
|
||||
return -1;
|
||||
}
|
||||
if (SetRenderAndroidVM(javaVM) != 0) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, kModuleId,
|
||||
"Could not set render Android VM");
|
||||
LOG(LS_ERROR) << "Could not set render Android VM";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#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"
|
||||
#include "webrtc/video_engine/vie_capturer.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_(),
|
||||
capture_device_info_(NULL),
|
||||
module_process_thread_(NULL) {
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s", __FUNCTION__);
|
||||
|
||||
for (int idx = 0; idx < kViEMaxCaptureDevices; idx++) {
|
||||
free_capture_device_id_[idx] = true;
|
||||
}
|
||||
}
|
||||
|
||||
ViEInputManager::~ViEInputManager() {
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s", __FUNCTION__);
|
||||
for (FrameProviderMap::iterator it = vie_frame_provider_map_.begin();
|
||||
it != vie_frame_provider_map_.end();
|
||||
++it) {
|
||||
@ -60,8 +54,6 @@ void ViEInputManager::SetModuleProcessThread(
|
||||
}
|
||||
|
||||
int ViEInputManager::NumberOfCaptureDevices() {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
CriticalSectionScoped cs(device_info_cs_.get());
|
||||
if (capture_device_info_ == NULL)
|
||||
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
|
||||
@ -75,8 +67,6 @@ int ViEInputManager::GetDeviceName(uint32_t device_number,
|
||||
uint32_t device_name_length,
|
||||
char* device_unique_idUTF8,
|
||||
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());
|
||||
if (capture_device_info_ == NULL)
|
||||
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
|
||||
@ -90,8 +80,6 @@ int ViEInputManager::GetDeviceName(uint32_t device_number,
|
||||
|
||||
int ViEInputManager::NumberOfCaptureCapabilities(
|
||||
const char* device_unique_idUTF8) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
CriticalSectionScoped cs(device_info_cs_.get());
|
||||
if (capture_device_info_ == NULL)
|
||||
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
|
||||
@ -104,9 +92,6 @@ int ViEInputManager::GetCaptureCapability(
|
||||
const char* device_unique_idUTF8,
|
||||
const uint32_t device_capability_number,
|
||||
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());
|
||||
if (capture_device_info_ == NULL)
|
||||
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
|
||||
@ -132,9 +117,6 @@ int ViEInputManager::GetCaptureCapability(
|
||||
|
||||
int ViEInputManager::GetOrientation(const char* device_unique_idUTF8,
|
||||
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());
|
||||
if (capture_device_info_ == NULL)
|
||||
capture_device_info_ = VideoCaptureFactory::CreateDeviceInfo(
|
||||
@ -181,8 +163,6 @@ int ViEInputManager::CreateCaptureDevice(
|
||||
const char* device_unique_idUTF8,
|
||||
const uint32_t device_unique_idUTF8Length,
|
||||
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());
|
||||
|
||||
// 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);
|
||||
if (strncmp(cast_id, reinterpret_cast<const char*>(found_unique_name),
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found_device) {
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s:%d Capture device NOT found by unique ID: %s. Returning",
|
||||
__FUNCTION__, __LINE__, device_unique_idUTF8);
|
||||
LOG(LS_ERROR) << "Capture device not found: " << device_unique_idUTF8;
|
||||
return kViECaptureDeviceDoesNotExist;
|
||||
}
|
||||
|
||||
int newcapture_id = 0;
|
||||
if (GetFreeCaptureId(&newcapture_id) == false) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Maximum supported number of capture devices already in "
|
||||
"use", __FUNCTION__);
|
||||
if (!GetFreeCaptureId(&newcapture_id)) {
|
||||
LOG(LS_ERROR) << "All capture devices already allocated.";
|
||||
return kViECaptureDeviceMaxNoDevicesAllocated;
|
||||
}
|
||||
ViECapturer* vie_capture = ViECapturer::CreateViECapture(
|
||||
newcapture_id, engine_id_, config_, device_unique_idUTF8,
|
||||
device_unique_idUTF8Length, *module_process_thread_);
|
||||
if (!vie_capture) {
|
||||
ReturnCaptureId(newcapture_id);
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Could not create capture module for %s", __FUNCTION__,
|
||||
device_unique_idUTF8);
|
||||
ReturnCaptureId(newcapture_id);
|
||||
return kViECaptureDeviceUnknownError;
|
||||
}
|
||||
|
||||
vie_frame_provider_map_[newcapture_id] = vie_capture;
|
||||
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;
|
||||
}
|
||||
|
||||
int ViEInputManager::CreateCaptureDevice(VideoCaptureModule* capture_module,
|
||||
int& capture_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
int newcapture_id = 0;
|
||||
if (!GetFreeCaptureId(&newcapture_id)) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Maximum supported number of capture devices already in "
|
||||
"use", __FUNCTION__);
|
||||
LOG(LS_ERROR) << "All capture devices already allocated.";
|
||||
return kViECaptureDeviceMaxNoDevicesAllocated;
|
||||
}
|
||||
|
||||
@ -286,21 +248,15 @@ int ViEInputManager::CreateCaptureDevice(VideoCaptureModule* capture_module,
|
||||
newcapture_id, engine_id_, config_,
|
||||
capture_module, *module_process_thread_);
|
||||
if (!vie_capture) {
|
||||
ReturnCaptureId(newcapture_id);
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Could attach capture module.", __FUNCTION__);
|
||||
ReturnCaptureId(newcapture_id);
|
||||
return kViECaptureDeviceUnknownError;
|
||||
}
|
||||
vie_frame_provider_map_[newcapture_id] = vie_capture;
|
||||
capture_id = newcapture_id;
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s, capture_id: %d", __FUNCTION__, capture_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
{
|
||||
// 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);
|
||||
if (!vie_capture) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s(capture_id: %d) - No such capture device id",
|
||||
__FUNCTION__, capture_id);
|
||||
LOG(LS_ERROR) << "No such capture device id: " << capture_id;
|
||||
return -1;
|
||||
}
|
||||
uint32_t num_callbacks =
|
||||
vie_capture->NumberOfRegisteredFrameCallbacks();
|
||||
if (num_callbacks > 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_), "%s(capture_id: %d) - %u registered "
|
||||
"callbacks when destroying capture device",
|
||||
__FUNCTION__, capture_id, num_callbacks);
|
||||
LOG(LS_WARNING) << num_callbacks << " still registered to capture id "
|
||||
<< capture_id << " when destroying capture device.";
|
||||
}
|
||||
vie_frame_provider_map_.erase(capture_id);
|
||||
ReturnCaptureId(capture_id);
|
||||
@ -336,15 +288,11 @@ int ViEInputManager::DestroyCaptureDevice(const int capture_id) {
|
||||
int ViEInputManager::CreateExternalCaptureDevice(
|
||||
ViEExternalCapture*& external_capture,
|
||||
int& capture_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
CriticalSectionScoped cs(map_cs_.get());
|
||||
|
||||
int newcapture_id = 0;
|
||||
if (GetFreeCaptureId(&newcapture_id) == false) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Maximum supported number of capture devices already in "
|
||||
"use", __FUNCTION__);
|
||||
LOG(LS_ERROR) << "All capture devices already allocated.";
|
||||
return kViECaptureDeviceMaxNoDevicesAllocated;
|
||||
}
|
||||
|
||||
@ -352,30 +300,21 @@ int ViEInputManager::CreateExternalCaptureDevice(
|
||||
newcapture_id, engine_id_, config_, NULL, 0, *module_process_thread_);
|
||||
if (!vie_capture) {
|
||||
ReturnCaptureId(newcapture_id);
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: Could not create capture module for external capture.",
|
||||
__FUNCTION__);
|
||||
return kViECaptureDeviceUnknownError;
|
||||
}
|
||||
|
||||
vie_frame_provider_map_[newcapture_id] = vie_capture;
|
||||
capture_id = newcapture_id;
|
||||
external_capture = vie_capture;
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s, capture_id: %d)", __FUNCTION__, capture_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ViEInputManager::GetFreeCaptureId(int* freecapture_id) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_), "%s",
|
||||
__FUNCTION__);
|
||||
for (int id = 0; id < kViEMaxCaptureDevices; id++) {
|
||||
if (free_capture_device_id_[id]) {
|
||||
// We found a free capture device id.
|
||||
free_capture_device_id_[id] = false;
|
||||
*freecapture_id = id + kViECaptureIdBase;
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"%s: new id: %d", __FUNCTION__, *freecapture_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -383,8 +322,6 @@ bool ViEInputManager::GetFreeCaptureId(int* freecapture_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());
|
||||
if (capture_id >= kViECaptureIdBase &&
|
||||
capture_id < kViEMaxCaptureDevices + kViECaptureIdBase) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#endif
|
||||
|
||||
#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"
|
||||
@ -39,35 +39,25 @@ ViENetwork* ViENetwork::GetInterface(VideoEngine* video_engine) {
|
||||
}
|
||||
|
||||
int ViENetworkImpl::Release() {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViENetwork::Release()");
|
||||
// Decrease ref count.
|
||||
(*this)--;
|
||||
|
||||
int32_t ref_count = GetCount();
|
||||
if (ref_count < 0) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViENetwork release too many times");
|
||||
LOG(LS_ERROR) << "ViENetwork release too many times";
|
||||
shared_data_->SetLastError(kViEAPIDoesNotExist);
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViENetwork reference count: %d", ref_count);
|
||||
return ref_count;
|
||||
}
|
||||
|
||||
void ViENetworkImpl::SetNetworkTransmissionState(const int video_channel,
|
||||
const bool is_transmitting) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(event: Network %s)", __FUNCTION__,
|
||||
is_transmitting ? "transmitting" : "not transmitting");
|
||||
LOG_F(LS_INFO) << "channel: " << video_channel
|
||||
<< " transmitting: " << (is_transmitting ? "yes" : "no");
|
||||
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),
|
||||
"An encoder doesn't exist for this channel");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return;
|
||||
}
|
||||
@ -75,34 +65,21 @@ void ViENetworkImpl::SetNetworkTransmissionState(const int video_channel,
|
||||
}
|
||||
|
||||
ViENetworkImpl::ViENetworkImpl(ViESharedData* shared_data)
|
||||
: shared_data_(shared_data) {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViENetworkImpl::ViENetworkImpl() Ctor");
|
||||
}
|
||||
: shared_data_(shared_data) {}
|
||||
|
||||
ViENetworkImpl::~ViENetworkImpl() {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViENetworkImpl::~ViENetworkImpl() Dtor");
|
||||
}
|
||||
ViENetworkImpl::~ViENetworkImpl() {}
|
||||
|
||||
int ViENetworkImpl::RegisterSendTransport(const int video_channel,
|
||||
Transport& transport) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
LOG_F(LS_INFO) << "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 Channel doesn't exist", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->Sending()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s Channel already sending.", __FUNCTION__);
|
||||
LOG_F(LS_ERROR) << "Already sending on channel: " << video_channel;
|
||||
shared_data_->SetLastError(kViENetworkAlreadySending);
|
||||
return -1;
|
||||
}
|
||||
@ -114,22 +91,15 @@ int ViENetworkImpl::RegisterSendTransport(const int video_channel,
|
||||
}
|
||||
|
||||
int ViENetworkImpl::DeregisterSendTransport(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) << "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 Channel doesn't exist", __FUNCTION__);
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
if (vie_channel->Sending()) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s Channel already sending", __FUNCTION__);
|
||||
LOG_F(LS_ERROR) << "Actively sending on channel: " << video_channel;
|
||||
shared_data_->SetLastError(kViENetworkAlreadySending);
|
||||
return -1;
|
||||
}
|
||||
@ -143,17 +113,9 @@ int ViENetworkImpl::DeregisterSendTransport(const int video_channel) {
|
||||
int ViENetworkImpl::ReceivedRTPPacket(const int video_channel, const void* data,
|
||||
const int length,
|
||||
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()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_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);
|
||||
return -1;
|
||||
}
|
||||
@ -162,16 +124,9 @@ int ViENetworkImpl::ReceivedRTPPacket(const int video_channel, const void* data,
|
||||
|
||||
int ViENetworkImpl::ReceivedRTCPPacket(const int video_channel,
|
||||
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()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
@ -179,15 +134,10 @@ int ViENetworkImpl::ReceivedRTCPPacket(const int video_channel,
|
||||
}
|
||||
|
||||
int ViENetworkImpl::SetMTU(int video_channel, unsigned int mtu) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d, mtu: %u)", __FUNCTION__, video_channel, mtu);
|
||||
LOG_F(LS_INFO) << "channel: " << video_channel << " mtu: " << mtu;
|
||||
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),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
@ -200,16 +150,9 @@ int ViENetworkImpl::SetMTU(int video_channel, unsigned int mtu) {
|
||||
|
||||
int ViENetworkImpl::ReceivedBWEPacket(const int video_channel,
|
||||
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()));
|
||||
ViEChannel* vie_channel = cs.Channel(video_channel);
|
||||
if (!vie_channel) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"Channel doesn't exist");
|
||||
shared_data_->SetLastError(kViENetworkInvalidChannelId);
|
||||
return -1;
|
||||
}
|
||||
@ -220,9 +163,7 @@ int ViENetworkImpl::ReceivedBWEPacket(const int video_channel,
|
||||
|
||||
bool ViENetworkImpl::SetBandwidthEstimationConfig(
|
||||
int video_channel, const webrtc::Config& config) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), video_channel),
|
||||
"%s(channel: %d)", __FUNCTION__, video_channel);
|
||||
LOG_F(LS_INFO) << "channel: " << video_channel;
|
||||
return shared_data_->channel_manager()->SetBandwidthEstimationConfig(
|
||||
video_channel, config);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/tick_util.h"
|
||||
#include "webrtc/system_wrappers/interface/timestamp_extrapolator.h"
|
||||
#include "webrtc/system_wrappers/interface/trace.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -34,7 +33,6 @@ ViEReceiver::ViEReceiver(const int32_t channel_id,
|
||||
RemoteBitrateEstimator* remote_bitrate_estimator,
|
||||
RtpFeedback* rtp_feedback)
|
||||
: receive_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
channel_id_(channel_id),
|
||||
rtp_header_parser_(RtpHeaderParser::Create()),
|
||||
rtp_payload_registry_(new RTPPayloadRegistry(
|
||||
RTPPayloadStrategy::CreateStrategy(false))),
|
||||
@ -211,8 +209,6 @@ bool ViEReceiver::OnRecoveredPacket(const uint8_t* rtp_packet,
|
||||
int rtp_packet_length) {
|
||||
RTPHeader 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;
|
||||
}
|
||||
header.payload_type_frequency = kVideoPayloadTypeFrequency;
|
||||
@ -247,8 +243,6 @@ int ViEReceiver::InsertRTPPacket(const uint8_t* rtp_packet,
|
||||
RTPHeader header;
|
||||
if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length,
|
||||
&header)) {
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
|
||||
"Incoming packet: Invalid RTP header");
|
||||
return -1;
|
||||
}
|
||||
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);
|
||||
if (fec_receiver_->AddReceivedRedPacket(
|
||||
header, packet, packet_length, ulpfec_pt) != 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
|
||||
"Incoming RED packet error");
|
||||
return false;
|
||||
}
|
||||
return fec_receiver_->ProcessReceivedFec() == 0;
|
||||
@ -317,16 +309,14 @@ bool ViEReceiver::ParseAndHandleEncapsulatingHeader(const uint8_t* packet,
|
||||
return false;
|
||||
CriticalSectionScoped cs(receive_cs_.get());
|
||||
if (restored_packet_in_use_) {
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
|
||||
"Multiple RTX headers detected, dropping packet");
|
||||
LOG(LS_WARNING) << "Multiple RTX headers detected, dropping packet.";
|
||||
return false;
|
||||
}
|
||||
uint8_t* restored_packet_ptr = restored_packet_;
|
||||
if (!rtp_payload_registry_->RestoreOriginalPacket(
|
||||
&restored_packet_ptr, packet, &packet_length, rtp_receiver_->SSRC(),
|
||||
header)) {
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, channel_id_,
|
||||
"Incoming RTX packet: invalid RTP header");
|
||||
LOG(LS_WARNING) << "Incoming RTX packet: Invalid RTP header";
|
||||
return false;
|
||||
}
|
||||
restored_packet_in_use_ = true;
|
||||
@ -430,16 +420,12 @@ int ViEReceiver::StartRTPDump(const char file_nameUTF8[1024]) {
|
||||
} else {
|
||||
rtp_dump_ = RtpDump::CreateRtpDump();
|
||||
if (rtp_dump_ == NULL) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StartRTPDump: Failed to create RTP dump");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (rtp_dump_->Start(file_nameUTF8) != 0) {
|
||||
RtpDump::DestroyRtpDump(rtp_dump_);
|
||||
rtp_dump_ = NULL;
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StartRTPDump: Failed to start RTP dump");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -450,15 +436,10 @@ int ViEReceiver::StopRTPDump() {
|
||||
if (rtp_dump_) {
|
||||
if (rtp_dump_->IsActive()) {
|
||||
rtp_dump_->Stop();
|
||||
} else {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StopRTPDump: Dump not active");
|
||||
}
|
||||
RtpDump::DestroyRtpDump(rtp_dump_);
|
||||
rtp_dump_ = NULL;
|
||||
} else {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StopRTPDump: RTP dump not started");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -109,7 +109,6 @@ class ViEReceiver : public RtpData {
|
||||
void CalculateCaptureNtpTime(WebRtcRTPHeader* rtp_header);
|
||||
|
||||
scoped_ptr<CriticalSectionWrapper> receive_cs_;
|
||||
const int32_t channel_id_;
|
||||
scoped_ptr<RtpHeaderParser> rtp_header_parser_;
|
||||
scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
|
||||
scoped_ptr<RtpReceiver> rtp_receiver_;
|
||||
|
@ -37,15 +37,12 @@ VieRemb::~VieRemb() {}
|
||||
|
||||
void VieRemb::AddReceiveChannel(RtpRtcp* rtp_rtcp) {
|
||||
assert(rtp_rtcp);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
|
||||
"VieRemb::AddReceiveChannel(%p)", rtp_rtcp);
|
||||
|
||||
CriticalSectionScoped cs(list_crit_.get());
|
||||
if (std::find(receive_modules_.begin(), receive_modules_.end(), rtp_rtcp) !=
|
||||
receive_modules_.end())
|
||||
return;
|
||||
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, -1, "AddRembChannel");
|
||||
// The module probably doesn't have a remote SSRC yet, so don't add it to the
|
||||
// map.
|
||||
receive_modules_.push_back(rtp_rtcp);
|
||||
@ -53,8 +50,6 @@ void VieRemb::AddReceiveChannel(RtpRtcp* rtp_rtcp) {
|
||||
|
||||
void VieRemb::RemoveReceiveChannel(RtpRtcp* rtp_rtcp) {
|
||||
assert(rtp_rtcp);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
|
||||
"VieRemb::RemoveReceiveChannel(%p)", rtp_rtcp);
|
||||
|
||||
CriticalSectionScoped cs(list_crit_.get());
|
||||
for (RtpModules::iterator it = receive_modules_.begin();
|
||||
@ -68,8 +63,6 @@ void VieRemb::RemoveReceiveChannel(RtpRtcp* rtp_rtcp) {
|
||||
|
||||
void VieRemb::AddRembSender(RtpRtcp* rtp_rtcp) {
|
||||
assert(rtp_rtcp);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
|
||||
"VieRemb::AddRembSender(%p)", rtp_rtcp);
|
||||
|
||||
CriticalSectionScoped cs(list_crit_.get());
|
||||
|
||||
@ -82,8 +75,6 @@ void VieRemb::AddRembSender(RtpRtcp* rtp_rtcp) {
|
||||
|
||||
void VieRemb::RemoveRembSender(RtpRtcp* rtp_rtcp) {
|
||||
assert(rtp_rtcp);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVideo, -1,
|
||||
"VieRemb::RemoveRembSender(%p)", rtp_rtcp);
|
||||
|
||||
CriticalSectionScoped cs(list_crit_.get());
|
||||
for (RtpModules::iterator it = rtcp_sender_.begin();
|
||||
@ -105,8 +96,6 @@ bool VieRemb::InUse() const {
|
||||
|
||||
void VieRemb::OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs,
|
||||
unsigned int bitrate) {
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVideo, -1,
|
||||
"VieRemb::UpdateBitrateEstimate(bitrate: %u)", bitrate);
|
||||
list_crit_->Enter();
|
||||
// If we already have an estimate, check if the new total estimate is below
|
||||
// kSendThresholdPercent of the previous estimate.
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#include "webrtc/modules/video_render/include/video_render.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/vie_capturer.h"
|
||||
#include "webrtc/video_engine/vie_channel.h"
|
||||
@ -44,36 +44,24 @@ ViERender* ViERender::GetInterface(VideoEngine* video_engine) {
|
||||
}
|
||||
|
||||
int ViERenderImpl::Release() {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViERender::Release()");
|
||||
// Decrease ref count
|
||||
(*this)--;
|
||||
int32_t ref_count = GetCount();
|
||||
if (ref_count < 0) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViERender release too many times");
|
||||
LOG(LS_ERROR) << "ViERender release too many times";
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViERender reference count: %d", ref_count);
|
||||
return ref_count;
|
||||
}
|
||||
|
||||
ViERenderImpl::ViERenderImpl(ViESharedData* shared_data)
|
||||
: shared_data_(shared_data) {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViERenderImpl::ViERenderImpl() Ctor");
|
||||
}
|
||||
: shared_data_(shared_data) {}
|
||||
|
||||
ViERenderImpl::~ViERenderImpl() {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, shared_data_->instance_id(),
|
||||
"ViERenderImpl::~ViERenderImpl() Dtor");
|
||||
}
|
||||
ViERenderImpl::~ViERenderImpl() {}
|
||||
|
||||
int ViERenderImpl::RegisterVideoRenderModule(
|
||||
VideoRender& render_module) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s (&render_module: %p)", __FUNCTION__, &render_module);
|
||||
LOG_F(LS_INFO);
|
||||
if (shared_data_->render_manager()->RegisterVideoRenderModule(
|
||||
&render_module) != 0) {
|
||||
shared_data_->SetLastError(kViERenderUnknownError);
|
||||
@ -84,8 +72,7 @@ int ViERenderImpl::RegisterVideoRenderModule(
|
||||
|
||||
int ViERenderImpl::DeRegisterVideoRenderModule(
|
||||
VideoRender& render_module) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s (&render_module: %p)", __FUNCTION__, &render_module);
|
||||
LOG_F(LS_INFO);
|
||||
if (shared_data_->render_manager()->DeRegisterVideoRenderModule(
|
||||
&render_module) != 0) {
|
||||
// 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 float top, const float right,
|
||||
const float bottom) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s (render_id: %d, window: 0x%p, z_order: %u, left: %f, "
|
||||
"top: %f, right: %f, bottom: %f)",
|
||||
__FUNCTION__, render_id, window, z_order, left, top, right,
|
||||
bottom);
|
||||
LOG_F(LS_INFO) << "render_id: " << render_id << " z_order: " << z_order
|
||||
<< " left: " << left << " top: " << top << " right: " << right
|
||||
<< " bottom: " << bottom;
|
||||
{
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
if (rs.Renderer(render_id)) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||
render_id);
|
||||
LOG(LS_ERROR) << "Renderer for render_id: " << render_id
|
||||
<< " already exists.";
|
||||
shared_data_->SetLastError(kViERenderAlreadyExists);
|
||||
return -1;
|
||||
}
|
||||
@ -119,9 +103,6 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
|
||||
ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
|
||||
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -137,9 +118,6 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
|
||||
ViEInputManagerScoped is(*(shared_data_->input_manager()));
|
||||
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -154,17 +132,12 @@ int ViERenderImpl::AddRenderer(const int render_id, void* window,
|
||||
}
|
||||
|
||||
int ViERenderImpl::RemoveRenderer(const int render_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s(render_id: %d)", __FUNCTION__, render_id);
|
||||
LOG_F(LS_INFO) << "render_id: " << render_id;
|
||||
ViERenderer* renderer = NULL;
|
||||
{
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
renderer = rs.Renderer(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -176,10 +149,6 @@ int ViERenderImpl::RemoveRenderer(const int render_id) {
|
||||
ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
|
||||
ViEChannel* channel = cm.Channel(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -189,10 +158,6 @@ int ViERenderImpl::RemoveRenderer(const int render_id) {
|
||||
ViEInputManagerScoped is(*(shared_data_->input_manager()));
|
||||
ViEFrameProviderBase* provider = is.FrameProvider(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -206,16 +171,10 @@ int ViERenderImpl::RemoveRenderer(const int render_id) {
|
||||
}
|
||||
|
||||
int ViERenderImpl::StartRender(const int render_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
LOG_F(LS_INFO) << "render_id: " << render_id;
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -227,16 +186,10 @@ int ViERenderImpl::StartRender(const int render_id) {
|
||||
}
|
||||
|
||||
int ViERenderImpl::StopRender(const int render_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
LOG_F(LS_INFO) << "render_id: " << render_id;
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -248,16 +201,11 @@ int ViERenderImpl::StopRender(const int render_id) {
|
||||
}
|
||||
|
||||
int ViERenderImpl::SetExpectedRenderDelay(int render_id, int render_delay) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
LOG_F(LS_INFO) << "render_id: " << render_id
|
||||
<< " render_delay: " << render_delay;
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
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);
|
||||
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,
|
||||
const float left, const float top,
|
||||
const float right, const float bottom) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
LOG_F(LS_INFO) << "render_id: " << render_id << " z_order: " << z_order
|
||||
<< " left: " << left << " top: " << top << " right: " << right
|
||||
<< " bottom: " << bottom;
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -298,10 +242,6 @@ int ViERenderImpl::MirrorRenderStream(const int render_id, const bool enable,
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -326,10 +266,7 @@ int ViERenderImpl::AddRenderer(const int render_id,
|
||||
video_input_format != kVideoRGB565 &&
|
||||
video_input_format != kVideoARGB4444 &&
|
||||
video_input_format != kVideoARGB1555) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo,
|
||||
ViEId(shared_data_->instance_id(), render_id),
|
||||
"%s: Unsupported video frame format requested",
|
||||
__FUNCTION__, render_id);
|
||||
LOG(LS_ERROR) << "Unsupported video frame format requested.";
|
||||
shared_data_->SetLastError(kViERenderInvalidFrameFormat);
|
||||
return -1;
|
||||
}
|
||||
@ -337,9 +274,7 @@ int ViERenderImpl::AddRenderer(const int render_id,
|
||||
// Verify the renderer doesn't exist.
|
||||
ViERenderManagerScoped rs(*(shared_data_->render_manager()));
|
||||
if (rs.Renderer(render_id)) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(shared_data_->instance_id()),
|
||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||
render_id);
|
||||
LOG_F(LS_ERROR) << "Renderer already exists for render_id: " << render_id;
|
||||
shared_data_->SetLastError(kViERenderAlreadyExists);
|
||||
return -1;
|
||||
}
|
||||
@ -349,9 +284,6 @@ int ViERenderImpl::AddRenderer(const int render_id,
|
||||
ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
|
||||
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -373,9 +305,6 @@ int ViERenderImpl::AddRenderer(const int render_id,
|
||||
ViEInputManagerScoped is(*(shared_data_->input_manager()));
|
||||
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
@ -402,12 +331,6 @@ int ViERenderImpl::AddRenderCallback(int render_id,
|
||||
ViEChannelManagerScoped cm(*(shared_data_->channel_manager()));
|
||||
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "webrtc/modules/video_render/include/video_render_defines.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_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_renderer.h"
|
||||
|
||||
@ -35,14 +35,9 @@ ViERenderManager::ViERenderManager(int32_t engine_id)
|
||||
: list_cs_(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
engine_id_(engine_id),
|
||||
use_external_render_module_(false) {
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, ViEId(engine_id),
|
||||
"ViERenderManager::ViERenderManager(engine_id: %d) - "
|
||||
"Constructor", engine_id);
|
||||
}
|
||||
|
||||
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();
|
||||
it != stream_to_vie_renderer_.end();
|
||||
++it) {
|
||||
@ -57,10 +52,7 @@ int32_t ViERenderManager::RegisterVideoRenderModule(
|
||||
// the registrant render module is associated with.
|
||||
VideoRender* current_module = FindRenderModule(render_module->Window());
|
||||
if (current_module) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"A module is already registered for this window (window=%p, "
|
||||
"current module=%p, registrant module=%p.",
|
||||
render_module->Window(), current_module, render_module);
|
||||
LOG_F(LS_ERROR) << "A render module is already registered for this window.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -75,9 +67,8 @@ int32_t ViERenderManager::DeRegisterVideoRenderModule(
|
||||
// Check if there are streams in the module.
|
||||
uint32_t n_streams = render_module->GetNumIncomingRenderStreams();
|
||||
if (n_streams != 0) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"There are still %d streams in this module, cannot "
|
||||
"de-register", n_streams);
|
||||
LOG(LS_ERROR) << "There are still " << n_streams
|
||||
<< "in this module, cannot de-register.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -89,8 +80,8 @@ int32_t ViERenderManager::DeRegisterVideoRenderModule(
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"Module not registered");
|
||||
|
||||
LOG(LS_ERROR) << "Module not registered.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -105,9 +96,7 @@ ViERenderer* ViERenderManager::AddRenderStream(const int32_t render_id,
|
||||
|
||||
if (stream_to_vie_renderer_.find(render_id) !=
|
||||
stream_to_vie_renderer_.end()) {
|
||||
// This stream is already added to a renderer, not allowed!
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"Render stream already exists");
|
||||
LOG(LS_ERROR) << "Render stream already exists";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -117,11 +106,9 @@ ViERenderer* ViERenderManager::AddRenderStream(const int32_t render_id,
|
||||
// No render module for this window, create a new one.
|
||||
render_module = VideoRender::CreateVideoRender(ViEModuleId(engine_id_, -1),
|
||||
window, false);
|
||||
if (!render_module) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"Could not create new render module");
|
||||
if (!render_module)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
render_list_.push_back(render_module);
|
||||
}
|
||||
|
||||
@ -131,12 +118,9 @@ ViERenderer* ViERenderManager::AddRenderStream(const int32_t render_id,
|
||||
*this, z_order,
|
||||
left, top, right,
|
||||
bottom);
|
||||
if (!vie_renderer) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, render_id),
|
||||
"Could not create new render stream");
|
||||
if (!vie_renderer)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
stream_to_vie_renderer_[render_id] = vie_renderer;
|
||||
return vie_renderer;
|
||||
}
|
||||
@ -149,9 +133,7 @@ int32_t ViERenderManager::RemoveRenderStream(
|
||||
CriticalSectionScoped cs(list_cs_.get());
|
||||
RendererMap::iterator it = stream_to_vie_renderer_.find(render_id);
|
||||
if (it == stream_to_vie_renderer_.end()) {
|
||||
// No such stream
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(engine_id_),
|
||||
"No renderer for this stream found, channel_id");
|
||||
LOG(LS_ERROR) << "No renderer found for render_id: " << render_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -59,16 +59,12 @@ int ViESender::StartRTPDump(const char file_nameUTF8[1024]) {
|
||||
} else {
|
||||
rtp_dump_ = RtpDump::CreateRtpDump();
|
||||
if (rtp_dump_ == NULL) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StartSRTPDump: Failed to create RTP dump");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (rtp_dump_->Start(file_nameUTF8) != 0) {
|
||||
RtpDump::DestroyRtpDump(rtp_dump_);
|
||||
rtp_dump_ = NULL;
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StartRTPDump: Failed to start RTP dump");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -79,15 +75,10 @@ int ViESender::StopRTPDump() {
|
||||
if (rtp_dump_) {
|
||||
if (rtp_dump_->IsActive()) {
|
||||
rtp_dump_->Stop();
|
||||
} else {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StopRTPDump: Dump not active");
|
||||
}
|
||||
RtpDump::DestroyRtpDump(rtp_dump_);
|
||||
rtp_dump_ = NULL;
|
||||
} else {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, channel_id_,
|
||||
"StopRTPDump: RTP dump not started");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -106,12 +97,7 @@ int ViESender::SendPacket(int vie_id, const void* data, int len) {
|
||||
static_cast<uint16_t>(len));
|
||||
}
|
||||
|
||||
const int bytes_sent = 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;
|
||||
return transport_->SendPacket(channel_id_, data, 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));
|
||||
}
|
||||
|
||||
const int bytes_sent = 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;
|
||||
return transport_->SendRTCPPacket(channel_id_, data, len);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.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/trace.h"
|
||||
#include "webrtc/system_wrappers/interface/logging.h"
|
||||
#include "webrtc/system_wrappers/interface/trace_event.h"
|
||||
#include "webrtc/video_engine/stream_synchronization.h"
|
||||
#include "webrtc/video_engine/vie_channel.h"
|
||||
@ -103,8 +103,6 @@ int32_t ViESyncModule::Process() {
|
||||
last_sync_time_ = TickTime::Now();
|
||||
|
||||
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) {
|
||||
return 0;
|
||||
@ -117,11 +115,6 @@ int32_t ViESyncModule::Process() {
|
||||
if (voe_sync_interface_->GetDelayEstimate(voe_channel_id_,
|
||||
&audio_jitter_buffer_delay_ms,
|
||||
&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;
|
||||
}
|
||||
const int current_audio_delay_ms = audio_jitter_buffer_delay_ms +
|
||||
@ -167,15 +160,9 @@ int32_t ViESyncModule::Process() {
|
||||
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(
|
||||
voe_channel_id_, target_audio_delay_ms) == -1) {
|
||||
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideo, vie_channel_->Id(),
|
||||
"Error setting voice delay");
|
||||
LOG(LS_ERROR) << "Error setting voice delay.";
|
||||
}
|
||||
vcm_->SetMinimumPlayoutDelay(target_video_delay_ms);
|
||||
return 0;
|
||||
@ -183,9 +170,8 @@ int32_t ViESyncModule::Process() {
|
||||
|
||||
int ViESyncModule::SetTargetBufferingDelay(int target_delay_ms) {
|
||||
CriticalSectionScoped cs(data_cs_.get());
|
||||
if (!voe_sync_interface_) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, vie_channel_->Id(),
|
||||
"voe_sync_interface_ NULL, can't set playout delay.");
|
||||
if (!voe_sync_interface_) {
|
||||
LOG(LS_ERROR) << "voe_sync_interface_ NULL, can't set playout delay.";
|
||||
return -1;
|
||||
}
|
||||
sync_->SetTargetBufferingDelay(target_delay_ms);
|
||||
|
Loading…
Reference in New Issue
Block a user