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

View File

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

View File

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

View File

@ -8,83 +8,79 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* vie_impl.h
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_IMPL_H_
#ifndef WEBRTC_VIDEO_ENGINE_VIE_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_VIE_IMPL_H_
#include "engine_configurations.h"
#include "vie_defines.h"
#include "video_engine/vie_defines.h"
// Include all sub API:s
#include "vie_base_impl.h"
#include "video_engine/vie_base_impl.h"
#ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API
#include "vie_capture_impl.h"
#include "video_engine/vie_capture_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
#include "vie_codec_impl.h"
#include "video_engine/vie_codec_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_ENCRYPTION_API
#include "vie_encryption_impl.h"
#include "video_engine/vie_encryption_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_FILE_API
#include "vie_file_impl.h"
#include "video_engine/vie_file_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
#include "vie_image_process_impl.h"
#include "video_engine/vie_image_process_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
#include "vie_network_impl.h"
#include "video_engine/vie_network_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
#include "vie_render_impl.h"
#include "video_engine/vie_render_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
#include "vie_rtp_rtcp_impl.h"
#include "video_engine/vie_rtp_rtcp_impl.h"
#endif
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
#include "vie_external_codec_impl.h"
#include "video_engine/vie_external_codec_impl.h"
#endif
namespace webrtc
{
namespace webrtc {
class VideoEngineImpl: public ViEBaseImpl
class VideoEngineImpl
: public ViEBaseImpl
#ifdef WEBRTC_VIDEO_ENGINE_CODEC_API
, public ViECodecImpl
, public ViECodecImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_CAPTURE_API
, public ViECaptureImpl
, public ViECaptureImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_ENCRYPTION_API
, public ViEEncryptionImpl
, public ViEEncryptionImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_FILE_API
, public ViEFileImpl
, public ViEFileImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_IMAGE_PROCESS_API
, public ViEImageProcessImpl
, public ViEImageProcessImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_NETWORK_API
, public ViENetworkImpl
, public ViENetworkImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
, public ViERenderImpl
, public ViERenderImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_RTP_RTCP_API
, public ViERTP_RTCPImpl
, public ViERTP_RTCPImpl
#endif
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
,public ViEExternalCodecImpl
, public ViEExternalCodecImpl
#endif
{
public:
VideoEngineImpl() {};
virtual ~VideoEngineImpl() {};
{ // NOLINT
public:
VideoEngineImpl() {}
virtual ~VideoEngineImpl() {}
};
} // 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.
*/
/*
* vie_network_impl.h
*/
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_NETWORK_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_NETWORK_IMPL_H_
#ifndef WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_
#define WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_
#include "typedefs.h"
#include "vie_defines.h"
#include "vie_network.h"
#include "vie_ref_count.h"
#include "vie_shared_data.h"
#include "video_engine/main/interface/vie_network.h"
#include "video_engine/vie_ref_count.h"
#include "video_engine/vie_shared_data.h"
namespace webrtc
{
namespace webrtc {
// ----------------------------------------------------------------------------
// ViENetworkImpl
// ----------------------------------------------------------------------------
class ViENetworkImpl
: public virtual ViESharedData,
public ViENetwork,
public ViERefCount {
public:
// Implements ViENetwork.
virtual int Release();
virtual int SetLocalReceiver(const int video_channel,
const unsigned short rtp_port,
const unsigned short rtcp_port,
const char* ip_address);
virtual int GetLocalReceiver(const int video_channel,
unsigned short& rtp_port,
unsigned short& rtcp_port,
char* ip_address);
virtual int SetSendDestination(const int video_channel,
const char* ip_address,
const unsigned short rtp_port,
const unsigned short rtcp_port,
const unsigned short source_rtp_port,
const unsigned short source_rtcp_port);
virtual int GetSendDestination(const int video_channel,
char* ip_address,
unsigned short& rtp_port,
unsigned short& rtcp_port,
unsigned short& source_rtp_port,
unsigned short& source_rtcp_port);
virtual int RegisterSendTransport(const int video_channel,
Transport& transport);
virtual int DeregisterSendTransport(const int video_channel);
virtual int ReceivedRTPPacket(const int video_channel,
const void* data,
const int length);
virtual int ReceivedRTCPPacket(const int video_channel,
const void* data,
const int length);
virtual int GetSourceInfo(const int video_channel,
unsigned short& rtp_port,
unsigned short& rtcp_port,
char* ip_address,
unsigned int ip_address_length);
virtual int GetLocalIP(char ip_address[64], bool ipv6);
virtual int EnableIPv6(int video_channel);
virtual bool IsIPv6Enabled(int video_channel);
virtual int SetSourceFilter(const int video_channel,
const unsigned short rtp_port,
const unsigned short rtcp_port,
const char* ip_address);
virtual int GetSourceFilter(const int video_channel,
unsigned short& rtp_port,
unsigned short& rtcp_port,
char* ip_address);
virtual int SetSendToS(const int video_channel,
const int DSCP,
const bool use_set_sockOpt);
virtual int GetSendToS(const int video_channel,
int& DSCP,
bool& use_set_sockOpt);
virtual int SetSendGQoS(const int video_channel,
const bool enable,
const int service_type,
const int overrideDSCP);
virtual int GetSendGQoS(const int video_channel,
bool& enabled,
int& service_type,
int& overrideDSCP);
virtual int SetMTU(int video_channel, unsigned int mtu);
virtual int SetPacketTimeoutNotification(const int video_channel,
bool enable,
int timeout_seconds);
virtual int RegisterObserver(const int video_channel,
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);
class ViENetworkImpl : public virtual ViESharedData,
public ViENetwork,
public ViERefCount
{
public:
virtual int Release();
// Receive functions
virtual int SetLocalReceiver(const int videoChannel,
const unsigned short rtpPort,
const unsigned short rtcpPort,
const char* ipAddress);
virtual int GetLocalReceiver(const int videoChannel,
unsigned short& rtpPort,
unsigned short& rtcpPort, char* ipAddress);
// Send functions
virtual int SetSendDestination(const int videoChannel,
const char* ipAddress,
const unsigned short rtpPort,
const unsigned short rtcpPort,
const unsigned short sourceRtpPort,
const unsigned short sourceRtcpPort);
virtual int GetSendDestination(const int videoChannel, char* ipAddress,
unsigned short& rtpPort,
unsigned short& rtcpPort,
unsigned short& sourceRtpPort,
unsigned short& sourceRtcpPort);
// External transport
virtual int RegisterSendTransport(const int videoChannel,
Transport& transport);
virtual int DeregisterSendTransport(const int videoChannel);
virtual int ReceivedRTPPacket(const int videoChannel, const void* data,
const int length);
virtual int ReceivedRTCPPacket(const int videoChannel, const void* data,
const int length);
// Get info
virtual int GetSourceInfo(const int videoChannel, unsigned short& rtpPort,
unsigned short& rtcpPort, char* ipAddress,
unsigned int ipAddressLength);
virtual int GetLocalIP(char ipAddress[64], bool ipv6);
// IPv6
virtual int EnableIPv6(int videoChannel);
virtual bool IsIPv6Enabled(int videoChannel);
// Source IP address and port filter
virtual int SetSourceFilter(const int videoChannel,
const unsigned short rtpPort,
const unsigned short rtcpPort,
const char* ipAddress);
virtual int GetSourceFilter(const int videoChannel,
unsigned short& rtpPort,
unsigned short& rtcpPort, char* ipAddress);
// ToS
virtual int SetSendToS(const int videoChannel, const int DSCP,
const bool useSetSockOpt);
virtual int GetSendToS(const int videoChannel, int& DSCP,
bool& useSetSockOpt);
// GQoS
virtual int SetSendGQoS(const int videoChannel, const bool enable,
const int serviceType, const int overrideDSCP);
virtual int GetSendGQoS(const int videoChannel, bool& enabled,
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);
virtual int DeregisterObserver(const int videoChannel);
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();
virtual ~ViENetworkImpl();
protected:
ViENetworkImpl();
virtual ~ViENetworkImpl();
};
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_NETWORK_IMPL_H_
} // namespace webrtc
#endif // WEBRTC_VIDEO_ENGINE_VIE_NETWORK_IMPL_H_