Refactored ViEImageProcess, ViEImpl and ViENetworkImpl.

Review URL: http://webrtc-codereview.appspot.com/331005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1247 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2011-12-20 11:57:47 +00:00
parent 813b4ef2ea
commit 1bdf1dffb4
6 changed files with 1200 additions and 1822 deletions

View File

@ -8,314 +8,214 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
/* #include "video_engine/vie_image_process_impl.h"
* vie_image_process_impl.cpp
*/
#include "vie_image_process_impl.h"
// Defines #include "system_wrappers/interface/trace.h"
#include "vie_defines.h" #include "video_engine/main/interface/vie_errors.h"
#include "video_engine/vie_capturer.h"
#include "video_engine/vie_channel.h"
#include "video_engine/vie_channel_manager.h"
#include "video_engine/vie_defines.h"
#include "video_engine/vie_encoder.h"
#include "video_engine/vie_impl.h"
#include "video_engine/vie_input_manager.h"
#include "trace.h" namespace webrtc {
#include "vie_errors.h"
#include "vie_impl.h"
#include "vie_channel.h"
#include "vie_channel_manager.h"
#include "vie_encoder.h"
#include "vie_input_manager.h"
#include "vie_capturer.h"
namespace webrtc ViEImageProcess* ViEImageProcess::GetInterface(VideoEngine* video_engine) {
{
// ----------------------------------------------------------------------------
// GetInterface
// ----------------------------------------------------------------------------
ViEImageProcess* ViEImageProcess::GetInterface(VideoEngine* videoEngine)
{
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API #ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
if (videoEngine == NULL) if (!video_engine) {
{
return NULL; return NULL;
} }
VideoEngineImpl* vieImpl = reinterpret_cast<VideoEngineImpl*> (videoEngine); VideoEngineImpl* vie_impl = reinterpret_cast<VideoEngineImpl*>(video_engine);
ViEImageProcessImpl* vieImageProcessImpl = vieImpl; ViEImageProcessImpl* vie_image_process_impl = vie_impl;
(*vieImageProcessImpl)++; // Increase ref count // Increase ref count.
(*vie_image_process_impl)++;
return vieImageProcessImpl; return vie_image_process_impl;
#else #else
return NULL; return NULL;
#endif #endif
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::Release() {
// Release WEBRTC_TRACE(kTraceApiCall, kTraceVideo, instance_id_,
//
// Releases the interface, i.e. reduces the reference counter. The number of
// remaining references is returned, -1 if released too many times.
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::Release()
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, instance_id_,
"ViEImageProcess::Release()"); "ViEImageProcess::Release()");
(*this)--; // Decrease ref count // Decrease ref count.
(*this)--;
WebRtc_Word32 refCount = GetCount(); WebRtc_Word32 ref_count = GetCount();
if (refCount < 0) if (ref_count < 0) {
{ WEBRTC_TRACE(kTraceWarning, kTraceVideo, instance_id_,
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, instance_id_,
"ViEImageProcess release too many times"); "ViEImageProcess release too many times");
SetLastError(kViEAPIDoesNotExist); SetLastError(kViEAPIDoesNotExist);
return -1; return -1;
} }
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, instance_id_, WEBRTC_TRACE(kTraceInfo, kTraceVideo, instance_id_,
"ViEImageProcess reference count: %d", refCount); "ViEImageProcess reference count: %d", ref_count);
return refCount; return ref_count;
} }
// ---------------------------------------------------------------------------- ViEImageProcessImpl::ViEImageProcessImpl() {
// Constructor WEBRTC_TRACE(kTraceMemory, kTraceVideo, instance_id_,
// ----------------------------------------------------------------------------
ViEImageProcessImpl::ViEImageProcessImpl()
{
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, instance_id_,
"ViEImageProcessImpl::ViEImageProcessImpl() Ctor"); "ViEImageProcessImpl::ViEImageProcessImpl() Ctor");
} }
// ---------------------------------------------------------------------------- ViEImageProcessImpl::~ViEImageProcessImpl() {
// Destructor WEBRTC_TRACE(kTraceMemory, kTraceVideo, instance_id_,
// ----------------------------------------------------------------------------
ViEImageProcessImpl::~ViEImageProcessImpl()
{
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, instance_id_,
"ViEImageProcessImpl::~ViEImageProcessImpl() Dtor"); "ViEImageProcessImpl::~ViEImageProcessImpl() Dtor");
} }
// ============================================================================
// Effect filter
// ============================================================================
// ----------------------------------------------------------------------------
// RegisterCaptureEffectFilter
//
// Registers an effect filter for a capture device
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::RegisterCaptureEffectFilter( int ViEImageProcessImpl::RegisterCaptureEffectFilter(
const int captureId, ViEEffectFilter& captureFilter) const int capture_id,
{ ViEEffectFilter& capture_filter) {
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_), WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
"%s(captureId: %d)", __FUNCTION__, captureId); "%s(capture_id: %d)", __FUNCTION__, capture_id);
if (!Initialized()) if (!Initialized()) {
{
SetLastError(kViENotInitialized); SetLastError(kViENotInitialized);
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_), WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
"%s - ViE instance %d not initialized", __FUNCTION__, "%s - ViE instance %d not initialized", __FUNCTION__,
instance_id_); instance_id_);
return -1; return -1;
} }
ViEInputManagerScoped is(input_manager_); ViEInputManagerScoped is(input_manager_);
ViECapturer* vieCapture = is.Capture(captureId); ViECapturer* vie_capture = is.Capture(capture_id);
if (vieCapture == NULL) if (!vie_capture) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
"%s: Capture device %d doesn't exist", __FUNCTION__, "%s: Capture device %d doesn't exist", __FUNCTION__,
captureId); capture_id);
SetLastError(kViEImageProcessInvalidCaptureId); SetLastError(kViEImageProcessInvalidCaptureId);
return -1; return -1;
} }
if (vie_capture->RegisterEffectFilter(&capture_filter) != 0) {
if (vieCapture->RegisterEffectFilter(&captureFilter) != 0)
{
SetLastError(kViEImageProcessFilterExists); SetLastError(kViEImageProcessFilterExists);
return -1; return -1;
} }
return 0; return 0;
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int capture_id) {
// DeregisterCaptureEffectFilter WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
// "%s(capture_id: %d)", __FUNCTION__, capture_id);
// Deregisters a previously set fffect filter
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::DeregisterCaptureEffectFilter(const int captureId)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(captureId: %d)", __FUNCTION__, captureId);
ViEInputManagerScoped is(input_manager_); ViEInputManagerScoped is(input_manager_);
ViECapturer* vieCapture = is.Capture(captureId); ViECapturer* vie_capture = is.Capture(capture_id);
if (vieCapture == NULL) if (!vie_capture) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
"%s: Capture device %d doesn't exist", __FUNCTION__, "%s: Capture device %d doesn't exist", __FUNCTION__,
captureId); capture_id);
SetLastError(kViEImageProcessInvalidCaptureId); SetLastError(kViEImageProcessInvalidCaptureId);
return -1; return -1;
} }
if (vieCapture->RegisterEffectFilter(NULL) != 0) if (vie_capture->RegisterEffectFilter(NULL) != 0) {
{
SetLastError(kViEImageProcessFilterDoesNotExist); SetLastError(kViEImageProcessFilterDoesNotExist);
return -1; return -1;
} }
return 0; return 0;
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::RegisterSendEffectFilter(
// RegisterSendEffectFilter const int video_channel,
// ViEEffectFilter& send_filter) {
// Registers an effect filter for a channel WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
// ---------------------------------------------------------------------------- "%s(video_channel: %d)", __FUNCTION__, video_channel);
int ViEImageProcessImpl::RegisterSendEffectFilter(const int videoChannel,
ViEEffectFilter& sendFilter)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(videoChannel: %d)", __FUNCTION__, videoChannel);
ViEChannelManagerScoped cs(channel_manager_); ViEChannelManagerScoped cs(channel_manager_);
ViEEncoder* vieEncoder = cs.Encoder(videoChannel); ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (vieEncoder == NULL) if (vie_encoder == NULL) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_), "%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
"%s: Channel %d doesn't exist", __FUNCTION__, videoChannel);
SetLastError(kViEImageProcessInvalidChannelId); SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
if (vieEncoder->RegisterEffectFilter(&sendFilter) != 0) if (vie_encoder->RegisterEffectFilter(&send_filter) != 0) {
{
SetLastError(kViEImageProcessFilterExists); SetLastError(kViEImageProcessFilterExists);
return -1; return -1;
} }
return 0; return 0;
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::DeregisterSendEffectFilter(const int video_channel) {
// DeregisterSendEffectFilter WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
// "%s(video_channel: %d)", __FUNCTION__, video_channel);
// Deregisters a previously set effect filter
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::DeregisterSendEffectFilter(const int videoChannel)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(videoChannel: %d)", __FUNCTION__, videoChannel);
ViEChannelManagerScoped cs(channel_manager_); ViEChannelManagerScoped cs(channel_manager_);
ViEEncoder* vieEncoder = cs.Encoder(videoChannel); ViEEncoder* vie_encoder = cs.Encoder(video_channel);
if (vieEncoder == NULL) if (vie_encoder == NULL) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_), "%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
"%s: Channel %d doesn't exist", __FUNCTION__, videoChannel);
SetLastError(kViEImageProcessInvalidChannelId); SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
if (vieEncoder->RegisterEffectFilter(NULL) != 0) if (vie_encoder->RegisterEffectFilter(NULL) != 0) {
{
SetLastError(kViEImageProcessFilterDoesNotExist); SetLastError(kViEImageProcessFilterDoesNotExist);
return -1; return -1;
} }
return 0; return 0;
} }
// ----------------------------------------------------------------------------
// RegisterRenderEffectFilter
//
// Registers an effect filter for an incoming decoded stream
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::RegisterRenderEffectFilter( int ViEImageProcessImpl::RegisterRenderEffectFilter(
const int videoChannel, ViEEffectFilter& renderFilter) const int video_channel,
{ ViEEffectFilter& render_filter) {
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_), WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
"%s(videoChannel: %d)", __FUNCTION__, videoChannel); "%s(video_channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(channel_manager_); ViEChannelManagerScoped cs(channel_manager_);
ViEChannel* vieChannel = cs.Channel(videoChannel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (vieChannel == NULL) if (!vie_channel) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_), "%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
"%s: Channel %d doesn't exist", __FUNCTION__, videoChannel);
SetLastError(kViEImageProcessInvalidChannelId); SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
if (vie_channel->RegisterEffectFilter(&render_filter) != 0) {
if (vieChannel->RegisterEffectFilter(&renderFilter) != 0)
{
SetLastError(kViEImageProcessFilterExists); SetLastError(kViEImageProcessFilterExists);
return -1; return -1;
} }
return 0; return 0;
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int video_channel) {
// DeregisterRenderEffectFilter WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
// "%s(video_channel: %d)", __FUNCTION__, video_channel);
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::DeregisterRenderEffectFilter(const int videoChannel)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(videoChannel: %d)", __FUNCTION__, videoChannel);
ViEChannelManagerScoped cs(channel_manager_); ViEChannelManagerScoped cs(channel_manager_);
ViEChannel* vieChannel = cs.Channel(videoChannel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (vieChannel == NULL) if (!vie_channel) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_), "%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
"%s: Channel %d doesn't exist", __FUNCTION__, videoChannel);
SetLastError(kViEImageProcessInvalidChannelId); SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
if (vieChannel->RegisterEffectFilter(NULL) != 0) if (vie_channel->RegisterEffectFilter(NULL) != 0) {
{
SetLastError(kViEImageProcessFilterDoesNotExist); SetLastError(kViEImageProcessFilterDoesNotExist);
return -1; return -1;
} }
return 0; return 0;
} }
// ============================================================================ int ViEImageProcessImpl::EnableDeflickering(const int capture_id,
// Image enhancement const bool enable) {
// ============================================================================ WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
"%s(capture_id: %d, enable: %d)", __FUNCTION__, capture_id,
// ---------------------------------------------------------------------------- enable);
// EnableDeflickering
//
// Enables/disables deflickering of the captured image.
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::EnableDeflickering(const int captureId,
const bool enable)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(captureId: %d, enable: %d)", __FUNCTION__, captureId, enable);
ViEInputManagerScoped is(input_manager_); ViEInputManagerScoped is(input_manager_);
ViECapturer* vieCapture = is.Capture(captureId); ViECapturer* vie_capture = is.Capture(capture_id);
if (vieCapture == NULL) if (!vie_capture) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
"%s: Capture device %d doesn't exist", __FUNCTION__, "%s: Capture device %d doesn't exist", __FUNCTION__,
captureId); capture_id);
SetLastError(kViEImageProcessInvalidChannelId); SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
if (vieCapture->EnableDeflickering(enable) != 0) if (vie_capture->EnableDeflickering(enable) != 0) {
{ if (enable) {
if (enable)
SetLastError(kViEImageProcessAlreadyEnabled); SetLastError(kViEImageProcessAlreadyEnabled);
else } else {
{
SetLastError(kViEImageProcessAlreadyDisabled); SetLastError(kViEImageProcessAlreadyDisabled);
} }
return -1; return -1;
@ -323,74 +223,56 @@ int ViEImageProcessImpl::EnableDeflickering(const int captureId,
return 0; return 0;
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::EnableDenoising(const int capture_id,
// EnableDenoising const bool enable) {
// WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
// Enables/disables denoising of the captured image. "%s(capture_id: %d, enable: %d)", __FUNCTION__, capture_id,
// ---------------------------------------------------------------------------- enable);
int ViEImageProcessImpl::EnableDenoising(const int captureId, const bool enable)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(captureId: %d, enable: %d)", __FUNCTION__, captureId, enable);
ViEInputManagerScoped is(input_manager_); ViEInputManagerScoped is(input_manager_);
ViECapturer* vieCapture = is.Capture(captureId); ViECapturer* vie_capture = is.Capture(capture_id);
if (vieCapture == NULL) if (!vie_capture) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
"%s: Capture device %d doesn't exist", __FUNCTION__, "%s: Capture device %d doesn't exist", __FUNCTION__,
captureId); capture_id);
SetLastError(kViEImageProcessInvalidCaptureId); SetLastError(kViEImageProcessInvalidCaptureId);
return -1; return -1;
} }
if (vieCapture->EnableDenoising(enable) != 0) if (vie_capture->EnableDenoising(enable) != 0) {
{ if (enable) {
if (enable)
SetLastError(kViEImageProcessAlreadyEnabled); SetLastError(kViEImageProcessAlreadyEnabled);
else } else {
{
SetLastError(kViEImageProcessAlreadyDisabled); SetLastError(kViEImageProcessAlreadyDisabled);
} }
return -1; return -1;
} }
return 0; return 0;
} }
// ---------------------------------------------------------------------------- int ViEImageProcessImpl::EnableColorEnhancement(const int video_channel,
// EnableColorEnhancement const bool enable) {
// WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
// Enables coloe enhancement for decoded images "%s(video_channel: %d, enable: %d)", __FUNCTION__, video_channel,
// ----------------------------------------------------------------------------
int ViEImageProcessImpl::EnableColorEnhancement(const int videoChannel,
const bool enable)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
"%s(videoChannel: %d, enable: %d)", __FUNCTION__, videoChannel,
enable); enable);
ViEChannelManagerScoped cs(channel_manager_); ViEChannelManagerScoped cs(channel_manager_);
ViEChannel* vieChannel = cs.Channel(videoChannel); ViEChannel* vie_channel = cs.Channel(video_channel);
if (vieChannel == NULL) if (!vie_channel) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_), "%s: Channel %d doesn't exist", __FUNCTION__, video_channel);
"%s: Channel %d doesn't exist", __FUNCTION__, videoChannel);
SetLastError(kViEImageProcessInvalidChannelId); SetLastError(kViEImageProcessInvalidChannelId);
return -1; return -1;
} }
if (vieChannel->EnableColorEnhancement(enable) != 0) if (vie_channel->EnableColorEnhancement(enable) != 0) {
{ if (enable) {
if (enable)
SetLastError(kViEImageProcessAlreadyEnabled); SetLastError(kViEImageProcessAlreadyEnabled);
else } else {
{
SetLastError(kViEImageProcessAlreadyDisabled); SetLastError(kViEImageProcessAlreadyDisabled);
} }
return -1; return -1;
} }
return 0; return 0;
} }
} // namespace webrtc } // namespace webrtc

