Refactored ViERenderImpl and ViERTP_RTCPImpl.
Review URL: http://webrtc-codereview.appspot.com/329005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1232 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
7752d11056
commit
8da2417c9d
@ -162,7 +162,7 @@ public:
|
|||||||
|
|
||||||
// This function gets the RTCP status for the specified channel.
|
// This function gets the RTCP status for the specified channel.
|
||||||
virtual int GetRTCPStatus(const int videoChannel,
|
virtual int GetRTCPStatus(const int videoChannel,
|
||||||
ViERTCPMode& rtcpMode) = 0;
|
ViERTCPMode& rtcpMode) const = 0;
|
||||||
|
|
||||||
// This function sets the RTCP canonical name (CNAME) for the RTCP reports
|
// This function sets the RTCP canonical name (CNAME) for the RTCP reports
|
||||||
// on a specific channel.
|
// on a specific channel.
|
||||||
@ -172,7 +172,7 @@ public:
|
|||||||
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
|
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
|
||||||
// sent the specified channel.
|
// sent the specified channel.
|
||||||
virtual int GetRTCPCName(const int videoChannel,
|
virtual int GetRTCPCName(const int videoChannel,
|
||||||
char rtcpCName[KMaxRTCPCNameLength]) = 0;
|
char rtcpCName[KMaxRTCPCNameLength]) const = 0;
|
||||||
|
|
||||||
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
|
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
|
||||||
// received on the specified channel.
|
// received on the specified channel.
|
||||||
@ -260,7 +260,7 @@ public:
|
|||||||
// This function gets the RTP keep-alive status.
|
// This function gets the RTP keep-alive status.
|
||||||
virtual int GetRTPKeepAliveStatus(
|
virtual int GetRTPKeepAliveStatus(
|
||||||
const int videoChannel, bool& enabled, char& unkownPayloadType,
|
const int videoChannel, bool& enabled, char& unkownPayloadType,
|
||||||
unsigned int& deltaTransmitTimeSeconds) = 0;
|
unsigned int& deltaTransmitTimeSeconds) const = 0;
|
||||||
|
|
||||||
// This function enables capturing of RTP packets to a binary file on a
|
// This function enables capturing of RTP packets to a binary file on a
|
||||||
// specific channel and for a given direction. The file can later be
|
// specific channel and for a given direction. The file can later be
|
||||||
|
@ -8,245 +8,166 @@
|
|||||||
* 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_render_impl.h"
|
||||||
* vie_render_impl.cc
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "vie_render_impl.h"
|
|
||||||
|
|
||||||
// Defines
|
|
||||||
#include "engine_configurations.h"
|
#include "engine_configurations.h"
|
||||||
#include "vie_defines.h"
|
#include "modules/video_render/main/interface/video_render.h"
|
||||||
|
#include "modules/video_render/main/interface/video_render_defines.h"
|
||||||
#include "trace.h"
|
#include "system_wrappers/interface/trace.h"
|
||||||
#include "video_render.h"
|
#include "video_engine/main/interface/vie_errors.h"
|
||||||
#include "video_render_defines.h"
|
#include "video_engine/vie_capturer.h"
|
||||||
#include "vie_errors.h"
|
#include "video_engine/vie_channel.h"
|
||||||
#include "vie_impl.h"
|
#include "video_engine/vie_channel_manager.h"
|
||||||
#include "vie_capturer.h"
|
#include "video_engine/vie_defines.h"
|
||||||
#include "vie_channel.h"
|
#include "video_engine/vie_frame_provider_base.h"
|
||||||
#include "vie_frame_provider_base.h"
|
#include "video_engine/vie_impl.h"
|
||||||
#include "vie_channel_manager.h"
|
#include "video_engine/vie_input_manager.h"
|
||||||
#include "vie_input_manager.h"
|
#include "video_engine/vie_render_manager.h"
|
||||||
#include "vie_render_manager.h"
|
|
||||||
#include "video_engine/vie_renderer.h"
|
#include "video_engine/vie_renderer.h"
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc {
|
||||||
{
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
ViERender* ViERender::GetInterface(VideoEngine* video_engine) {
|
||||||
// GetInterface
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ViERender* ViERender::GetInterface(VideoEngine* videoEngine)
|
|
||||||
{
|
|
||||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_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);
|
||||||
ViERenderImpl* vieRenderImpl = vieImpl;
|
ViERenderImpl* vie_render_impl = vie_impl;
|
||||||
(*vieRenderImpl)++; // Increase ref count
|
// Increase ref count.
|
||||||
|
(*vie_render_impl)++;
|
||||||
return vieRenderImpl;
|
return vie_render_impl;
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
int ViERenderImpl::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 ViERenderImpl::Release()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, instance_id_,
|
|
||||||
"ViERender::Release()");
|
"ViERender::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_,
|
|
||||||
"ViERender release too many times");
|
"ViERender release too many times");
|
||||||
// SetLastError()
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, instance_id_,
|
WEBRTC_TRACE(kTraceInfo, kTraceVideo, instance_id_,
|
||||||
"ViERender reference count: %d", refCount);
|
"ViERender reference count: %d", ref_count);
|
||||||
return refCount;
|
return ref_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
ViERenderImpl::ViERenderImpl() {
|
||||||
// Constructor
|
WEBRTC_TRACE(kTraceMemory, kTraceVideo, instance_id_,
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ViERenderImpl::ViERenderImpl()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, instance_id_,
|
|
||||||
"ViERenderImpl::ViERenderImpl() Ctor");
|
"ViERenderImpl::ViERenderImpl() Ctor");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
ViERenderImpl::~ViERenderImpl() {
|
||||||
// Destructor
|
WEBRTC_TRACE(kTraceMemory, kTraceVideo, instance_id_,
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ViERenderImpl::~ViERenderImpl()
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, instance_id_,
|
|
||||||
"ViERenderImpl::~ViERenderImpl() Dtor");
|
"ViERenderImpl::~ViERenderImpl() Dtor");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// Registration of render module
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// RegisterVideoRenderModule
|
|
||||||
//
|
|
||||||
// Registers a video render module, must be called before
|
|
||||||
// AddRenderer is called for an input stream associated
|
|
||||||
// with the same window as the module.
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ViERenderImpl::RegisterVideoRenderModule(
|
int ViERenderImpl::RegisterVideoRenderModule(
|
||||||
VideoRender& renderModule)
|
VideoRender& render_module) {
|
||||||
{
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
"%s (&render_module: %p)", __FUNCTION__, &render_module);
|
||||||
"%s (&renderModule: %p)", __FUNCTION__, &renderModule);
|
if (render_manager_.RegisterVideoRenderModule(render_module) != 0) {
|
||||||
|
|
||||||
if (render_manager_.RegisterVideoRenderModule(renderModule) != 0)
|
|
||||||
{
|
|
||||||
// Error logging is done in RegisterVideoRenderModule
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// DeRegisterVideoRenderModule
|
|
||||||
//
|
|
||||||
// De-registers a video render module, must be called after
|
|
||||||
// RemoveRenderer has been called for all input streams associated
|
|
||||||
// with the same window as the module.
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ViERenderImpl::DeRegisterVideoRenderModule(
|
int ViERenderImpl::DeRegisterVideoRenderModule(
|
||||||
VideoRender& renderModule)
|
VideoRender& render_module) {
|
||||||
{
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
"%s (&render_module: %p)", __FUNCTION__, &render_module);
|
||||||
"%s (&renderModule: %p)", __FUNCTION__, &renderModule);
|
if (render_manager_.DeRegisterVideoRenderModule(render_module) != 0) {
|
||||||
if (render_manager_.DeRegisterVideoRenderModule(renderModule) != 0)
|
// Error logging is done in ViERenderManager::DeRegisterVideoRenderModule.
|
||||||
{
|
|
||||||
// Error logging is done in DeRegisterVideoRenderModule
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
int ViERenderImpl::AddRenderer(const int render_id, void* window,
|
||||||
// Add renderer
|
const unsigned int z_order, const float left,
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
int ViERenderImpl::AddRenderer(const int renderId, void* window,
|
|
||||||
const unsigned int zOrder, const float left,
|
|
||||||
const float top, const float right,
|
const float top, const float right,
|
||||||
const float bottom)
|
const float bottom) {
|
||||||
{
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
"%s (render_id: %d, window: 0x%p, z_order: %u, left: %f, "
|
||||||
"%s (renderId: %d, window: 0x%p, zOrder: %u, left: %f, "
|
|
||||||
"top: %f, right: %f, bottom: %f)",
|
"top: %f, right: %f, bottom: %f)",
|
||||||
__FUNCTION__, renderId, window, zOrder, left, top, right,
|
__FUNCTION__, render_id, window, z_order, left, top, right,
|
||||||
bottom);
|
bottom);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Check if the renderer exist already
|
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
|
||||||
if (rs.Renderer(renderId) != NULL)
|
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
|
if (rs.Renderer(render_id) != NULL) {
|
||||||
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderAlreadyExists);
|
SetLastError(kViERenderAlreadyExists);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (render_id >= kViEChannelIdBase && render_id <= kViEChannelIdMax) {
|
||||||
if (renderId >= kViEChannelIdBase && renderId <= kViEChannelIdMax)
|
// This is a channel.
|
||||||
{
|
|
||||||
// This is a channel
|
|
||||||
ViEChannelManagerScoped cm(channel_manager_);
|
ViEChannelManagerScoped cm(channel_manager_);
|
||||||
ViEFrameProviderBase* frameProvider = cm.Channel(renderId);
|
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||||
if (frameProvider == NULL)
|
if (!frame_provider) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
|
||||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ViERenderer* renderer = render_manager_.AddRenderStream(renderId,
|
ViERenderer* renderer = render_manager_.AddRenderStream(render_id,
|
||||||
window, zOrder,
|
window, z_order,
|
||||||
left, top,
|
left, top,
|
||||||
right, bottom);
|
right, bottom);
|
||||||
if (renderer == NULL)
|
if (!renderer) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return frameProvider->RegisterFrameCallback(renderId, renderer);
|
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||||
}
|
} else {
|
||||||
else // camera or file
|
// Camera or file.
|
||||||
{
|
|
||||||
ViEInputManagerScoped is(input_manager_);
|
ViEInputManagerScoped is(input_manager_);
|
||||||
ViEFrameProviderBase* frameProvider = is.FrameProvider(renderId);
|
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
|
||||||
if (frameProvider == NULL)
|
if (!frame_provider) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
|
||||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ViERenderer* renderer = render_manager_.AddRenderStream(renderId,
|
ViERenderer* renderer = render_manager_.AddRenderStream(render_id,
|
||||||
window, zOrder,
|
window, z_order,
|
||||||
left, top,
|
left, top,
|
||||||
right, bottom);
|
right, bottom);
|
||||||
if (renderer == NULL)
|
if (!renderer) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return frameProvider->RegisterFrameCallback(renderId, renderer);
|
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||||
}
|
}
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ViERenderImpl::RemoveRenderer(const int renderId)
|
int ViERenderImpl::RemoveRenderer(const int render_id) {
|
||||||
{
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
"%s(render_id: %d)", __FUNCTION__, render_id);
|
||||||
"%s(renderId: %d)", __FUNCTION__, renderId);
|
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;
|
||||||
@ -255,310 +176,218 @@ int ViERenderImpl::RemoveRenderer(const int renderId)
|
|||||||
ViERenderer* renderer = NULL;
|
ViERenderer* renderer = NULL;
|
||||||
{
|
{
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
renderer = rs.Renderer(renderId);
|
renderer = rs.Renderer(render_id);
|
||||||
if (!renderer)
|
if (!renderer) {
|
||||||
{
|
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(instance_id_),
|
"%s No render exist with render_id: %d", __FUNCTION__,
|
||||||
"%s No render exist with renderId: %d", __FUNCTION__,
|
render_id);
|
||||||
renderId);
|
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} // Leave the scope lock since we don't want to lock two managers
|
// Leave the scope lock since we don't want to lock two managers
|
||||||
// simultanousely
|
// simultanousely.
|
||||||
|
}
|
||||||
if (renderId >= kViEChannelIdBase && renderId <= kViEChannelIdMax)
|
if (render_id >= kViEChannelIdBase && render_id <= kViEChannelIdMax) {
|
||||||
{
|
// This is a channel.
|
||||||
// This is a channel
|
|
||||||
ViEChannelManagerScoped cm(channel_manager_);
|
ViEChannelManagerScoped cm(channel_manager_);
|
||||||
ViEChannel* channel = cm.Channel(renderId);
|
ViEChannel* channel = cm.Channel(render_id);
|
||||||
if (!channel)
|
if (!channel) {
|
||||||
{
|
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(instance_id_),
|
|
||||||
"%s: no channel with id %d exists ", __FUNCTION__,
|
"%s: no channel with id %d exists ", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
channel->DeregisterFrameCallback(renderer);
|
channel->DeregisterFrameCallback(renderer);
|
||||||
}
|
} else {
|
||||||
else //Provider owned by inputmanager - ie file or capture device
|
// Provider owned by inputmanager, i.e. file or capture device.
|
||||||
{
|
|
||||||
ViEInputManagerScoped is(input_manager_);
|
ViEInputManagerScoped is(input_manager_);
|
||||||
ViEFrameProviderBase* provider = is.FrameProvider(renderId);
|
ViEFrameProviderBase* provider = is.FrameProvider(render_id);
|
||||||
if (!provider)
|
if (!provider) {
|
||||||
{
|
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(instance_id_),
|
|
||||||
"%s: no provider with id %d exists ", __FUNCTION__,
|
"%s: no provider with id %d exists ", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
provider->DeregisterFrameCallback(renderer);
|
provider->DeregisterFrameCallback(renderer);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (render_manager_.RemoveRenderStream(renderId) != 0)
|
if (render_manager_.RemoveRenderStream(render_id) != 0) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
int ViERenderImpl::StartRender(const int render_id) {
|
||||||
// Start/stop
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
// ============================================================================
|
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// StartRender
|
|
||||||
//
|
|
||||||
// Starts rendering the stream from the channel
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ViERenderImpl::StartRender(const int renderId)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo,
|
|
||||||
ViEId(instance_id_, renderId), "%s(channel: %d)", __FUNCTION__,
|
|
||||||
renderId);
|
|
||||||
|
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
ViERenderer* renderer = rs.Renderer(render_id);
|
||||||
if (ptrRender == NULL)
|
if (!renderer) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
// No renderer for this channel
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
|
||||||
ViEId(instance_id_, renderId),
|
|
||||||
"%s: No renderer with render Id %d exist.", __FUNCTION__,
|
"%s: No renderer with render Id %d exist.", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (renderer->StartRender() != 0) {
|
||||||
if (ptrRender->StartRender() != 0)
|
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
int ViERenderImpl::StopRender(const int render_id) {
|
||||||
// StopRender
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
//
|
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||||
// Stop rendering a stream
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ViERenderImpl::StopRender(const int renderId)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo,
|
|
||||||
ViEId(instance_id_, renderId), "%s(channel: %d)", __FUNCTION__,
|
|
||||||
renderId);
|
|
||||||
|
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
ViERenderer* renderer = rs.Renderer(render_id);
|
||||||
if (ptrRender == NULL)
|
if (!renderer) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
// No renderer for this channel
|
"%s: No renderer with render_id %d exist.", __FUNCTION__,
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
render_id);
|
||||||
ViEId(instance_id_, renderId),
|
|
||||||
"%s: No renderer with renderId %d exist.", __FUNCTION__,
|
|
||||||
renderId);
|
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ptrRender->StopRender() != 0)
|
if (renderer->StopRender() != 0) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
int ViERenderImpl::ConfigureRender(int render_id, const unsigned int z_order,
|
||||||
// Stream configurations
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// ConfigureRender
|
|
||||||
//
|
|
||||||
// Reconfigures an already added render stream
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ViERenderImpl::ConfigureRender(int renderId, const unsigned int zOrder,
|
|
||||||
const float left, const float top,
|
const float left, const float top,
|
||||||
const float right, const float bottom)
|
const float right, const float bottom) {
|
||||||
{
|
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_, renderId),
|
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||||
"%s(channel: %d)", __FUNCTION__, renderId);
|
|
||||||
|
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
ViERenderer* renderer = rs.Renderer(render_id);
|
||||||
if (ptrRender == NULL)
|
if (!renderer) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
// No renderer for this channel
|
"%s: No renderer with render_id %d exist.", __FUNCTION__,
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
render_id);
|
||||||
ViEId(instance_id_, renderId),
|
|
||||||
"%s: No renderer with renderId %d exist.", __FUNCTION__,
|
|
||||||
renderId);
|
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptrRender->ConfigureRenderer(zOrder, left, top, right, bottom) != 0)
|
if (renderer->ConfigureRenderer(z_order, left, top, right, bottom) != 0) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
int ViERenderImpl::MirrorRenderStream(const int render_id, const bool enable,
|
||||||
// MirrorRenderStream
|
const bool mirror_xaxis,
|
||||||
//
|
const bool mirror_yaxis) {
|
||||||
// Enables mirror rendering
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int ViERenderImpl::MirrorRenderStream(const int renderId, const bool enable,
|
|
||||||
const bool mirrorXAxis,
|
|
||||||
const bool mirrorYAxis)
|
|
||||||
{
|
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
ViERenderer* renderer = rs.Renderer(render_id);
|
||||||
if (ptrRender == NULL)
|
if (!renderer) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
// No renderer for this channel
|
"%s: No renderer with render_id %d exist.", __FUNCTION__,
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
render_id);
|
||||||
ViEId(instance_id_, renderId),
|
|
||||||
"%s: No renderer with renderId %d exist.", __FUNCTION__,
|
|
||||||
renderId);
|
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ptrRender->EnableMirroring(renderId, enable, mirrorXAxis, mirrorYAxis)
|
if (renderer->EnableMirroring(render_id, enable, mirror_xaxis, mirror_yaxis)
|
||||||
!= 0)
|
!= 0) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
int ViERenderImpl::AddRenderer(const int render_id,
|
||||||
// External render
|
RawVideoType video_input_format,
|
||||||
// ============================================================================
|
ExternalRenderer* external_renderer) {
|
||||||
|
// Check if the client requested a format that we can convert the frames to.
|
||||||
|
if (video_input_format != kVideoI420 &&
|
||||||
// ----------------------------------------------------------------------------
|
video_input_format != kVideoYV12 &&
|
||||||
//
|
video_input_format != kVideoYUY2 &&
|
||||||
//
|
video_input_format != kVideoUYVY &&
|
||||||
// AddRenderer
|
video_input_format != kVideoARGB &&
|
||||||
// ----------------------------------------------------------------------------
|
video_input_format != kVideoRGB24 &&
|
||||||
|
video_input_format != kVideoRGB565 &&
|
||||||
int ViERenderImpl::AddRenderer(const int renderId,
|
video_input_format != kVideoARGB4444 &&
|
||||||
webrtc::RawVideoType videoInputFormat,
|
video_input_format != kVideoARGB1555) {
|
||||||
ExternalRenderer* externalRenderer)
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||||
{
|
|
||||||
// check if the client requested a format that we can convert the frames to
|
|
||||||
if (videoInputFormat != webrtc::kVideoI420
|
|
||||||
&& videoInputFormat != webrtc::kVideoYV12
|
|
||||||
&& videoInputFormat != webrtc::kVideoYUY2
|
|
||||||
&& videoInputFormat != webrtc::kVideoUYVY
|
|
||||||
&& videoInputFormat != webrtc::kVideoARGB
|
|
||||||
&& videoInputFormat != webrtc::kVideoRGB24
|
|
||||||
&& videoInputFormat != webrtc::kVideoRGB565
|
|
||||||
&& videoInputFormat != webrtc::kVideoARGB4444
|
|
||||||
&& videoInputFormat != webrtc::kVideoARGB1555)
|
|
||||||
{
|
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
|
||||||
ViEId(instance_id_, renderId),
|
|
||||||
"%s: Unsupported video frame format requested",
|
"%s: Unsupported video frame format requested",
|
||||||
__FUNCTION__, renderId);
|
__FUNCTION__, render_id);
|
||||||
SetLastError(kViERenderInvalidFrameFormat);
|
SetLastError(kViERenderInvalidFrameFormat);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Check if the renderer exist already
|
|
||||||
ViERenderManagerScoped rs(render_manager_);
|
|
||||||
if (rs.Renderer(renderId) != NULL)
|
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
// Verify the renderer exists.
|
||||||
|
ViERenderManagerScoped rs(render_manager_);
|
||||||
|
if (!rs.Renderer(render_id)) {
|
||||||
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderAlreadyExists);
|
SetLastError(kViERenderAlreadyExists);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (render_id >= kViEChannelIdBase && render_id <= kViEChannelIdMax) {
|
||||||
if (renderId >= kViEChannelIdBase && renderId <= kViEChannelIdMax)
|
// This is a channel.
|
||||||
{
|
|
||||||
// This is a channel
|
|
||||||
ViEChannelManagerScoped cm(channel_manager_);
|
ViEChannelManagerScoped cm(channel_manager_);
|
||||||
ViEFrameProviderBase* frameProvider = cm.Channel(renderId);
|
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||||
if (frameProvider == NULL)
|
if (!frame_provider) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
|
||||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ViERenderer* ptrRender = render_manager_.AddRenderStream(renderId, NULL,
|
ViERenderer* renderer = render_manager_.AddRenderStream(render_id, NULL,
|
||||||
0, 0.0f, 0.0f,
|
0, 0.0f, 0.0f,
|
||||||
1.0f, 1.0f);
|
1.0f, 1.0f);
|
||||||
if (ptrRender == NULL)
|
if (!renderer) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (-1 == ptrRender->SetExternalRenderer(renderId, videoInputFormat,
|
if (renderer->SetExternalRenderer(render_id, video_input_format,
|
||||||
externalRenderer))
|
external_renderer) == -1) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return frameProvider->RegisterFrameCallback(renderId, ptrRender);
|
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||||
}
|
} else {
|
||||||
else // camera or file
|
// Camera or file.
|
||||||
{
|
|
||||||
ViEInputManagerScoped is(input_manager_);
|
ViEInputManagerScoped is(input_manager_);
|
||||||
ViEFrameProviderBase* frameProvider = is.FrameProvider(renderId);
|
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
|
||||||
if (frameProvider == NULL)
|
if (!frame_provider) {
|
||||||
{
|
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
|
||||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||||
renderId);
|
render_id);
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ViERenderer* ptrRender = render_manager_.AddRenderStream(renderId, NULL,
|
ViERenderer* renderer = render_manager_.AddRenderStream(render_id, NULL,
|
||||||
0, 0.0f, 0.0f,
|
0, 0.0f, 0.0f,
|
||||||
1.0f, 1.0f);
|
1.0f, 1.0f);
|
||||||
if (ptrRender == NULL)
|
if (!renderer) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (-1 == ptrRender->SetExternalRenderer(renderId, videoInputFormat,
|
if (renderer->SetExternalRenderer(render_id, video_input_format,
|
||||||
externalRenderer))
|
external_renderer) == -1) {
|
||||||
{
|
|
||||||
SetLastError(kViERenderUnknownError);
|
SetLastError(kViERenderUnknownError);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return frameProvider->RegisterFrameCallback(renderId, ptrRender);
|
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||||
}
|
}
|
||||||
SetLastError(kViERenderInvalidRenderId);
|
SetLastError(kViERenderInvalidRenderId);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -8,70 +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_RENDER_IMPL_H_
|
||||||
* vie_render_impl.h
|
#define WEBRTC_VIDEO_ENGINE_VIE_RENDER_IMPL_H_
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RENDER_IMPL_H_
|
|
||||||
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RENDER_IMPL_H_
|
|
||||||
|
|
||||||
#include "vie_defines.h"
|
|
||||||
|
|
||||||
|
#include "modules/video_render/main/interface/video_render_defines.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "video_render_defines.h"
|
#include "video_engine/main/interface/vie_render.h"
|
||||||
#include "vie_ref_count.h"
|
#include "video_engine/vie_ref_count.h"
|
||||||
#include "vie_render.h"
|
#include "video_engine/vie_shared_data.h"
|
||||||
#include "vie_shared_data.h"
|
|
||||||
|
|
||||||
namespace webrtc
|
namespace webrtc {
|
||||||
{
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
class ViERenderImpl
|
||||||
// ViERenderImpl
|
: public virtual ViESharedData,
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class ViERenderImpl: public virtual ViESharedData,
|
|
||||||
public ViERender,
|
public ViERender,
|
||||||
public ViERefCount
|
public ViERefCount {
|
||||||
{
|
public:
|
||||||
public:
|
// Implements ViERender
|
||||||
virtual int Release();
|
virtual int Release();
|
||||||
|
virtual int RegisterVideoRenderModule(VideoRender& render_module);
|
||||||
// Registration of render module
|
virtual int DeRegisterVideoRenderModule(VideoRender& render_module);
|
||||||
virtual int RegisterVideoRenderModule(VideoRender& renderModule);
|
virtual int AddRenderer(const int render_id, void* window,
|
||||||
|
const unsigned int z_order, const float left,
|
||||||
virtual int DeRegisterVideoRenderModule(
|
|
||||||
VideoRender& renderModule);
|
|
||||||
|
|
||||||
// Add/remove renderer
|
|
||||||
virtual int AddRenderer(const int renderId, void* window,
|
|
||||||
const unsigned int zOrder, const float left,
|
|
||||||
const float top, const float right,
|
const float top, const float right,
|
||||||
const float bottom);
|
const float bottom);
|
||||||
|
virtual int RemoveRenderer(const int render_id);
|
||||||
virtual int RemoveRenderer(const int renderId);
|
virtual int StartRender(const int render_id);
|
||||||
|
virtual int StopRender(const int render_id);
|
||||||
// Start/stop
|
virtual int ConfigureRender(int render_id, const unsigned int z_order,
|
||||||
virtual int StartRender(const int renderId);
|
|
||||||
|
|
||||||
virtual int StopRender(const int renderId);
|
|
||||||
|
|
||||||
virtual int ConfigureRender(int renderId, const unsigned int zOrder,
|
|
||||||
const float left, const float top,
|
const float left, const float top,
|
||||||
const float right, const float bottom);
|
const float right, const float bottom);
|
||||||
|
virtual int MirrorRenderStream(const int render_id, const bool enable,
|
||||||
virtual int MirrorRenderStream(const int renderId, const bool enable,
|
const bool mirror_xaxis,
|
||||||
const bool mirrorXAxis,
|
const bool mirror_yaxis);
|
||||||
const bool mirrorYAxis);
|
virtual int AddRenderer(const int render_id, RawVideoType video_input_format,
|
||||||
|
|
||||||
// External render
|
|
||||||
virtual int AddRenderer(const int renderId,
|
|
||||||
webrtc::RawVideoType videoInputFormat,
|
|
||||||
ExternalRenderer* renderer);
|
ExternalRenderer* renderer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ViERenderImpl();
|
ViERenderImpl();
|
||||||
virtual ~ViERenderImpl();
|
virtual ~ViERenderImpl();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RENDER_IMPL_H_
|
#endif // WEBRTC_VIDEO_ENGINE_VIE_RENDER_IMPL_H_
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,150 +8,108 @@
|
|||||||
* 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_RTP_RTCP_IMPL_H_
|
||||||
* vie_rtp_rtcp_impl.h
|
#define WEBRTC_VIDEO_ENGINE_VIE_RTP_RTCP_IMPL_H_
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RTP_RTCP_IMPL_H_
|
#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||||
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RTP_RTCP_IMPL_H_
|
|
||||||
|
|
||||||
#include "vie_defines.h"
|
|
||||||
|
|
||||||
#include "rtp_rtcp_defines.h"
|
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "vie_ref_count.h"
|
#include "video_engine/main/interface/vie_rtp_rtcp.h"
|
||||||
#include "vie_rtp_rtcp.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 ViERTP_RTCPImpl
|
||||||
// ViERTP_RTCPImpl
|
: public virtual ViESharedData,
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class ViERTP_RTCPImpl : public virtual ViESharedData,
|
|
||||||
public ViERTP_RTCP,
|
public ViERTP_RTCP,
|
||||||
public ViERefCount
|
public ViERefCount {
|
||||||
{
|
public:
|
||||||
public:
|
// Implements ViERTP_RTCP
|
||||||
virtual int Release();
|
virtual int Release();
|
||||||
|
virtual int SetLocalSSRC(const int video_channel,
|
||||||
// SSRC/CSRC
|
|
||||||
virtual int SetLocalSSRC(const int videoChannel,
|
|
||||||
const unsigned int SSRC,
|
const unsigned int SSRC,
|
||||||
const StreamType usage,
|
const StreamType usage,
|
||||||
const unsigned char simulcastIdx);
|
const unsigned char simulcast_idx);
|
||||||
|
virtual int GetLocalSSRC(const int video_channel, unsigned int& SSRC) const;
|
||||||
virtual int GetLocalSSRC(const int videoChannel, unsigned int& SSRC) const;
|
virtual int SetRemoteSSRCType(const int video_channel,
|
||||||
|
|
||||||
virtual int SetRemoteSSRCType(const int videoChannel,
|
|
||||||
const StreamType usage,
|
const StreamType usage,
|
||||||
const unsigned int SSRC) const;
|
const unsigned int SSRC) const;
|
||||||
|
virtual int GetRemoteSSRC(const int video_channel, unsigned int& SSRC) const;
|
||||||
virtual int GetRemoteSSRC(const int videoChannel, unsigned int& SSRC) const;
|
virtual int GetRemoteCSRCs(const int video_channel,
|
||||||
|
|
||||||
virtual int GetRemoteCSRCs(const int videoChannel,
|
|
||||||
unsigned int CSRCs[kRtpCsrcSize]) const;
|
unsigned int CSRCs[kRtpCsrcSize]) const;
|
||||||
|
virtual int SetStartSequenceNumber(const int video_channel,
|
||||||
virtual int SetStartSequenceNumber(const int videoChannel,
|
unsigned short sequence_number);
|
||||||
unsigned short sequenceNumber);
|
virtual int SetRTCPStatus(const int video_channel,
|
||||||
|
const ViERTCPMode rtcp_mode);
|
||||||
// RTCP
|
virtual int GetRTCPStatus(const int video_channel,
|
||||||
virtual int SetRTCPStatus(const int videoChannel,
|
ViERTCPMode& rtcp_mode) const;
|
||||||
const ViERTCPMode rtcpMode);
|
virtual int SetRTCPCName(const int video_channel,
|
||||||
|
const char rtcp_cname[KMaxRTCPCNameLength]);
|
||||||
virtual int GetRTCPStatus(const int videoChannel, ViERTCPMode& rtcpMode);
|
virtual int GetRTCPCName(const int video_channel,
|
||||||
|
char rtcp_cname[KMaxRTCPCNameLength]) const;
|
||||||
virtual int SetRTCPCName(const int videoChannel,
|
virtual int GetRemoteRTCPCName(const int video_channel,
|
||||||
const char rtcpCName[KMaxRTCPCNameLength]);
|
char rtcp_cname[KMaxRTCPCNameLength]) const;
|
||||||
|
virtual int SendApplicationDefinedRTCPPacket(
|
||||||
virtual int GetRTCPCName(const int videoChannel,
|
const int video_channel,
|
||||||
char rtcpCName[KMaxRTCPCNameLength]);
|
const unsigned char sub_type,
|
||||||
|
unsigned int name,
|
||||||
virtual int GetRemoteRTCPCName(const int videoChannel,
|
const char* data,
|
||||||
char rtcpCName[KMaxRTCPCNameLength]) const;
|
unsigned short data_length_in_bytes);
|
||||||
|
virtual int SetNACKStatus(const int video_channel, const bool enable);
|
||||||
virtual int
|
virtual int SetFECStatus(const int video_channel, const bool enable,
|
||||||
SendApplicationDefinedRTCPPacket(const int videoChannel,
|
const unsigned char payload_typeRED,
|
||||||
const unsigned char subType,
|
const unsigned char payload_typeFEC);
|
||||||
unsigned int name, const char* data,
|
virtual int SetHybridNACKFECStatus(const int video_channel, const bool enable,
|
||||||
unsigned short dataLengthInBytes);
|
const unsigned char payload_typeRED,
|
||||||
|
const unsigned char payload_typeFEC);
|
||||||
virtual int SetNACKStatus(const int videoChannel, const bool enable);
|
virtual int SetKeyFrameRequestMethod(const int video_channel,
|
||||||
|
|
||||||
virtual int SetFECStatus(const int videoChannel, const bool enable,
|
|
||||||
const unsigned char payloadTypeRED,
|
|
||||||
const unsigned char payloadTypeFEC);
|
|
||||||
virtual int SetHybridNACKFECStatus(const int videoChannel, const bool enable,
|
|
||||||
const unsigned char payloadTypeRED,
|
|
||||||
const unsigned char payloadTypeFEC);
|
|
||||||
|
|
||||||
virtual int SetKeyFrameRequestMethod(const int videoChannel,
|
|
||||||
const ViEKeyFrameRequestMethod method);
|
const ViEKeyFrameRequestMethod method);
|
||||||
|
virtual int SetTMMBRStatus(const int video_channel, const bool enable);
|
||||||
virtual int SetTMMBRStatus(const int videoChannel, const bool enable);
|
virtual int GetReceivedRTCPStatistics(const int video_channel,
|
||||||
|
unsigned short& fraction_lost,
|
||||||
// Statistics
|
unsigned int& cumulative_lost,
|
||||||
virtual int GetReceivedRTCPStatistics(
|
unsigned int& extended_max,
|
||||||
const int videoChannel, unsigned short& fractionLost,
|
unsigned int& jitter,
|
||||||
unsigned int& cumulativeLost, unsigned int& extendedMax,
|
int& rtt_ms) const;
|
||||||
unsigned int& jitter, int& rttMs) const;
|
virtual int GetSentRTCPStatistics(const int video_channel,
|
||||||
|
unsigned short& fraction_lost,
|
||||||
virtual int GetSentRTCPStatistics(const int videoChannel,
|
unsigned int& cumulative_lost,
|
||||||
unsigned short& fractionLost,
|
unsigned int& extended_max,
|
||||||
unsigned int& cumulativeLost,
|
unsigned int& jitter, int& rtt_ms) const;
|
||||||
unsigned int& extendedMax,
|
virtual int GetRTPStatistics(const int video_channel,
|
||||||
unsigned int& jitter, int& rttMs) const;
|
unsigned int& bytes_sent,
|
||||||
|
unsigned int& packets_sent,
|
||||||
virtual int GetRTPStatistics(const int videoChannel,
|
unsigned int& bytes_received,
|
||||||
unsigned int& bytesSent,
|
unsigned int& packets_received) const;
|
||||||
unsigned int& packetsSent,
|
virtual int GetBandwidthUsage(const int video_channel,
|
||||||
unsigned int& bytesReceived,
|
unsigned int& total_bitrate_sent,
|
||||||
unsigned int& packetsReceived) const;
|
unsigned int& video_bitrate_sent,
|
||||||
|
unsigned int& fec_bitrate_sent,
|
||||||
virtual int GetBandwidthUsage(const int videoChannel,
|
|
||||||
unsigned int& totalBitrateSent,
|
|
||||||
unsigned int& videoBitrateSent,
|
|
||||||
unsigned int& fecBitrateSent,
|
|
||||||
unsigned int& nackBitrateSent) const;
|
unsigned int& nackBitrateSent) const;
|
||||||
|
|
||||||
// Keep alive
|
|
||||||
virtual int SetRTPKeepAliveStatus(
|
virtual int SetRTPKeepAliveStatus(
|
||||||
const int videoChannel, bool enable, const char unknownPayloadType,
|
const int video_channel, bool enable, const char unknown_payload_type,
|
||||||
const unsigned int deltaTransmitTimeSeconds);
|
const unsigned int delta_transmit_time_seconds);
|
||||||
|
virtual int GetRTPKeepAliveStatus(
|
||||||
virtual int GetRTPKeepAliveStatus(const int videoChannel, bool& enabled,
|
const int video_channel,
|
||||||
char& unkownPayloadType,
|
bool& enabled,
|
||||||
unsigned int& deltaTransmitTimeSeconds);
|
char& unkown_payload_type,
|
||||||
|
unsigned int& delta_transmit_time_seconds) const;
|
||||||
// Dump RTP stream, for debug purpose
|
virtual int StartRTPDump(const int video_channel,
|
||||||
virtual int StartRTPDump(const int videoChannel,
|
const char file_nameUTF8[1024],
|
||||||
const char fileNameUTF8[1024],
|
|
||||||
RTPDirections direction);
|
RTPDirections direction);
|
||||||
|
virtual int StopRTPDump(const int video_channel, RTPDirections direction);
|
||||||
virtual int StopRTPDump(const int videoChannel, RTPDirections direction);
|
virtual int RegisterRTPObserver(const int video_channel,
|
||||||
|
|
||||||
// Callbacks
|
|
||||||
virtual int RegisterRTPObserver(const int videoChannel,
|
|
||||||
ViERTPObserver& observer);
|
ViERTPObserver& observer);
|
||||||
|
virtual int DeregisterRTPObserver(const int video_channel);
|
||||||
virtual int DeregisterRTPObserver(const int videoChannel);
|
virtual int RegisterRTCPObserver(const int video_channel,
|
||||||
|
|
||||||
virtual int RegisterRTCPObserver(const int videoChannel,
|
|
||||||
ViERTCPObserver& observer);
|
ViERTCPObserver& observer);
|
||||||
|
virtual int DeregisterRTCPObserver(const int video_channel);
|
||||||
|
|
||||||
virtual int DeregisterRTCPObserver(const int videoChannel);
|
protected:
|
||||||
|
|
||||||
protected:
|
|
||||||
ViERTP_RTCPImpl();
|
ViERTP_RTCPImpl();
|
||||||
virtual ~ViERTP_RTCPImpl();
|
virtual ~ViERTP_RTCPImpl();
|
||||||
|
|
||||||
private:
|
|
||||||
RTCPMethod ViERTCPModeToRTCPMethod(ViERTCPMode apiMode);
|
|
||||||
ViERTCPMode RTCPMethodToViERTCPMode(RTCPMethod moduleMethod);
|
|
||||||
KeyFrameRequestMethod
|
|
||||||
APIRequestToModuleRequest(const ViEKeyFrameRequestMethod apiMethod);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RTP_RTCP_IMPL_H_
|
|
||||||
|
#endif // WEBRTC_VIDEO_ENGINE_VIE_RTP_RTCP_IMPL_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user