mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
[channels,video] use new timer implementation
Use the new timer API to push frames in a defined interval
This commit is contained in:
parent
72a09b1675
commit
06e9ceff4c
@ -42,6 +42,7 @@
|
|||||||
#include <freerdp/channels/log.h>
|
#include <freerdp/channels/log.h>
|
||||||
#include <freerdp/codec/h264.h>
|
#include <freerdp/codec/h264.h>
|
||||||
#include <freerdp/codec/yuv.h>
|
#include <freerdp/codec/yuv.h>
|
||||||
|
#include <freerdp/timer.h>
|
||||||
|
|
||||||
#define TAG CHANNELS_TAG("video")
|
#define TAG CHANNELS_TAG("video")
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ typedef struct
|
|||||||
|
|
||||||
VideoClientContext* context;
|
VideoClientContext* context;
|
||||||
BOOL initialized;
|
BOOL initialized;
|
||||||
|
rdpContext* rdpcontext;
|
||||||
} VIDEO_PLUGIN;
|
} VIDEO_PLUGIN;
|
||||||
|
|
||||||
#define XF_VIDEO_UNLIMITED_RATE 31
|
#define XF_VIDEO_UNLIMITED_RATE 31
|
||||||
@ -105,6 +107,7 @@ struct s_VideoClientContextPriv
|
|||||||
UINT32 lastSentRate;
|
UINT32 lastSentRate;
|
||||||
UINT64 nextFeedbackTime;
|
UINT64 nextFeedbackTime;
|
||||||
PresentationContext* currentPresentation;
|
PresentationContext* currentPresentation;
|
||||||
|
FreeRDP_TimerID timerID;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void PresentationContext_unref(PresentationContext** presentation);
|
static void PresentationContext_unref(PresentationContext** presentation);
|
||||||
@ -1087,6 +1090,21 @@ static UINT video_data_on_new_channel_connection(IWTSListenerCallback* pListener
|
|||||||
return CHANNEL_RC_OK;
|
return CHANNEL_RC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint64_t timer_cb(WINPR_ATTR_UNUSED rdpContext* context, void* userdata,
|
||||||
|
WINPR_ATTR_UNUSED FreeRDP_TimerID timerID, uint64_t timestamp,
|
||||||
|
uint64_t interval)
|
||||||
|
{
|
||||||
|
VideoClientContext* video = userdata;
|
||||||
|
if (!video)
|
||||||
|
return 0;
|
||||||
|
if (!video->timer)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
video->timer(video, timestamp);
|
||||||
|
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function description
|
* Function description
|
||||||
*
|
*
|
||||||
@ -1140,7 +1158,12 @@ static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManage
|
|||||||
if (status == CHANNEL_RC_OK)
|
if (status == CHANNEL_RC_OK)
|
||||||
video->dataListener->pInterface = video->wtsPlugin.pInterface;
|
video->dataListener->pInterface = video->wtsPlugin.pInterface;
|
||||||
|
|
||||||
video->initialized = status == CHANNEL_RC_OK;
|
if (status == CHANNEL_RC_OK)
|
||||||
|
video->context->priv->timerID =
|
||||||
|
freerdp_timer_add(video->rdpcontext, 20000, timer_cb, video->context, true);
|
||||||
|
video->initialized = video->context->priv->timerID != 0;
|
||||||
|
if (!video->initialized)
|
||||||
|
status = ERROR_INTERNAL_ERROR;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,6 +1176,7 @@ static UINT video_plugin_terminated(IWTSPlugin* pPlugin)
|
|||||||
{
|
{
|
||||||
VIDEO_PLUGIN* video = (VIDEO_PLUGIN*)pPlugin;
|
VIDEO_PLUGIN* video = (VIDEO_PLUGIN*)pPlugin;
|
||||||
|
|
||||||
|
freerdp_timer_remove(video->rdpcontext, video->context->priv->timerID);
|
||||||
if (video->control_callback)
|
if (video->control_callback)
|
||||||
{
|
{
|
||||||
IWTSVirtualChannelManager* mgr = video->control_callback->channel_mgr;
|
IWTSVirtualChannelManager* mgr = video->control_callback->channel_mgr;
|
||||||
@ -1186,7 +1210,7 @@ static UINT video_plugin_terminated(IWTSPlugin* pPlugin)
|
|||||||
*/
|
*/
|
||||||
FREERDP_ENTRY_POINT(UINT VCAPITYPE video_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
|
FREERDP_ENTRY_POINT(UINT VCAPITYPE video_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
|
||||||
{
|
{
|
||||||
UINT error = CHANNEL_RC_OK;
|
UINT error = ERROR_INTERNAL_ERROR;
|
||||||
VIDEO_PLUGIN* videoPlugin = NULL;
|
VIDEO_PLUGIN* videoPlugin = NULL;
|
||||||
VideoClientContext* videoContext = NULL;
|
VideoClientContext* videoContext = NULL;
|
||||||
VideoClientContextPriv* priv = NULL;
|
VideoClientContextPriv* priv = NULL;
|
||||||
@ -1230,8 +1254,9 @@ FREERDP_ENTRY_POINT(UINT VCAPITYPE video_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* p
|
|||||||
|
|
||||||
videoPlugin->wtsPlugin.pInterface = (void*)videoContext;
|
videoPlugin->wtsPlugin.pInterface = (void*)videoContext;
|
||||||
videoPlugin->context = videoContext;
|
videoPlugin->context = videoContext;
|
||||||
|
videoPlugin->rdpcontext = pEntryPoints->GetRdpContext(pEntryPoints);
|
||||||
error = pEntryPoints->RegisterPlugin(pEntryPoints, "video", &videoPlugin->wtsPlugin);
|
if (videoPlugin->rdpcontext)
|
||||||
|
error = pEntryPoints->RegisterPlugin(pEntryPoints, "video", &videoPlugin->wtsPlugin);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -145,32 +145,17 @@ void gdi_video_control_uninit(rdpGdi* gdi, WINPR_ATTR_UNUSED VideoClientContext*
|
|||||||
gdi->video = NULL;
|
gdi->video = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gdi_video_timer(void* context, const TimerEventArgs* timer)
|
void gdi_video_data_init(WINPR_ATTR_UNUSED rdpGdi* gdi, WINPR_ATTR_UNUSED VideoClientContext* video)
|
||||||
{
|
|
||||||
rdpContext* ctx = (rdpContext*)context;
|
|
||||||
rdpGdi* gdi = NULL;
|
|
||||||
|
|
||||||
WINPR_ASSERT(ctx);
|
|
||||||
WINPR_ASSERT(timer);
|
|
||||||
|
|
||||||
gdi = ctx->gdi;
|
|
||||||
|
|
||||||
if (gdi && gdi->video)
|
|
||||||
gdi->video->timer(gdi->video, timer->now);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gdi_video_data_init(rdpGdi* gdi, WINPR_ATTR_UNUSED VideoClientContext* video)
|
|
||||||
{
|
{
|
||||||
WINPR_ASSERT(gdi);
|
WINPR_ASSERT(gdi);
|
||||||
WINPR_ASSERT(gdi->context);
|
WINPR_ASSERT(gdi->context);
|
||||||
PubSub_SubscribeTimer(gdi->context->pubSub, gdi_video_timer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdi_video_data_uninit(rdpGdi* gdi, WINPR_ATTR_UNUSED VideoClientContext* context)
|
void gdi_video_data_uninit(WINPR_ATTR_UNUSED rdpGdi* gdi,
|
||||||
|
WINPR_ATTR_UNUSED VideoClientContext* context)
|
||||||
{
|
{
|
||||||
WINPR_ASSERT(gdi);
|
WINPR_ASSERT(gdi);
|
||||||
WINPR_ASSERT(gdi->context);
|
WINPR_ASSERT(gdi->context);
|
||||||
PubSub_UnsubscribeTimer(gdi->context->pubSub, gdi_video_timer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoSurface* VideoClient_CreateCommonContext(size_t size, UINT32 x, UINT32 y, UINT32 w, UINT32 h)
|
VideoSurface* VideoClient_CreateCommonContext(size_t size, UINT32 x, UINT32 y, UINT32 w, UINT32 h)
|
||||||
|
Loading…
Reference in New Issue
Block a user