diff options
author | Jay Sorg <jay.sorg@gmail.com> | 2015-03-28 18:34:25 -0700 |
---|---|---|
committer | Jay Sorg <jay.sorg@gmail.com> | 2015-03-28 18:34:25 -0700 |
commit | 33167a7c746de49e735e76c5662d1e6c36bd10ed (patch) | |
tree | 936ed6150bf276d850a1f350823fb85bee296768 /libxrdp | |
parent | 7f8ec757de53dbe2f4a19b5bf0a3edccbf31a0ef (diff) | |
download | xrdp-proprietary-33167a7c746de49e735e76c5662d1e6c36bd10ed.tar.gz xrdp-proprietary-33167a7c746de49e735e76c5662d1e6c36bd10ed.zip |
add frame acks and h264 codec mode basics
Diffstat (limited to 'libxrdp')
-rw-r--r-- | libxrdp/libxrdp.c | 39 | ||||
-rw-r--r-- | libxrdp/libxrdpinc.h | 3 | ||||
-rw-r--r-- | libxrdp/xrdp_caps.c | 29 | ||||
-rw-r--r-- | libxrdp/xrdp_fastpath.c | 25 | ||||
-rw-r--r-- | libxrdp/xrdp_rdp.c | 21 |
5 files changed, 104 insertions, 13 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index 594fcc73..32ee2098 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -1312,7 +1312,7 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session, int max_bytes; int cmd_bytes; - LLOGLN(10, ("libxrdp_fastpath_init:")); + LLOGLN(10, ("libxrdp_fastpath_send_surface:")); if ((session->client_info->use_fast_path & 1) == 0) { return 1; @@ -1362,3 +1362,40 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session, } return 0; } + +/*****************************************************************************/ +int EXPORT_CC +libxrdp_fastpath_send_frame_marker(struct xrdp_session *session, + int frame_action, int frame_id) +{ + struct stream *s; + struct xrdp_rdp *rdp; + + LLOGLN(10, ("libxrdp_fastpath_send_frame_marker:")); + if ((session->client_info->use_fast_path & 1) == 0) + { + return 1; + } + if (session->client_info->use_frame_acks == 0) + { + return 1; + } + rdp = (struct xrdp_rdp *) (session->rdp); + make_stream(s); + init_stream(s, 8192); + xrdp_rdp_init_fastpath(rdp, s); + out_uint16_le(s, 0x0004); /* CMDTYPE_FRAME_MARKER */ + out_uint16_le(s, frame_action); + out_uint32_le(s, frame_id); + s_mark_end(s); + /* 4 = FASTPATH_UPDATETYPE_SURFCMDS */ + if (xrdp_rdp_send_fastpath(rdp, s, 4) != 0) + { + free_stream(s); + return 1; + } + free_stream(s); + return 0; + +} + diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h index 2262f66f..8d99814c 100644 --- a/libxrdp/libxrdpinc.h +++ b/libxrdp/libxrdpinc.h @@ -242,5 +242,8 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session, int destLeft, int dst_Top, int destRight, int destBottom, int bpp, int codecID, int width, int height); +int EXPORT_CC +libxrdp_fastpath_send_frame_marker(struct xrdp_session *session, + int frame_action, int frame_id); #endif diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c index a5883a01..98ab03fa 100644 --- a/libxrdp/xrdp_caps.c +++ b/libxrdp/xrdp_caps.c @@ -486,6 +486,15 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len) } g_writeln(" jpeg quality set to %d", self->client_info.jpeg_prop[0]); } + else if (g_memcmp(codec_guid, XR_CODEC_GUID_H264, 16) == 0) + { + g_writeln("xrdp_caps_process_codecs: h264 codec id %d prop len %d", + codec_id, codec_properties_length); + self->client_info.h264_codec_id = codec_id; + i1 = MIN(64, codec_properties_length); + g_memcpy(self->client_info.h264_prop, s->p, i1); + self->client_info.h264_prop_len = i1; + } else { g_writeln("xrdp_caps_process_codecs: unknown codec id %d", codec_id); @@ -509,6 +518,17 @@ xrdp_caps_process_multifragmetupdate(struct xrdp_rdp *self, struct stream *s, return 0; } + /*****************************************************************************/ +static int APP_CC +xrdp_caps_process_frame_ack(struct xrdp_rdp *self, struct stream *s, int len) +{ + g_writeln("xrdp_caps_process_frame_ack:"); + self->client_info.use_frame_acks = 1; + in_uint32_le(s, self->client_info.max_unacknowledged_frame_count); + g_writeln(" max_unacknowledged_frame_count %d", self->client_info.max_unacknowledged_frame_count); + return 0; +} + /*****************************************************************************/ int APP_CC xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s) @@ -626,6 +646,9 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s) case RDP_CAPSET_BMPCODECS: /* 0x1d(29) */ xrdp_caps_process_codecs(self, s, len); break; + case 0x001E: /* CAPSSETTYPE_FRAME_ACKNOWLEDGE */ + xrdp_caps_process_frame_ack(self, s, len); + break; default: g_writeln("unknown in xrdp_caps_process_confirm_active %d", type); break; @@ -880,6 +903,12 @@ xrdp_caps_send_demand_active(struct xrdp_rdp *self) out_uint32_le(s, 3 * 1024 * 1024); /* 3MB */ } + /* frame acks */ + caps_count++; + out_uint16_le(s, 0x001E); /* CAPSETTYPE_FRAME_ACKNOWLEDGE */ + out_uint16_le(s, 8); + out_uint32_le(s, 2); /* 2 frames in flight */ + out_uint8s(s, 4); /* pad */ s_mark_end(s); diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c index 6a4eb78e..5bf63b29 100644 --- a/libxrdp/xrdp_fastpath.c +++ b/libxrdp/xrdp_fastpath.c @@ -113,18 +113,6 @@ xrdp_fastpath_init(struct xrdp_fastpath *self, struct stream *s) } /*****************************************************************************/ -/* no fragmenation */ -int APP_CC -xrdp_fastpath_send(struct xrdp_fastpath *self, struct stream *s) -{ - if (trans_force_write_s(self->trans, s) != 0) - { - return 1; - } - return 0; -} - -/*****************************************************************************/ static int APP_CC xrdp_fastpath_session_callback(struct xrdp_fastpath *self, int msg, long param1, long param2, @@ -145,6 +133,19 @@ xrdp_fastpath_session_callback(struct xrdp_fastpath *self, int msg, } /*****************************************************************************/ +/* no fragmenation */ +int APP_CC +xrdp_fastpath_send(struct xrdp_fastpath *self, struct stream *s) +{ + if (trans_force_write_s(self->trans, s) != 0) + { + return 1; + } + xrdp_fastpath_session_callback(self, 0x5556, 0, 0, 0, 0); + return 0; +} + +/*****************************************************************************/ /* FASTPATH_INPUT_EVENT_SCANCODE */ static int APP_CC xrdp_fastpath_process_EVENT_SCANCODE(struct xrdp_fastpath *self, diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 34842533..72562022 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -1107,6 +1107,24 @@ xrdp_rdp_send_disconnect_reason(struct xrdp_rdp *self, int reason) #endif /*****************************************************************************/ +static int APP_CC +xrdp_rdp_process_frame_ack(struct xrdp_rdp *self, struct stream *s) +{ + int frame_id; + + //g_writeln("xrdp_rdp_process_frame_ack:"); + in_uint32_le(s, frame_id); + //g_writeln(" frame_id %d", frame_id); + if (self->session->callback != 0) + { + /* call to xrdp_wm.c : callback */ + self->session->callback(self->session->id, 0x5557, frame_id, 0, + 0, 0); + } + return 0; +} + +/*****************************************************************************/ /* RDP_PDU_DATA */ int APP_CC xrdp_rdp_process_data(struct xrdp_rdp *self, struct stream *s) @@ -1155,6 +1173,9 @@ xrdp_rdp_process_data(struct xrdp_rdp *self, struct stream *s) case RDP_DATA_PDU_FONT2: /* 39(0x27) */ xrdp_rdp_process_data_font(self, s); break; + case 56: /* PDUTYPE2_FRAME_ACKNOWLEDGE 0x38 */ + xrdp_rdp_process_frame_ack(self, s); + break; default: g_writeln("unknown in xrdp_rdp_process_data %d", data_type); break; |