x264: apply encoding parameters per connection type

This commit is contained in:
Koichiro Iwao 2024-08-19 11:30:16 +09:00
parent d50c2fd4e4
commit 010b6a3dbf
3 changed files with 18 additions and 3 deletions

View File

@ -759,6 +759,9 @@ gfx_wiretosurface1(struct xrdp_encoder *self,
short *crects;
struct xrdp_enc_gfx_cmd *enc_gfx_cmd = &(enc->u.gfx);
int mon_index;
int connection_type;
connection_type = self->mm->wm->client_info->mcs_connection_type;
s = &ls;
g_memset(s, 0, sizeof(struct stream));
@ -912,7 +915,8 @@ gfx_wiretosurface1(struct xrdp_encoder *self,
width, height, twidth, theight, 0,
enc_gfx_cmd->data,
crects, num_rects_c,
s->p, &bitmap_data_length, NULL);
s->p, &bitmap_data_length,
connection_type, NULL);
if (error == 0)
{
xstream_seek(s, bitmap_data_length);

View File

@ -101,7 +101,8 @@ xrdp_encoder_x264_encode(void *handle, int session, int left, int top,
int width, int height, int twidth, int theight,
int format, const char *data,
short *crects, int num_crects,
char *cdata, int *cdata_bytes, int *flags_ptr)
char *cdata, int *cdata_bytes, int connection_type,
int *flags_ptr)
{
struct x264_global *xg;
struct x264_encoder *xe;
@ -117,6 +118,7 @@ xrdp_encoder_x264_encode(void *handle, int session, int left, int top,
int y;
int cx;
int cy;
int ct; /* connection_type */
x264_picture_t pic_in;
x264_picture_t pic_out;
@ -125,6 +127,14 @@ xrdp_encoder_x264_encode(void *handle, int session, int left, int top,
flags = 0;
xg = (struct x264_global *) handle;
xe = &(xg->encoders[session % X264_MAX_ENCODERS]);
/* validate connection type */
ct = connection_type;
if (ct > CONNECTION_TYPE_LAN || ct < CONNECTION_TYPE_MODEM)
{
ct = CONNECTION_TYPE_LAN;
}
if ((xe->x264_enc_han == NULL) ||
(xe->width != width) || (xe->height != height))
{

View File

@ -32,7 +32,8 @@ xrdp_encoder_x264_encode(void *handle, int session, int left, int top,
int width, int height, int twidth, int theight,
int format, const char *data,
short *crects, int num_crects,
char *cdata, int *cdata_bytes, int *flags_ptr);
char *cdata, int *cdata_bytes, int connection_type,
int *flags_ptr);
#endif