View File

@ -8,59 +8,42 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
/* #ifndef WEBRTC_VIDEO_ENGINE_VIE_IMAGE_PROCESS_IMPL_H_
* vie_image_process_impl.h #define WEBRTC_VIDEO_ENGINE_VIE_IMAGE_PROCESS_IMPL_H_
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMAGE_PROCESS_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMAGE_PROCESS_IMPL_H_
#include "typedefs.h" #include "typedefs.h"
#include "vie_ref_count.h" #include "video_engine/main/interface/vie_image_process.h"
#include "vie_image_process.h" #include "video_engine/vie_ref_count.h"
#include "vie_shared_data.h" #include "video_engine/vie_shared_data.h"
namespace webrtc namespace webrtc {
{
// ---------------------------------------------------------------------------- class ViEImageProcessImpl
// ViEImageProcessImpl : public virtual ViESharedData,
// ----------------------------------------------------------------------------
class ViEImageProcessImpl: public virtual ViESharedData,
public ViEImageProcess, public ViEImageProcess,
public ViERefCount public ViERefCount {
{ public:
public: // Implements ViEImageProcess.
virtual int Release(); virtual int Release();
virtual int RegisterCaptureEffectFilter(const int capture_id,
// Effect filter ViEEffectFilter& capture_filter);
virtual int RegisterCaptureEffectFilter(const int captureId, virtual int DeregisterCaptureEffectFilter(const int capture_id);
ViEEffectFilter& captureFilter); virtual int RegisterSendEffectFilter(const int video_channel,
ViEEffectFilter& send_filter);
virtual int DeregisterCaptureEffectFilter(const int captureId); virtual int DeregisterSendEffectFilter(const int video_channel);
virtual int RegisterRenderEffectFilter(const int video_channel,
virtual int RegisterSendEffectFilter(const int videoChannel, ViEEffectFilter& render_filter);
ViEEffectFilter& sendFilter); virtual int DeregisterRenderEffectFilter(const int video_channel);
virtual int EnableDeflickering(const int capture_id, const bool enable);
virtual int DeregisterSendEffectFilter(const int videoChannel); virtual int EnableDenoising(const int capture_id, const bool enable);
virtual int EnableColorEnhancement(const int video_channel,
virtual int RegisterRenderEffectFilter(const int videoChannel,
ViEEffectFilter& renderFilter);
virtual int DeregisterRenderEffectFilter(const int videoChannel);
// Image enhancement
virtual int EnableDeflickering(const int captureId, const bool enable);
virtual int EnableDenoising(const int captureId, const bool enable);
virtual int EnableColorEnhancement(const int videoChannel,
const bool enable); const bool enable);
protected: protected:
ViEImageProcessImpl(); ViEImageProcessImpl();
virtual ~ViEImageProcessImpl(); virtual ~ViEImageProcessImpl();
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMAGE_PROCESS_IMPL_H_
#endif // WEBRTC_VIDEO_ENGINE_VIE_IMAGE_PROCESS_IMPL_H_

View File

@ -8,73 +8,50 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
/* #include "video_engine/vie_impl.h"
* vie_impl.cc
*/
#include "vie_impl.h" #if (defined(WIN32_) || defined(WIN64_))
#include "trace.h" #include <Windows.h> // For LoadLibrary.
#include <tchar.h> // For T_.
#if (defined(_WIN32) || defined(_WIN64))
#include <Windows.h> // For LoadLibrary
#include <tchar.h> // For _T
#endif #endif
#include "system_wrappers/interface/trace.h"
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
#include "video_capture_factory.h" #include "modules/video_capture/main/interface/video_capture_factory.h"
#include "video_render.h" #include "modules/video_render/main/interface/video_render.h"
#endif #endif
// Global counter to get an id for each new ViE instance // Global counter to get an id for each new ViE instance.
static WebRtc_Word32 gViEActiveInstanceCounter = 0; static WebRtc_Word32 g_vie_active_instance_counter = 0;
namespace webrtc namespace webrtc {
{
// ------------------------------------------------------------------------- // extern "C" ensures that GetProcAddress() can find the function address.
// GetVideoEngine (C-function) extern "C" {
// VideoEngine* GetVideoEngine() {
// extern "C" ensures that GetProcAddress() can find the function address
// -------------------------------------------------------------------------
extern "C"
{
VideoEngine* GetVideoEngine();
VideoEngine* GetVideoEngine()
{
VideoEngineImpl* self = new VideoEngineImpl(); VideoEngineImpl* self = new VideoEngineImpl();
if (self == NULL) if (!self) {
{
return NULL; return NULL;
} }
gViEActiveInstanceCounter++; g_vie_active_instance_counter++;
VideoEngine* vie = reinterpret_cast<VideoEngine*> (self); VideoEngine* vie = reinterpret_cast<VideoEngine*>(self);
return vie; return vie;
} }
} }
// ------------------------------------------------------------------------- VideoEngine* VideoEngine::Create() {
// Create #if (defined(WIN32_) || defined(WIN64_))
// ------------------------------------------------------------------------- // Load a debug dll, if there is one.
VideoEngine* VideoEngine::Create()
{
#if (defined(_WIN32) || defined(_WIN64))
// Load a debug dll, if there is one...
HMODULE hmod_ = LoadLibrary(TEXT("VideoEngineTestingDLL.dll")); HMODULE hmod_ = LoadLibrary(TEXT("VideoEngineTestingDLL.dll"));
if (hmod_) if (hmod_) {
{
typedef VideoEngine* (*PFNGetVideoEngineLib)(void); typedef VideoEngine* (*PFNGetVideoEngineLib)(void);
PFNGetVideoEngineLib pfn = PFNGetVideoEngineLib pfn =
(PFNGetVideoEngineLib)GetProcAddress(hmod_,"GetVideoEngine"); (PFNGetVideoEngineLib)GetProcAddress(hmod_, "GetVideoEngine");
if (pfn) if (pfn) {
{
VideoEngine* self = pfn(); VideoEngine* self = pfn();
return self; return self;
} } else {
else
{
assert(!"Failed to open test dll VideoEngineTestingDLL.dll"); assert(!"Failed to open test dll VideoEngineTestingDLL.dll");
return NULL; return NULL;
} }
@ -84,220 +61,172 @@ VideoEngine* VideoEngine::Create()
return GetVideoEngine(); return GetVideoEngine();
} }
// ------------------------------------------------------------------------- bool VideoEngine::Delete(VideoEngine*& video_engine) {
// Delete if (!video_engine) {
// WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
// Deletes the VideoEngineImpl instance if all reference counters are
// down to zero.
// -------------------------------------------------------------------------
bool VideoEngine::Delete(VideoEngine*& videoEngine)
{
if (videoEngine == NULL)
{
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"VideoEngine::Delete - No argument"); "VideoEngine::Delete - No argument");
return false; return false;
} }
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, gViEActiveInstanceCounter, WEBRTC_TRACE(kTraceApiCall, kTraceVideo, g_vie_active_instance_counter,
"VideoEngine::Delete( vie = 0x%p)", videoEngine); "VideoEngine::Delete(vie = 0x%p)", video_engine);
VideoEngineImpl* vie_impl = reinterpret_cast<VideoEngineImpl*>(video_engine);
VideoEngineImpl* vieImpl = reinterpret_cast<VideoEngineImpl*> (videoEngine); // Check all reference counters.
ViEBaseImpl* vie_base = vie_impl;
// Check all reference counters if (vie_base->GetCount() > 0) {
ViEBaseImpl* vieBase = vieImpl; WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
if (vieBase->GetCount() > 0) "ViEBase ref count: %d", vie_base->GetCount());
{
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"ViEBase ref count: %d", vieBase->GetCount());
return false; return false;
} }
#ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API #ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API
ViECaptureImpl* vieCapture = vieImpl; ViECaptureImpl* vie_capture = vie_impl;
if (vieCapture->GetCount() > 0) if (vie_capture->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViECapture ref count: %d", vie_capture->GetCount());
"ViECapture ref count: %d", vieCapture->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
ViECodecImpl* vieCodec = vieImpl; ViECodecImpl* vie_codec = vie_impl;
if (vieCodec->GetCount() > 0) if (vie_codec->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViECodec ref count: %d", vie_codec->GetCount());
"ViECodec ref count: %d", vieCodec->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_ENCRYPTION_API #ifdef WEBRTC_VIDEO_ENGINE_ENCRYPTION_API
ViEEncryptionImpl* vieEncryption = vieImpl; ViEEncryptionImpl* vie_encryption = vie_impl;
if (vieEncryption->GetCount() > 0) if (vie_encryption->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViEEncryption ref count: %d", vie_encryption->GetCount());
"ViEEncryption ref count: %d", vieEncryption->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
ViEExternalCodecImpl* vieExternalCodec = vieImpl; ViEExternalCodecImpl* vie_external_codec = vie_impl;
if (vieExternalCodec->GetCount() > 0) if (vie_external_codec->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViEEncryption ref count: %d", vie_encryption->GetCount());
"ViEEncryption ref count: %d", vieEncryption->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_FILE_API #ifdef WEBRTC_VIDEO_ENGINE_FILE_API
ViEFileImpl* vieFile = vieImpl; ViEFileImpl* vie_file = vie_impl;
if (vieFile->GetCount() > 0) if (vie_file->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViEFile ref count: %d", vie_file->GetCount());
"ViEFile ref count: %d", vieFile->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API #ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
ViEImageProcessImpl* vieImageProcess = vieImpl; ViEImageProcessImpl* vie_image_process = vie_impl;
if (vieImageProcess->GetCount() > 0) if (vie_image_process->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViEImageProcess ref count: %d",
"ViEImageProcess ref count: %d", vieImageProcess->GetCount()); vie_image_process->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API #ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
ViENetworkImpl* vieNetwork = vieImpl; ViENetworkImpl* vie_network = vie_impl;
if (vieNetwork->GetCount() > 0) if (vie_network->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViENetwork ref count: %d", vie_network->GetCount());
"ViENetwork ref count: %d", vieNetwork->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API #ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
ViERenderImpl* vieRender = vieImpl; ViERenderImpl* vie_render = vie_impl;
if (vieRender->GetCount() > 0) if (vie_render->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViERender ref count: %d", vie_render->GetCount());
"ViERender ref count: %d", vieRender->GetCount());
return false; return false;
} }
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API #ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
ViERTP_RTCPImpl* vieRtpRtcp = vieImpl; ViERTP_RTCPImpl* vie_rtp_rtcp = vie_impl;
if (vieRtpRtcp->GetCount() > 0) if (vie_rtp_rtcp->GetCount() > 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, "ViERTP_RTCP ref count: %d", vie_rtp_rtcp->GetCount());
"ViERTP_RTCP ref count: %d", vieRtpRtcp->GetCount());
return false; return false;
} }
#endif #endif
// Delete VieImpl delete vie_impl;
delete vieImpl; vie_impl = NULL;
vieImpl = NULL; video_engine = NULL;
videoEngine = NULL;
// Decrease the number of instances // Decrease the number of instances.
gViEActiveInstanceCounter--; g_vie_active_instance_counter--;
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, gViEActiveInstanceCounter, WEBRTC_TRACE(kTraceInfo, kTraceVideo, g_vie_active_instance_counter,
"%s: instance deleted. Remaining instances: %d", __FUNCTION__, "%s: instance deleted. Remaining instances: %d", __FUNCTION__,
gViEActiveInstanceCounter); g_vie_active_instance_counter);
return true; return true;
} }
// ------------------------------------------------------------------------- int VideoEngine::SetTraceFile(const char* file_nameUTF8,
// [static] SetTraceFile const bool add_file_counter) {
// ------------------------------------------------------------------------- if (!file_nameUTF8) {
int VideoEngine::SetTraceFile(const char* fileNameUTF8,
const bool addFileCounter)
{
if (fileNameUTF8 == NULL)
{
return -1; return -1;
} }
if (Trace::SetTraceFile(fileNameUTF8, addFileCounter) == -1) if (Trace::SetTraceFile(file_nameUTF8, add_file_counter) == -1) {
{
return -1; return -1;
} }
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, gViEActiveInstanceCounter, WEBRTC_TRACE(kTraceApiCall, kTraceVideo, g_vie_active_instance_counter,
"SetTraceFileName(fileNameUTF8 = %s, addFileCounter = %d", "SetTraceFileName(file_nameUTF8 = %s, add_file_counter = %d",
fileNameUTF8, addFileCounter); file_nameUTF8, add_file_counter);
return 0; return 0;
} }
// ------------------------------------------------------------------------- int VideoEngine::SetTraceFilter(const unsigned int filter) {
// [static] SetTraceFilter WebRtc_UWord32 old_filter = 0;
// ------------------------------------------------------------------------- Trace::LevelFilter(old_filter);
int VideoEngine::SetTraceFilter(const unsigned int filter) if (filter == kTraceNone && old_filter != kTraceNone) {
{ // Do the logging before turning it off.
WebRtc_UWord32 oldFilter = 0; WEBRTC_TRACE(kTraceApiCall, kTraceVideo, g_vie_active_instance_counter,
Trace::LevelFilter(oldFilter);
if (filter == webrtc::kTraceNone && oldFilter != webrtc::kTraceNone)
{
// Do the logging before turning it off
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"SetTraceFilter(filter = 0x%x)", filter); "SetTraceFilter(filter = 0x%x)", filter);
} }
WebRtc_Word32 error = Trace::SetLevelFilter(filter); WebRtc_Word32 error = Trace::SetLevelFilter(filter);
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"SetTraceFilter(filter = 0x%x)", filter); "SetTraceFilter(filter = 0x%x)", filter);
if (error != 0) if (error != 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"SetTraceFilter error: %d", error); "SetTraceFilter error: %d", error);
return -1; return -1;
} }
return 0; return 0;
} }
// ------------------------------------------------------------------------- int VideoEngine::SetTraceCallback(TraceCallback* callback) {
// [static] SetTraceFilter WEBRTC_TRACE(kTraceApiCall, kTraceVideo, g_vie_active_instance_counter,
// ------------------------------------------------------------------------- "SetTraceCallback(TraceCallback = 0x%p)", callback);
int VideoEngine::SetTraceCallback(webrtc::TraceCallback* callback)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"SetTraceCallback(webrtc::TraceCallback = 0x%p)", callback);
return Trace::SetTraceCallback(callback); return Trace::SetTraceCallback(callback);
} }
// ------------------------------------------------------------------------- int VideoEngine::SetAndroidObjects(void* javaVM, void* java_context) {
// [static] SetAndroidObjects WEBRTC_TRACE(kTraceApiCall, kTraceVideo, g_vie_active_instance_counter,
// -------------------------------------------------------------------------
int VideoEngine::SetAndroidObjects(void* javaVM, void* javaContext)
{
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"SetAndroidObjects()"); "SetAndroidObjects()");
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
if (VideoCaptureFactory::SetAndroidObjects(javaVM,javaContext) != 0) if (VideoCaptureFactory::SetAndroidObjects(javaVM, javaContext) != 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"Could not set capture module Android objects"); "Could not set capture module Android objects");
return -1; return -1;
} }
if (VideoRender::SetAndroidObjects(javaVM) != 0) if (VideoRender::SetAndroidObjects(javaVM) != 0) {
{ WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter,
"Could not set render module Android objects"); "Could not set render module Android objects");
return -1; return -1;
} }
return 0; return 0;
#else #else
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, gViEActiveInstanceCounter, WEBRTC_TRACE(kTraceError, kTraceVideo, g_vie_active_instance_counter,
"WEBRTC_ANDROID not defined for VideoEngine::SetAndroidObjects"); "WEBRTC_ANDROID not defined for VideoEngine::SetAndroidObjects");
return -1; return -1;
#endif #endif
} }
} // namespace webrtc } // namespace webrtc

