server: replay RemoteFX session in original time

This commit is contained in:
Marc-André Moreau 2011-08-31 20:56:17 -04:00
parent c72ab1456d
commit 0c7abe3e57
3 changed files with 20 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include <freerdp/api.h>
#include <freerdp/types.h>
FREERDP_API void freerdp_sleep(uint32 seconds);
FREERDP_API void freerdp_usleep(uint32 useconds);
#endif /* __SLEEP_UTILS_H */

View File

@ -28,6 +28,11 @@
#include <windows.h>
#endif
void freerdp_sleep(uint32 seconds)
{
sleep(seconds);
}
void freerdp_usleep(uint32 useconds)
{
#ifndef _WIN32

View File

@ -25,6 +25,7 @@
#include <pthread.h>
#include <signal.h>
#include <freerdp/constants.h>
#include <freerdp/utils/sleep.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/thread.h>
#include <freerdp/rfx/rfx.h>
@ -239,6 +240,8 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
void test_peer_dump_rfx(freerdp_peer* client)
{
STREAM* s;
uint32 seconds;
uint32 useconds;
rdpUpdate* update;
rdpPcap* pcap_rfx;
pcap_record record;
@ -248,6 +251,8 @@ void test_peer_dump_rfx(freerdp_peer* client)
client->update->pcap_rfx = pcap_open(test_pcap_file, False);
pcap_rfx = client->update->pcap_rfx;
seconds = useconds = 0;
while (pcap_has_next_record(pcap_rfx))
{
pcap_get_next_record_header(pcap_rfx, &record);
@ -259,6 +264,15 @@ void test_peer_dump_rfx(freerdp_peer* client)
pcap_get_next_record_content(pcap_rfx, &record);
s->p = s->data + s->size;
seconds = record.header.ts_sec - seconds;
useconds = record.header.ts_usec - useconds;
if (seconds > 0)
freerdp_sleep(seconds);
if (useconds > 0)
freerdp_usleep(useconds);
update->SurfaceCommand(update, s);
}
}