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.
|
||||
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
|
||||
// on a specific channel.
|
||||
@ -172,7 +172,7 @@ public:
|
||||
// This function gets the RTCP canonical name (CNAME) for the RTCP reports
|
||||
// sent the specified channel.
|
||||
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
|
||||
// received on the specified channel.
|
||||
@ -260,7 +260,7 @@ public:
|
||||
// This function gets the RTP keep-alive status.
|
||||
virtual int GetRTPKeepAliveStatus(
|
||||
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
|
||||
// specific channel and for a given direction. The file can later be
|
||||
|
@ -8,557 +8,386 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
* vie_render_impl.cc
|
||||
*/
|
||||
#include "video_engine/vie_render_impl.h"
|
||||
|
||||
#include "vie_render_impl.h"
|
||||
|
||||
// Defines
|
||||
#include "engine_configurations.h"
|
||||
#include "vie_defines.h"
|
||||
|
||||
#include "trace.h"
|
||||
#include "video_render.h"
|
||||
#include "video_render_defines.h"
|
||||
#include "vie_errors.h"
|
||||
#include "vie_impl.h"
|
||||
#include "vie_capturer.h"
|
||||
#include "vie_channel.h"
|
||||
#include "vie_frame_provider_base.h"
|
||||
#include "vie_channel_manager.h"
|
||||
#include "vie_input_manager.h"
|
||||
#include "vie_render_manager.h"
|
||||
#include "modules/video_render/main/interface/video_render.h"
|
||||
#include "modules/video_render/main/interface/video_render_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_frame_provider_base.h"
|
||||
#include "video_engine/vie_impl.h"
|
||||
#include "video_engine/vie_input_manager.h"
|
||||
#include "video_engine/vie_render_manager.h"
|
||||
#include "video_engine/vie_renderer.h"
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
namespace webrtc {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetInterface
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ViERender* ViERender::GetInterface(VideoEngine* videoEngine)
|
||||
{
|
||||
ViERender* ViERender::GetInterface(VideoEngine* video_engine) {
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_RENDER_API
|
||||
if (videoEngine == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
VideoEngineImpl* vieImpl = reinterpret_cast<VideoEngineImpl*> (videoEngine);
|
||||
ViERenderImpl* vieRenderImpl = vieImpl;
|
||||
(*vieRenderImpl)++; // Increase ref count
|
||||
|
||||
return vieRenderImpl;
|
||||
#else
|
||||
if (!video_engine) {
|
||||
return NULL;
|
||||
}
|
||||
VideoEngineImpl* vie_impl = reinterpret_cast<VideoEngineImpl*>(video_engine);
|
||||
ViERenderImpl* vie_render_impl = vie_impl;
|
||||
// Increase ref count.
|
||||
(*vie_render_impl)++;
|
||||
return vie_render_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 ViERenderImpl::Release()
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, instance_id_,
|
||||
"ViERender::Release()");
|
||||
(*this)--; // Decrease ref count
|
||||
|
||||
WebRtc_Word32 refCount = GetCount();
|
||||
if (refCount < 0)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, instance_id_,
|
||||
"ViERender release too many times");
|
||||
// SetLastError()
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo, instance_id_,
|
||||
"ViERender reference count: %d", refCount);
|
||||
return refCount;
|
||||
int ViERenderImpl::Release() {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, instance_id_,
|
||||
"ViERender::Release()");
|
||||
// Decrease ref count
|
||||
(*this)--;
|
||||
WebRtc_Word32 ref_count = GetCount();
|
||||
if (ref_count < 0) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, instance_id_,
|
||||
"ViERender release too many times");
|
||||
return -1;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVideo, instance_id_,
|
||||
"ViERender reference count: %d", ref_count);
|
||||
return ref_count;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Constructor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ViERenderImpl::ViERenderImpl()
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, instance_id_,
|
||||
"ViERenderImpl::ViERenderImpl() Ctor");
|
||||
ViERenderImpl::ViERenderImpl() {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, instance_id_,
|
||||
"ViERenderImpl::ViERenderImpl() Ctor");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Destructor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
ViERenderImpl::~ViERenderImpl()
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo, instance_id_,
|
||||
"ViERenderImpl::~ViERenderImpl() Dtor");
|
||||
ViERenderImpl::~ViERenderImpl() {
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceVideo, instance_id_,
|
||||
"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(
|
||||
VideoRender& renderModule)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s (&renderModule: %p)", __FUNCTION__, &renderModule);
|
||||
|
||||
if (render_manager_.RegisterVideoRenderModule(renderModule) != 0)
|
||||
{
|
||||
// Error logging is done in RegisterVideoRenderModule
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
VideoRender& render_module) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||
"%s (&render_module: %p)", __FUNCTION__, &render_module);
|
||||
if (render_manager_.RegisterVideoRenderModule(render_module) != 0) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
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(
|
||||
VideoRender& renderModule)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s (&renderModule: %p)", __FUNCTION__, &renderModule);
|
||||
if (render_manager_.DeRegisterVideoRenderModule(renderModule) != 0)
|
||||
{
|
||||
// Error logging is done in DeRegisterVideoRenderModule
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
VideoRender& render_module) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||
"%s (&render_module: %p)", __FUNCTION__, &render_module);
|
||||
if (render_manager_.DeRegisterVideoRenderModule(render_module) != 0) {
|
||||
// Error logging is done in ViERenderManager::DeRegisterVideoRenderModule.
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Add renderer
|
||||
// ============================================================================
|
||||
|
||||
int ViERenderImpl::AddRenderer(const int renderId, void* window,
|
||||
const unsigned int zOrder, const float left,
|
||||
int ViERenderImpl::AddRenderer(const int render_id, void* window,
|
||||
const unsigned int z_order, const float left,
|
||||
const float top, const float right,
|
||||
const float bottom)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s (renderId: %d, window: 0x%p, zOrder: %u, left: %f, "
|
||||
"top: %f, right: %f, bottom: %f)",
|
||||
__FUNCTION__, renderId, window, zOrder, left, top, right,
|
||||
bottom);
|
||||
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 float bottom) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||
"%s (render_id: %d, window: 0x%p, z_order: %u, left: %f, "
|
||||
"top: %f, right: %f, bottom: %f)",
|
||||
__FUNCTION__, render_id, window, z_order, left, top, right,
|
||||
bottom);
|
||||
if (!Initialized()) {
|
||||
SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
instance_id_);
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
if (rs.Renderer(render_id) != NULL) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderAlreadyExists);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (render_id >= kViEChannelIdBase && render_id <= kViEChannelIdMax) {
|
||||
// This is a channel.
|
||||
ViEChannelManagerScoped cm(channel_manager_);
|
||||
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||
if (!frame_provider) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* renderer = render_manager_.AddRenderStream(render_id,
|
||||
window, z_order,
|
||||
left, top,
|
||||
right, bottom);
|
||||
if (!renderer) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||
} else {
|
||||
// Camera or file.
|
||||
ViEInputManagerScoped is(input_manager_);
|
||||
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
|
||||
if (!frame_provider) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* renderer = render_manager_.AddRenderStream(render_id,
|
||||
window, z_order,
|
||||
left, top,
|
||||
right, bottom);
|
||||
if (!renderer) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||
}
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
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_),
|
||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderAlreadyExists);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
int ViERenderImpl::RemoveRenderer(const int render_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_),
|
||||
"%s(render_id: %d)", __FUNCTION__, render_id);
|
||||
if (!Initialized()) {
|
||||
SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
instance_id_);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (renderId >= kViEChannelIdBase && renderId <= kViEChannelIdMax)
|
||||
{
|
||||
// This is a channel
|
||||
ViEChannelManagerScoped cm(channel_manager_);
|
||||
ViEFrameProviderBase* frameProvider = cm.Channel(renderId);
|
||||
if (frameProvider == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* renderer = render_manager_.AddRenderStream(renderId,
|
||||
window, zOrder,
|
||||
left, top,
|
||||
right, bottom);
|
||||
if (renderer == NULL)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return frameProvider->RegisterFrameCallback(renderId, renderer);
|
||||
ViERenderer* renderer = NULL;
|
||||
{
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
renderer = rs.Renderer(render_id);
|
||||
if (!renderer) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(instance_id_),
|
||||
"%s No render exist with render_id: %d", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
else // camera or file
|
||||
{
|
||||
ViEInputManagerScoped is(input_manager_);
|
||||
ViEFrameProviderBase* frameProvider = is.FrameProvider(renderId);
|
||||
if (frameProvider == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* renderer = render_manager_.AddRenderStream(renderId,
|
||||
window, zOrder,
|
||||
left, top,
|
||||
right, bottom);
|
||||
if (renderer == NULL)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return frameProvider->RegisterFrameCallback(renderId, renderer);
|
||||
// Leave the scope lock since we don't want to lock two managers
|
||||
// simultanousely.
|
||||
}
|
||||
if (render_id >= kViEChannelIdBase && render_id <= kViEChannelIdMax) {
|
||||
// This is a channel.
|
||||
ViEChannelManagerScoped cm(channel_manager_);
|
||||
ViEChannel* channel = cm.Channel(render_id);
|
||||
if (!channel) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(instance_id_),
|
||||
"%s: no channel with id %d exists ", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
channel->DeregisterFrameCallback(renderer);
|
||||
} else {
|
||||
// Provider owned by inputmanager, i.e. file or capture device.
|
||||
ViEInputManagerScoped is(input_manager_);
|
||||
ViEFrameProviderBase* provider = is.FrameProvider(render_id);
|
||||
if (!provider) {
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(instance_id_),
|
||||
"%s: no provider with id %d exists ", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
provider->DeregisterFrameCallback(renderer);
|
||||
}
|
||||
if (render_manager_.RemoveRenderStream(render_id) != 0) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViERenderImpl::StartRender(const int render_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
if (!renderer) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s: No renderer with render Id %d exist.", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
|
||||
}
|
||||
if (renderer->StartRender() != 0) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViERenderImpl::RemoveRenderer(const int renderId)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s(renderId: %d)", __FUNCTION__, renderId);
|
||||
if (!Initialized())
|
||||
{
|
||||
SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
instance_id_);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ViERenderer* renderer = NULL;
|
||||
{
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
renderer = rs.Renderer(renderId);
|
||||
if (!renderer)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s No render exist with renderId: %d", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
} // Leave the scope lock since we don't want to lock two managers
|
||||
// simultanousely
|
||||
|
||||
if (renderId >= kViEChannelIdBase && renderId <= kViEChannelIdMax)
|
||||
{
|
||||
// This is a channel
|
||||
ViEChannelManagerScoped cm(channel_manager_);
|
||||
ViEChannel* channel = cm.Channel(renderId);
|
||||
if (!channel)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s: no channel with id %d exists ", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
channel->DeregisterFrameCallback(renderer);
|
||||
}
|
||||
else //Provider owned by inputmanager - ie file or capture device
|
||||
{
|
||||
ViEInputManagerScoped is(input_manager_);
|
||||
ViEFrameProviderBase* provider = is.FrameProvider(renderId);
|
||||
if (!provider)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s: no provider with id %d exists ", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
provider->DeregisterFrameCallback(renderer);
|
||||
|
||||
}
|
||||
if (render_manager_.RemoveRenderStream(renderId) != 0)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
int ViERenderImpl::StopRender(const int render_id) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
if (!renderer) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s: No renderer with render_id %d exist.", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
if (renderer->StopRender() != 0) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Start/stop
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// 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_);
|
||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
||||
if (ptrRender == NULL)
|
||||
{
|
||||
// No renderer for this channel
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
||||
ViEId(instance_id_, renderId),
|
||||
"%s: No renderer with render Id %d exist.", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ptrRender->StartRender() != 0)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StopRender
|
||||
//
|
||||
// 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_);
|
||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
||||
if (ptrRender == NULL)
|
||||
{
|
||||
// No renderer for this channel
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
||||
ViEId(instance_id_, renderId),
|
||||
"%s: No renderer with renderId %d exist.", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
if (ptrRender->StopRender() != 0)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Stream configurations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ConfigureRender
|
||||
//
|
||||
// Reconfigures an already added render stream
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int ViERenderImpl::ConfigureRender(int renderId, const unsigned int zOrder,
|
||||
int ViERenderImpl::ConfigureRender(int render_id, const unsigned int z_order,
|
||||
const float left, const float top,
|
||||
const float right, const float bottom)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceApiCall, webrtc::kTraceVideo, ViEId(instance_id_, renderId),
|
||||
"%s(channel: %d)", __FUNCTION__, renderId);
|
||||
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
||||
if (ptrRender == NULL)
|
||||
{
|
||||
// No renderer for this channel
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
||||
ViEId(instance_id_, renderId),
|
||||
"%s: No renderer with renderId %d exist.", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ptrRender->ConfigureRenderer(zOrder, left, top, right, bottom) != 0)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MirrorRenderStream
|
||||
//
|
||||
// Enables mirror rendering
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int ViERenderImpl::MirrorRenderStream(const int renderId, const bool enable,
|
||||
const bool mirrorXAxis,
|
||||
const bool mirrorYAxis)
|
||||
{
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
ViERenderer* ptrRender = rs.Renderer(renderId);
|
||||
if (ptrRender == NULL)
|
||||
{
|
||||
// No renderer for this channel
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,
|
||||
ViEId(instance_id_, renderId),
|
||||
"%s: No renderer with renderId %d exist.", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
if (ptrRender->EnableMirroring(renderId, enable, mirrorXAxis, mirrorYAxis)
|
||||
!= 0)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// External render
|
||||
// ============================================================================
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// AddRenderer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int ViERenderImpl::AddRenderer(const int renderId,
|
||||
webrtc::RawVideoType videoInputFormat,
|
||||
ExternalRenderer* externalRenderer)
|
||||
{
|
||||
// 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",
|
||||
__FUNCTION__, renderId);
|
||||
SetLastError(kViERenderInvalidFrameFormat);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!Initialized())
|
||||
{
|
||||
SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
instance_id_);
|
||||
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_),
|
||||
"%s - Renderer already exist %d.", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderAlreadyExists);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (renderId >= kViEChannelIdBase && renderId <= kViEChannelIdMax)
|
||||
{
|
||||
// This is a channel
|
||||
ViEChannelManagerScoped cm(channel_manager_);
|
||||
ViEFrameProviderBase* frameProvider = cm.Channel(renderId);
|
||||
if (frameProvider == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* ptrRender = render_manager_.AddRenderStream(renderId, NULL,
|
||||
0, 0.0f, 0.0f,
|
||||
1.0f, 1.0f);
|
||||
if (ptrRender == NULL)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
if (-1 == ptrRender->SetExternalRenderer(renderId, videoInputFormat,
|
||||
externalRenderer))
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return frameProvider->RegisterFrameCallback(renderId, ptrRender);
|
||||
}
|
||||
else // camera or file
|
||||
{
|
||||
ViEInputManagerScoped is(input_manager_);
|
||||
ViEFrameProviderBase* frameProvider = is.FrameProvider(renderId);
|
||||
if (frameProvider == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
renderId);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* ptrRender = render_manager_.AddRenderStream(renderId, NULL,
|
||||
0, 0.0f, 0.0f,
|
||||
1.0f, 1.0f);
|
||||
if (ptrRender == NULL)
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
if (-1 == ptrRender->SetExternalRenderer(renderId, videoInputFormat,
|
||||
externalRenderer))
|
||||
{
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return frameProvider->RegisterFrameCallback(renderId, ptrRender);
|
||||
}
|
||||
const float right, const float bottom) {
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s(channel: %d)", __FUNCTION__, render_id);
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
if (!renderer) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s: No renderer with render_id %d exist.", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (renderer->ConfigureRenderer(z_order, left, top, right, bottom) != 0) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
int ViERenderImpl::MirrorRenderStream(const int render_id, const bool enable,
|
||||
const bool mirror_xaxis,
|
||||
const bool mirror_yaxis) {
|
||||
ViERenderManagerScoped rs(render_manager_);
|
||||
ViERenderer* renderer = rs.Renderer(render_id);
|
||||
if (!renderer) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s: No renderer with render_id %d exist.", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
if (renderer->EnableMirroring(render_id, enable, mirror_xaxis, mirror_yaxis)
|
||||
!= 0) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ViERenderImpl::AddRenderer(const int render_id,
|
||||
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 &&
|
||||
video_input_format != kVideoARGB &&
|
||||
video_input_format != kVideoRGB24 &&
|
||||
video_input_format != kVideoRGB565 &&
|
||||
video_input_format != kVideoARGB4444 &&
|
||||
video_input_format != kVideoARGB1555) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_, render_id),
|
||||
"%s: Unsupported video frame format requested",
|
||||
__FUNCTION__, render_id);
|
||||
SetLastError(kViERenderInvalidFrameFormat);
|
||||
return -1;
|
||||
}
|
||||
if (!Initialized()) {
|
||||
SetLastError(kViENotInitialized);
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s - ViE instance %d not initialized", __FUNCTION__,
|
||||
instance_id_);
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
// 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__,
|
||||
render_id);
|
||||
SetLastError(kViERenderAlreadyExists);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (render_id >= kViEChannelIdBase && render_id <= kViEChannelIdMax) {
|
||||
// This is a channel.
|
||||
ViEChannelManagerScoped cm(channel_manager_);
|
||||
ViEFrameProviderBase* frame_provider = cm.Channel(render_id);
|
||||
if (!frame_provider) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* renderer = render_manager_.AddRenderStream(render_id, NULL,
|
||||
0, 0.0f, 0.0f,
|
||||
1.0f, 1.0f);
|
||||
if (!renderer) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
if (renderer->SetExternalRenderer(render_id, video_input_format,
|
||||
external_renderer) == -1) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||
} else {
|
||||
// Camera or file.
|
||||
ViEInputManagerScoped is(input_manager_);
|
||||
ViEFrameProviderBase* frame_provider = is.FrameProvider(render_id);
|
||||
if (!frame_provider) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(instance_id_),
|
||||
"%s: FrameProvider id %d doesn't exist", __FUNCTION__,
|
||||
render_id);
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
ViERenderer* renderer = render_manager_.AddRenderStream(render_id, NULL,
|
||||
0, 0.0f, 0.0f,
|
||||
1.0f, 1.0f);
|
||||
if (!renderer) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
if (renderer->SetExternalRenderer(render_id, video_input_format,
|
||||
external_renderer) == -1) {
|
||||
SetLastError(kViERenderUnknownError);
|
||||
return -1;
|
||||
}
|
||||
return frame_provider->RegisterFrameCallback(render_id, renderer);
|
||||
}
|
||||
SetLastError(kViERenderInvalidRenderId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -8,70 +8,46 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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"
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_VIE_RENDER_IMPL_H_
|
||||
#define WEBRTC_VIDEO_ENGINE_VIE_RENDER_IMPL_H_
|
||||
|
||||
#include "modules/video_render/main/interface/video_render_defines.h"
|
||||
#include "typedefs.h"
|
||||
#include "video_render_defines.h"
|
||||
#include "vie_ref_count.h"
|
||||
#include "vie_render.h"
|
||||
#include "vie_shared_data.h"
|
||||
#include "video_engine/main/interface/vie_render.h"
|
||||
#include "video_engine/vie_ref_count.h"
|
||||
#include "video_engine/vie_shared_data.h"
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
namespace webrtc {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ViERenderImpl
|
||||
// ----------------------------------------------------------------------------
|
||||
class ViERenderImpl
|
||||
: public virtual ViESharedData,
|
||||
public ViERender,
|
||||
public ViERefCount {
|
||||
public:
|
||||
// Implements ViERender
|
||||
virtual int Release();
|
||||
virtual int RegisterVideoRenderModule(VideoRender& render_module);
|
||||
virtual int DeRegisterVideoRenderModule(VideoRender& render_module);
|
||||
virtual int AddRenderer(const int render_id, void* window,
|
||||
const unsigned int z_order, const float left,
|
||||
const float top, const float right,
|
||||
const float bottom);
|
||||
virtual int RemoveRenderer(const int render_id);
|
||||
virtual int StartRender(const int render_id);
|
||||
virtual int StopRender(const int render_id);
|
||||
virtual int ConfigureRender(int render_id, const unsigned int z_order,
|
||||
const float left, const float top,
|
||||
const float right, const float bottom);
|
||||
virtual int MirrorRenderStream(const int render_id, const bool enable,
|
||||
const bool mirror_xaxis,
|
||||
const bool mirror_yaxis);
|
||||
virtual int AddRenderer(const int render_id, RawVideoType video_input_format,
|
||||
ExternalRenderer* renderer);
|
||||
|
||||
class ViERenderImpl: public virtual ViESharedData,
|
||||
public ViERender,
|
||||
public ViERefCount
|
||||
{
|
||||
public:
|
||||
virtual int Release();
|
||||
|
||||
// Registration of render module
|
||||
virtual int RegisterVideoRenderModule(VideoRender& renderModule);
|
||||
|
||||
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 bottom);
|
||||
|
||||
virtual int RemoveRenderer(const int renderId);
|
||||
|
||||
// Start/stop
|
||||
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 right, const float bottom);
|
||||
|
||||
virtual int MirrorRenderStream(const int renderId, const bool enable,
|
||||
const bool mirrorXAxis,
|
||||
const bool mirrorYAxis);
|
||||
|
||||
// External render
|
||||
virtual int AddRenderer(const int renderId,
|
||||
webrtc::RawVideoType videoInputFormat,
|
||||
ExternalRenderer* renderer);
|
||||
|
||||
protected:
|
||||
ViERenderImpl();
|
||||
virtual ~ViERenderImpl();
|
||||
protected:
|
||||
ViERenderImpl();
|
||||
virtual ~ViERenderImpl();
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RENDER_IMPL_H_
|
||||
|
||||
} // namespace webrtc
|
||||
#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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* vie_rtp_rtcp_impl.h
|
||||
*/
|
||||
#ifndef WEBRTC_VIDEO_ENGINE_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_
|
||||
#define WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RTP_RTCP_IMPL_H_
|
||||
|
||||
#include "vie_defines.h"
|
||||
|
||||
#include "rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "typedefs.h"
|
||||
#include "vie_ref_count.h"
|
||||
#include "vie_rtp_rtcp.h"
|
||||
#include "vie_shared_data.h"
|
||||
#include "video_engine/main/interface/vie_rtp_rtcp.h"
|
||||
#include "video_engine/vie_ref_count.h"
|
||||
#include "video_engine/vie_shared_data.h"
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
namespace webrtc {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ViERTP_RTCPImpl
|
||||
// ----------------------------------------------------------------------------
|
||||
class ViERTP_RTCPImpl
|
||||
: public virtual ViESharedData,
|
||||
public ViERTP_RTCP,
|
||||
public ViERefCount {
|
||||
public:
|
||||
// Implements ViERTP_RTCP
|
||||
virtual int Release();
|
||||
virtual int SetLocalSSRC(const int video_channel,
|
||||
const unsigned int SSRC,
|
||||
const StreamType usage,
|
||||
const unsigned char simulcast_idx);
|
||||
virtual int GetLocalSSRC(const int video_channel, unsigned int& SSRC) const;
|
||||
virtual int SetRemoteSSRCType(const int video_channel,
|
||||
const StreamType usage,
|
||||
const unsigned int SSRC) const;
|
||||
virtual int GetRemoteSSRC(const int video_channel, unsigned int& SSRC) const;
|
||||
virtual int GetRemoteCSRCs(const int video_channel,
|
||||
unsigned int CSRCs[kRtpCsrcSize]) const;
|
||||
virtual int SetStartSequenceNumber(const int video_channel,
|
||||
unsigned short sequence_number);
|
||||
virtual int SetRTCPStatus(const int video_channel,
|
||||
const ViERTCPMode rtcp_mode);
|
||||
virtual int GetRTCPStatus(const int video_channel,
|
||||
ViERTCPMode& rtcp_mode) const;
|
||||
virtual int SetRTCPCName(const int video_channel,
|
||||
const char rtcp_cname[KMaxRTCPCNameLength]);
|
||||
virtual int GetRTCPCName(const int video_channel,
|
||||
char rtcp_cname[KMaxRTCPCNameLength]) const;
|
||||
virtual int GetRemoteRTCPCName(const int video_channel,
|
||||
char rtcp_cname[KMaxRTCPCNameLength]) const;
|
||||
virtual int SendApplicationDefinedRTCPPacket(
|
||||
const int video_channel,
|
||||
const unsigned char sub_type,
|
||||
unsigned int name,
|
||||
const char* data,
|
||||
unsigned short data_length_in_bytes);
|
||||
virtual int SetNACKStatus(const int video_channel, const bool enable);
|
||||
virtual int SetFECStatus(const int video_channel, const bool enable,
|
||||
const unsigned char payload_typeRED,
|
||||
const unsigned char payload_typeFEC);
|
||||
virtual int SetHybridNACKFECStatus(const int video_channel, const bool enable,
|
||||
const unsigned char payload_typeRED,
|
||||
const unsigned char payload_typeFEC);
|
||||
virtual int SetKeyFrameRequestMethod(const int video_channel,
|
||||
const ViEKeyFrameRequestMethod method);
|
||||
virtual int SetTMMBRStatus(const int video_channel, const bool enable);
|
||||
virtual int GetReceivedRTCPStatistics(const int video_channel,
|
||||
unsigned short& fraction_lost,
|
||||
unsigned int& cumulative_lost,
|
||||
unsigned int& extended_max,
|
||||
unsigned int& jitter,
|
||||
int& rtt_ms) const;
|
||||
virtual int GetSentRTCPStatistics(const int video_channel,
|
||||
unsigned short& fraction_lost,
|
||||
unsigned int& cumulative_lost,
|
||||
unsigned int& extended_max,
|
||||
unsigned int& jitter, int& rtt_ms) const;
|
||||
virtual int GetRTPStatistics(const int video_channel,
|
||||
unsigned int& bytes_sent,
|
||||
unsigned int& packets_sent,
|
||||
unsigned int& bytes_received,
|
||||
unsigned int& packets_received) const;
|
||||
virtual int GetBandwidthUsage(const int video_channel,
|
||||
unsigned int& total_bitrate_sent,
|
||||
unsigned int& video_bitrate_sent,
|
||||
unsigned int& fec_bitrate_sent,
|
||||
unsigned int& nackBitrateSent) const;
|
||||
virtual int SetRTPKeepAliveStatus(
|
||||
const int video_channel, bool enable, const char unknown_payload_type,
|
||||
const unsigned int delta_transmit_time_seconds);
|
||||
virtual int GetRTPKeepAliveStatus(
|
||||
const int video_channel,
|
||||
bool& enabled,
|
||||
char& unkown_payload_type,
|
||||
unsigned int& delta_transmit_time_seconds) const;
|
||||
virtual int StartRTPDump(const int video_channel,
|
||||
const char file_nameUTF8[1024],
|
||||
RTPDirections direction);
|
||||
virtual int StopRTPDump(const int video_channel, RTPDirections direction);
|
||||
virtual int RegisterRTPObserver(const int video_channel,
|
||||
ViERTPObserver& observer);
|
||||
virtual int DeregisterRTPObserver(const int video_channel);
|
||||
virtual int RegisterRTCPObserver(const int video_channel,
|
||||
ViERTCPObserver& observer);
|
||||
virtual int DeregisterRTCPObserver(const int video_channel);
|
||||
|
||||
class ViERTP_RTCPImpl : public virtual ViESharedData,
|
||||
public ViERTP_RTCP,
|
||||
public ViERefCount
|
||||
{
|
||||
public:
|
||||
virtual int Release();
|
||||
|
||||
// SSRC/CSRC
|
||||
virtual int SetLocalSSRC(const int videoChannel,
|
||||
const unsigned int SSRC,
|
||||
const StreamType usage,
|
||||
const unsigned char simulcastIdx);
|
||||
|
||||
virtual int GetLocalSSRC(const int videoChannel, unsigned int& SSRC) const;
|
||||
|
||||
virtual int SetRemoteSSRCType(const int videoChannel,
|
||||
const StreamType usage,
|
||||
const unsigned int SSRC) const;
|
||||
|
||||
virtual int GetRemoteSSRC(const int videoChannel, unsigned int& SSRC) const;
|
||||
|
||||
virtual int GetRemoteCSRCs(const int videoChannel,
|
||||
unsigned int CSRCs[kRtpCsrcSize]) const;
|
||||
|
||||
virtual int SetStartSequenceNumber(const int videoChannel,
|
||||
unsigned short sequenceNumber);
|
||||
|
||||
// RTCP
|
||||
virtual int SetRTCPStatus(const int videoChannel,
|
||||
const ViERTCPMode rtcpMode);
|
||||
|
||||
virtual int GetRTCPStatus(const int videoChannel, ViERTCPMode& rtcpMode);
|
||||
|
||||
virtual int SetRTCPCName(const int videoChannel,
|
||||
const char rtcpCName[KMaxRTCPCNameLength]);
|
||||
|
||||
virtual int GetRTCPCName(const int videoChannel,
|
||||
char rtcpCName[KMaxRTCPCNameLength]);
|
||||
|
||||
virtual int GetRemoteRTCPCName(const int videoChannel,
|
||||
char rtcpCName[KMaxRTCPCNameLength]) const;
|
||||
|
||||
virtual int
|
||||
SendApplicationDefinedRTCPPacket(const int videoChannel,
|
||||
const unsigned char subType,
|
||||
unsigned int name, const char* data,
|
||||
unsigned short dataLengthInBytes);
|
||||
|
||||
virtual int SetNACKStatus(const int videoChannel, const bool enable);
|
||||
|
||||
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);
|
||||
|
||||
virtual int SetTMMBRStatus(const int videoChannel, const bool enable);
|
||||
|
||||
// Statistics
|
||||
virtual int GetReceivedRTCPStatistics(
|
||||
const int videoChannel, unsigned short& fractionLost,
|
||||
unsigned int& cumulativeLost, unsigned int& extendedMax,
|
||||
unsigned int& jitter, int& rttMs) const;
|
||||
|
||||
virtual int GetSentRTCPStatistics(const int videoChannel,
|
||||
unsigned short& fractionLost,
|
||||
unsigned int& cumulativeLost,
|
||||
unsigned int& extendedMax,
|
||||
unsigned int& jitter, int& rttMs) const;
|
||||
|
||||
virtual int GetRTPStatistics(const int videoChannel,
|
||||
unsigned int& bytesSent,
|
||||
unsigned int& packetsSent,
|
||||
unsigned int& bytesReceived,
|
||||
unsigned int& packetsReceived) const;
|
||||
|
||||
virtual int GetBandwidthUsage(const int videoChannel,
|
||||
unsigned int& totalBitrateSent,
|
||||
unsigned int& videoBitrateSent,
|
||||
unsigned int& fecBitrateSent,
|
||||
unsigned int& nackBitrateSent) const;
|
||||
|
||||
// Keep alive
|
||||
virtual int SetRTPKeepAliveStatus(
|
||||
const int videoChannel, bool enable, const char unknownPayloadType,
|
||||
const unsigned int deltaTransmitTimeSeconds);
|
||||
|
||||
virtual int GetRTPKeepAliveStatus(const int videoChannel, bool& enabled,
|
||||
char& unkownPayloadType,
|
||||
unsigned int& deltaTransmitTimeSeconds);
|
||||
|
||||
// Dump RTP stream, for debug purpose
|
||||
virtual int StartRTPDump(const int videoChannel,
|
||||
const char fileNameUTF8[1024],
|
||||
RTPDirections direction);
|
||||
|
||||
virtual int StopRTPDump(const int videoChannel, RTPDirections direction);
|
||||
|
||||
// Callbacks
|
||||
virtual int RegisterRTPObserver(const int videoChannel,
|
||||
ViERTPObserver& observer);
|
||||
|
||||
virtual int DeregisterRTPObserver(const int videoChannel);
|
||||
|
||||
virtual int RegisterRTCPObserver(const int videoChannel,
|
||||
ViERTCPObserver& observer);
|
||||
|
||||
virtual int DeregisterRTCPObserver(const int videoChannel);
|
||||
|
||||
protected:
|
||||
ViERTP_RTCPImpl();
|
||||
virtual ~ViERTP_RTCPImpl();
|
||||
|
||||
private:
|
||||
RTCPMethod ViERTCPModeToRTCPMethod(ViERTCPMode apiMode);
|
||||
ViERTCPMode RTCPMethodToViERTCPMode(RTCPMethod moduleMethod);
|
||||
KeyFrameRequestMethod
|
||||
APIRequestToModuleRequest(const ViEKeyFrameRequestMethod apiMethod);
|
||||
protected:
|
||||
ViERTP_RTCPImpl();
|
||||
virtual ~ViERTP_RTCPImpl();
|
||||
};
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_VIDEO_ENGINE_MAIN_SOURCE_VIE_RTP_RTCP_IMPL_H_
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_VIDEO_ENGINE_VIE_RTP_RTCP_IMPL_H_
|
||||
|
Loading…
Reference in New Issue
Block a user