View File

@ -8,52 +8,46 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
/* #ifndef WEBRTC_VIDEO_ENGINE_VIE_IMPL_H_
* vie_impl.h #define WEBRTC_VIDEO_ENGINE_VIE_IMPL_H_
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMPL_H_
#include "engine_configurations.h" #include "engine_configurations.h"
#include "vie_defines.h" #include "video_engine/vie_defines.h"
// Include all sub API:s #include "video_engine/vie_base_impl.h"
#include "vie_base_impl.h"
#ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API #ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API
#include "vie_capture_impl.h" #include "video_engine/vie_capture_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
#include "vie_codec_impl.h" #include "video_engine/vie_codec_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_ENCRYPTION_API #ifdef WEBRTC_VIDEO_ENGINE_ENCRYPTION_API
#include "vie_encryption_impl.h" #include "video_engine/vie_encryption_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_FILE_API #ifdef WEBRTC_VIDEO_ENGINE_FILE_API
#include "vie_file_impl.h" #include "video_engine/vie_file_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API #ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
#include "vie_image_process_impl.h" #include "video_engine/vie_image_process_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API #ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
#include "vie_network_impl.h" #include "video_engine/vie_network_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API #ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
#include "vie_render_impl.h" #include "video_engine/vie_render_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API #ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
#include "vie_rtp_rtcp_impl.h" #include "video_engine/vie_rtp_rtcp_impl.h"
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
#include "vie_external_codec_impl.h" #include "video_engine/vie_external_codec_impl.h"
#endif #endif
namespace webrtc namespace webrtc {
{
class VideoEngineImpl: public ViEBaseImpl class VideoEngineImpl
: public ViEBaseImpl
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
, public ViECodecImpl , public ViECodecImpl
#endif #endif
@ -79,12 +73,14 @@ class VideoEngineImpl: public ViEBaseImpl
, public ViERTP_RTCPImpl , public ViERTP_RTCPImpl
#endif #endif
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API #ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
,public ViEExternalCodecImpl , public ViEExternalCodecImpl
#endif #endif
{ { // NOLINT
public: public:
VideoEngineImpl() {}; VideoEngineImpl() {}
virtual ~VideoEngineImpl() {}; virtual ~VideoEngineImpl() {}
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMPL_H_
#endif // WEBRTC_VIDEO_ENGINE_VIE_IMPL_H_

File diff suppressed because it is too large Load Diff

View File

@ -8,130 +8,104 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
/* #ifndef WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_
* vie_network_impl.h #define WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_NETWORK_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_NETWORK_IMPL_H_
#include "typedefs.h" #include "typedefs.h"
#include "vie_defines.h" #include "video_engine/main/interface/vie_network.h"
#include "vie_network.h" #include "video_engine/vie_ref_count.h"
#include "vie_ref_count.h" #include "video_engine/vie_shared_data.h"
#include "vie_shared_data.h"
namespace webrtc namespace webrtc {
{
// ---------------------------------------------------------------------------- class ViENetworkImpl
// ViENetworkImpl : public virtual ViESharedData,
// ----------------------------------------------------------------------------
class ViENetworkImpl : public virtual ViESharedData,
public ViENetwork, public ViENetwork,
public ViERefCount public ViERefCount {
{ public:
public: // Implements ViENetwork.
virtual int Release(); virtual int Release();
virtual int SetLocalReceiver(const int video_channel,
// Receive functions const unsigned short rtp_port,
virtual int SetLocalReceiver(const int videoChannel, const unsigned short rtcp_port,
const unsigned short rtpPort, const char* ip_address);
const unsigned short rtcpPort, virtual int GetLocalReceiver(const int video_channel,
const char* ipAddress); unsigned short& rtp_port,
unsigned short& rtcp_port,
virtual int GetLocalReceiver(const int videoChannel, char* ip_address);
unsigned short& rtpPort, virtual int SetSendDestination(const int video_channel,
unsigned short& rtcpPort, char* ipAddress); const char* ip_address,
const unsigned short rtp_port,
// Send functions const unsigned short rtcp_port,
virtual int SetSendDestination(const int videoChannel, const unsigned short source_rtp_port,
const char* ipAddress, const unsigned short source_rtcp_port);
const unsigned short rtpPort, virtual int GetSendDestination(const int video_channel,
const unsigned short rtcpPort, char* ip_address,
const unsigned short sourceRtpPort, unsigned short& rtp_port,
const unsigned short sourceRtcpPort); unsigned short& rtcp_port,
unsigned short& source_rtp_port,
virtual int GetSendDestination(const int videoChannel, char* ipAddress, unsigned short& source_rtcp_port);
unsigned short& rtpPort, virtual int RegisterSendTransport(const int video_channel,
unsigned short& rtcpPort,
unsigned short& sourceRtpPort,
unsigned short& sourceRtcpPort);
// External transport
virtual int RegisterSendTransport(const int videoChannel,
Transport& transport); Transport& transport);
virtual int DeregisterSendTransport(const int video_channel);
virtual int DeregisterSendTransport(const int videoChannel); virtual int ReceivedRTPPacket(const int video_channel,
const void* data,
virtual int ReceivedRTPPacket(const int videoChannel, const void* data,
const int length); const int length);
virtual int ReceivedRTCPPacket(const int video_channel,
virtual int ReceivedRTCPPacket(const int videoChannel, const void* data, const void* data,
const int length); const int length);
virtual int GetSourceInfo(const int video_channel,
// Get info unsigned short& rtp_port,
virtual int GetSourceInfo(const int videoChannel, unsigned short& rtpPort, unsigned short& rtcp_port,
unsigned short& rtcpPort, char* ipAddress, char* ip_address,
unsigned int ipAddressLength); unsigned int ip_address_length);
virtual int GetLocalIP(char ip_address[64], bool ipv6);
virtual int GetLocalIP(char ipAddress[64], bool ipv6); virtual int EnableIPv6(int video_channel);
virtual bool IsIPv6Enabled(int video_channel);
// IPv6 virtual int SetSourceFilter(const int video_channel,
virtual int EnableIPv6(int videoChannel); const unsigned short rtp_port,
const unsigned short rtcp_port,
virtual bool IsIPv6Enabled(int videoChannel); const char* ip_address);
virtual int GetSourceFilter(const int video_channel,
// Source IP address and port filter unsigned short& rtp_port,
virtual int SetSourceFilter(const int videoChannel, unsigned short& rtcp_port,
const unsigned short rtpPort, char* ip_address);
const unsigned short rtcpPort, virtual int SetSendToS(const int video_channel,
const char* ipAddress); const int DSCP,
const bool use_set_sockOpt);
virtual int GetSourceFilter(const int videoChannel, virtual int GetSendToS(const int video_channel,
unsigned short& rtpPort, int& DSCP,
unsigned short& rtcpPort, char* ipAddress); bool& use_set_sockOpt);
virtual int SetSendGQoS(const int video_channel,
// ToS const bool enable,
virtual int SetSendToS(const int videoChannel, const int DSCP, const int service_type,
const bool useSetSockOpt); const int overrideDSCP);
virtual int GetSendGQoS(const int video_channel,
virtual int GetSendToS(const int videoChannel, int& DSCP, bool& enabled,
bool& useSetSockOpt); int& service_type,
int& overrideDSCP);
// GQoS virtual int SetMTU(int video_channel, unsigned int mtu);
virtual int SetSendGQoS(const int videoChannel, const bool enable, virtual int SetPacketTimeoutNotification(const int video_channel,
const int serviceType, const int overrideDSCP); bool enable,
int timeout_seconds);
virtual int GetSendGQoS(const int videoChannel, bool& enabled, virtual int RegisterObserver(const int video_channel,
int& serviceType, int& overrideDSCP);
// Network settings
virtual int SetMTU(int videoChannel, unsigned int mtu);
// Packet timout notification
virtual int SetPacketTimeoutNotification(const int videoChannel,
bool enable, int timeoutSeconds);
// Periodic dead-or-alive reports
virtual int RegisterObserver(const int videoChannel,
ViENetworkObserver& observer); ViENetworkObserver& observer);
virtual int DeregisterObserver(const int video_channel);
virtual int SetPeriodicDeadOrAliveStatus(
const int video_channel,
const bool enable,
const unsigned int sample_time_seconds);
virtual int SendUDPPacket(const int video_channel,
const void* data,
const unsigned int length,
int& transmitted_bytes,
bool use_rtcp_socket);
virtual int DeregisterObserver(const int videoChannel); protected:
virtual int
SetPeriodicDeadOrAliveStatus(const int videoChannel, const bool enable,
const unsigned int sampleTimeSeconds);
// Send extra packet using the User Datagram Protocol (UDP)
virtual int SendUDPPacket(const int videoChannel, const void* data,
const unsigned int length, int& transmittedBytes,
bool useRtcpSocket);
protected:
ViENetworkImpl(); ViENetworkImpl();
virtual ~ViENetworkImpl(); virtual ~ViENetworkImpl();
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_NETWORK_IMPL_H_
#endif // WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_