Merge branch 'master' of github.com:FreeRDP/FreeRDP

This commit is contained in:
Marc-André Moreau 2013-03-07 13:56:51 -05:00
commit 89cf0a3dd0
28 changed files with 99 additions and 57 deletions

View File

@ -264,12 +264,19 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
return;
}
rdpsnd->src_bytes_per_sample = context->src_format.wBitsPerSample / 8;
rdpsnd->src_bytes_per_frame = rdpsnd->src_bytes_per_sample * context->src_format.nChannels;
context->selected_client_format = client_format_index;
format = &context->client_formats[client_format_index];
if (format->nSamplesPerSec == 0)
{
printf("Invalid Client Sound Format!!\n\n");
return;
}
if (format->wFormatTag == 0x11)
{
bs = (format->nBlockAlign - 4 * format->nChannels) * 4;

View File

@ -83,10 +83,7 @@ void android_desktop_resize(rdpContext* context)
DEBUG_ANDROID("ui_desktop_resize");
rdpGdi *gdi = context->gdi;
rdpSettings* settings = context->instance->settings;
gdi_resize(gdi, settings->DesktopWidth, settings->DesktopHeight);
freerdp_callback("OnGraphicsResize", "(III)V", context->instance, settings->DesktopWidth, settings->DesktopHeight);
freerdp_callback("OnGraphicsResize", "(IIII)V", context->instance, gdi->width, gdi->height, gdi->dstBpp);
}

View File

@ -924,10 +924,13 @@ public class SessionActivity extends Activity
}
@Override
public void OnGraphicsResize(int width, int height)
public void OnGraphicsResize(int width, int height, int bpp)
{
// replace bitmap
bitmap = Bitmap.createBitmap(width, height, bitmap.getConfig());
if (bpp > 16)
bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
else
bitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
session.setSurface(new BitmapDrawable(bitmap));
/* since sessionView can only be modified from the UI thread

View File

@ -64,7 +64,7 @@ public class LibFreeRDP
boolean OnAuthenticate(StringBuilder username, StringBuilder domain, StringBuilder password);
boolean OnVerifiyCertificate(String subject, String issuer, String fingerprint);
void OnGraphicsUpdate(int x, int y, int width, int height);
void OnGraphicsResize(int width, int height);
void OnGraphicsResize(int width, int height, int bpp);
}
private static EventListener listener;
@ -237,14 +237,14 @@ public class LibFreeRDP
uiEventListener.OnGraphicsUpdate(x, y, width, height);
}
private static void OnGraphicsResize(int inst, int width, int height)
private static void OnGraphicsResize(int inst, int width, int height, int bpp)
{
SessionState s = GlobalApp.getSession(inst);
if (s == null)
return;
UIEventListener uiEventListener = s.getUIEventListener();
if (uiEventListener != null)
uiEventListener.OnGraphicsResize(width, height);
uiEventListener.OnGraphicsResize(width, height, bpp);
}
public static String getVersion()

View File

@ -376,6 +376,9 @@
{
// associate view with session
[_session_view setSession:session];
// issue an update (this might be needed in case we had a resize for instance)
[_session_view setNeedsDisplay];
}
- (void)session:(RDPSession*)session needsRedrawInRect:(CGRect)rect

View File

@ -148,7 +148,6 @@ void ios_resize_display_buffer(mfInfo* mfi)
CGContextRelease(old_context);
// Create the new context
gdi_resize(mfi->instance->context->gdi, mfi->instance->settings->DesktopWidth, mfi->instance->settings->DesktopHeight);
ios_create_bitmap_context(mfi);
}

View File

@ -99,8 +99,12 @@ NSString* TSXSessionDidFailToConnectNotification = @"TSXSessionDidFailToConnect"
settings->ColorDepth = 32;
settings->LargePointerFlag = TRUE;
settings->FrameMarkerCommandEnabled = TRUE;
settings->FrameAcknowledge = 10;
}
// enable NSCodec
settings->NSCodec = TRUE;
// Performance flags
settings->DisableWallpaper = ![_params boolForKey:@"perf_show_desktop" with3GEnabled:connected_via_3g];
settings->DisableFullWindowDrag = ![_params boolForKey:@"perf_window_dragging" with3GEnabled:connected_via_3g];

View File

@ -24,7 +24,7 @@
- (void)drawRect:(CGRect)rect
{
if(_session != nil)
if(_session != nil && [_session bitmapContext])
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGImageRef cgImage = CGBitmapContextCreateImage([_session bitmapContext]);

View File

@ -46,8 +46,8 @@ endif (CMAKE_UNAME)
# Force the compilers to gcc for iOS
if(NOT CMAKE_C_COMPILER)
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (gcc gcc)
CMAKE_FORCE_CXX_COMPILER (g++ g++)
CMAKE_FORCE_C_COMPILER (gcc GNU)
CMAKE_FORCE_CXX_COMPILER (g++ GNU)
endif()
# Skip the platform compiler checks for cross compiling

View File

@ -335,7 +335,6 @@ void test_nsc_decode(void)
NSC_CONTEXT* context;
context = nsc_context_new();
nsc_context_set_cpu_opt(context, CPU_SSE2);
nsc_process_message(context, 32, 15, 10, (BYTE*) nsc_data, sizeof(nsc_data));
/*winpr_HexDump(context->bmpdata, 15 * 10 * 4);*/
for (i = 0; i < 30000; i++)
@ -357,7 +356,6 @@ void test_nsc_encode(void)
memcpy(rgb_data + i * 64 * 3, rgb_scanline_data, 64 * 3);
context = nsc_context_new();
nsc_context_set_cpu_opt(context, CPU_SSE2);
nsc_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8);
enc_stream = stream_new(65536);

View File

@ -65,7 +65,6 @@ struct _NSC_CONTEXT
};
FREERDP_API NSC_CONTEXT* nsc_context_new(void);
FREERDP_API void nsc_context_set_cpu_opt(NSC_CONTEXT* context, UINT32 cpu_opt);
FREERDP_API void nsc_context_set_pixel_format(NSC_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format);
FREERDP_API void nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
UINT16 width, UINT16 height, BYTE* data, UINT32 length);

View File

@ -37,9 +37,7 @@
#include "nsc_types.h"
#include "nsc_encode.h"
#ifdef WITH_SSE2
#include "nsc_sse2.h"
#endif
#ifndef NSC_INIT_SIMD
#define NSC_INIT_SIMD(_nsc_context) do { } while (0)
@ -291,13 +289,10 @@ NSC_CONTEXT* nsc_context_new(void)
nsc_context->nsc_stream.ColorLossLevel = 3;
nsc_context->nsc_stream.ChromaSubSamplingLevel = 1;
return nsc_context;
}
/* init optimized methods */
NSC_INIT_SIMD(nsc_context);
void nsc_context_set_cpu_opt(NSC_CONTEXT* context, UINT32 cpu_opt)
{
if (cpu_opt)
NSC_INIT_SIMD(context);
return nsc_context;
}
void nsc_context_set_pixel_format(NSC_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format)

View File

@ -24,8 +24,10 @@
void nsc_init_sse2(NSC_CONTEXT* context);
#ifndef NSC_INIT_SIMD
#define NSC_INIT_SIMD(_context) nsc_init_sse2(_context)
#ifdef WITH_SSE2
#ifndef NSC_INIT_SIMD
#define NSC_INIT_SIMD(_context) nsc_init_sse2(_context)
#endif
#endif
#endif /* __NSC_SSE2_H */

View File

@ -161,9 +161,14 @@ RFX_CONTEXT* rfx_context_new(void)
*
* y_r_buffer, cb_g_buffer, cr_b_buffer: 64 * 64 * 4 = 16384 (0x4000)
* dwt_buffer: 32 * 32 * 2 * 2 * 4 = 16384, maximum sub-band width is 32
*
* Additionally we add 32 bytes (16 in front and 16 at the back of the buffer)
* in order to allow optimized functions (SEE, NEON) to read from positions
* that are actually in front/beyond the buffer. Offset calculations are
* performed at the BufferPool_Take function calls in rfx_encode/decode.c.
*/
context->priv->BufferPool = BufferPool_New(TRUE, 16384, 16);
context->priv->BufferPool = BufferPool_New(TRUE, 16384 + 32, 16);
#ifdef _WIN32
{

View File

@ -153,9 +153,9 @@ BOOL rfx_decode_rgb(RFX_CONTEXT* context, STREAM* data_in,
PROFILER_ENTER(context->priv->prof_rfx_decode_rgb);
pSrcDst[0] = BufferPool_Take(context->priv->BufferPool, -1); /* y_r_buffer */
pSrcDst[1] = BufferPool_Take(context->priv->BufferPool, -1); /* cb_g_buffer */
pSrcDst[2] = BufferPool_Take(context->priv->BufferPool, -1); /* cr_b_buffer */
pSrcDst[0] = (INT16*)((BYTE*)BufferPool_Take(context->priv->BufferPool, -1) + 16); /* y_r_buffer */
pSrcDst[1] = (INT16*)((BYTE*)BufferPool_Take(context->priv->BufferPool, -1) + 16); /* cb_g_buffer */
pSrcDst[2] = (INT16*)((BYTE*)BufferPool_Take(context->priv->BufferPool, -1) + 16); /* cr_b_buffer */
#if 0
if (context->priv->UseThreads)
@ -227,8 +227,8 @@ BOOL rfx_decode_rgb(RFX_CONTEXT* context, STREAM* data_in,
PROFILER_EXIT(context->priv->prof_rfx_decode_rgb);
BufferPool_Return(context->priv->BufferPool, pSrcDst[0]);
BufferPool_Return(context->priv->BufferPool, pSrcDst[1]);
BufferPool_Return(context->priv->BufferPool, pSrcDst[2]);
BufferPool_Return(context->priv->BufferPool, (BYTE*)pSrcDst[0] - 16);
BufferPool_Return(context->priv->BufferPool, (BYTE*)pSrcDst[1] - 16);
BufferPool_Return(context->priv->BufferPool, (BYTE*)pSrcDst[2] - 16);
return TRUE;
}

View File

@ -225,9 +225,9 @@ void rfx_encode_rgb(RFX_CONTEXT* context, const BYTE* rgb_data, int width, int h
primitives_t* prims = primitives_get();
static const prim_size_t roi_64x64 = { 64, 64 };
pSrcDst[0] = BufferPool_Take(context->priv->BufferPool, -1); /* y_r_buffer */
pSrcDst[1] = BufferPool_Take(context->priv->BufferPool, -1); /* cb_g_buffer */
pSrcDst[2] = BufferPool_Take(context->priv->BufferPool, -1); /* cr_b_buffer */
pSrcDst[0] = (INT16*)((BYTE*)BufferPool_Take(context->priv->BufferPool, -1) + 16); /* y_r_buffer */
pSrcDst[1] = (INT16*)((BYTE*)BufferPool_Take(context->priv->BufferPool, -1) + 16); /* cb_g_buffer */
pSrcDst[2] = (INT16*)((BYTE*)BufferPool_Take(context->priv->BufferPool, -1) + 16); /* cr_b_buffer */
PROFILER_ENTER(context->priv->prof_rfx_encode_rgb);
@ -260,7 +260,7 @@ void rfx_encode_rgb(RFX_CONTEXT* context, const BYTE* rgb_data, int width, int h
PROFILER_EXIT(context->priv->prof_rfx_encode_rgb);
BufferPool_Return(context->priv->BufferPool, pSrcDst[0]);
BufferPool_Return(context->priv->BufferPool, pSrcDst[1]);
BufferPool_Return(context->priv->BufferPool, pSrcDst[2]);
BufferPool_Return(context->priv->BufferPool, (BYTE*)pSrcDst[0] - 16);
BufferPool_Return(context->priv->BufferPool, (BYTE*)pSrcDst[1] - 16);
BufferPool_Return(context->priv->BufferPool, (BYTE*)pSrcDst[2] - 16);
}

View File

@ -2190,10 +2190,13 @@ BOOL rdp_print_desktop_composition_capability_set(STREAM* s, UINT16 length)
BOOL rdp_read_multifragment_update_capability_set(STREAM* s, UINT16 length, rdpSettings* settings)
{
UINT32 multifragMaxRequestSize;
if (length < 8)
return FALSE;
stream_read_UINT32(s, settings->MultifragMaxRequestSize); /* MaxRequestSize (4 bytes) */
stream_read_UINT32(s, multifragMaxRequestSize); /* MaxRequestSize (4 bytes) */
if (settings->MultifragMaxRequestSize < multifragMaxRequestSize)
settings->MultifragMaxRequestSize = multifragMaxRequestSize;
return TRUE;
}

View File

@ -340,7 +340,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s)
stream_check_size(fastpath->updateData, size);
stream_copy(fastpath->updateData, comp_stream, size);
if (stream_get_size(fastpath->updateData) > rdp->settings->MultifragMaxRequestSize)
if (stream_get_length(fastpath->updateData) > rdp->settings->MultifragMaxRequestSize)
{
printf("fastpath PDU is bigger than MultifragMaxRequestSize\n");
return -1;

View File

@ -717,7 +717,8 @@ BOOL rdp_decrypt(rdpRdp* rdp, STREAM* s, int length, UINT16 securityFlags)
stream_read(s, wmac, sizeof(wmac));
length -= sizeof(wmac);
security_decrypt(s->p, length, rdp);
if (!security_decrypt(s->p, length, rdp))
return FALSE;
if (securityFlags & SEC_SECURE_CHECKSUM)
security_salted_mac_signature(rdp, s->p, length, FALSE, cmac);

View File

@ -492,6 +492,8 @@ BOOL security_encrypt(BYTE* data, int length, rdpRdp* rdp)
BOOL security_decrypt(BYTE* data, int length, rdpRdp* rdp)
{
if (rdp->rc4_decrypt_key == NULL)
return FALSE;
if (rdp->decrypt_use_count >= 4096)
{
security_key_update(rdp->decrypt_key, rdp->decrypt_update_key, rdp->rc4_key_len);

View File

@ -238,6 +238,7 @@ rdpSettings* freerdp_settings_new(void* instance)
settings->SaltedChecksum = TRUE;
settings->ServerPort = 3389;
settings->DesktopResize = TRUE;
settings->ToggleFullscreen = TRUE;
settings->PerformanceFlags =
PERF_DISABLE_FULLWINDOWDRAG |

View File

@ -287,8 +287,6 @@ static const CGKeyCode keymap[256] = {
0xFF, //0xfe
};
void mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
CGEventSourceRef source = CGEventSourceCreate (kCGEventSourceStateHIDSystemState);

View File

@ -48,6 +48,7 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
RFX_RECT rect;
unsigned long offset_beg;
unsigned long stride;
int i;
rect.x = 0;
rect.y = 0;
@ -64,7 +65,7 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
stride = IOSurfaceGetBytesPerRow(frameSurface);
//memcpy(localBuf, baseAddress + offset_beg, surflen);
for(int i = 0; i < rect.height; i++)
for(i = 0; i < rect.height; i++)
{
offset_beg = (stride * (rect.y + i) + (rect.x * 4));
memcpy(localBuf + offset_beg,
@ -160,15 +161,26 @@ int mf_mlion_screen_updates_init()
localBuf = malloc(pixelWidth * pixelHeight * 4);
CFDictionaryRef opts;
void * keys[2];
void * values[2];
keys[0] = (void *) kCGDisplayStreamShowCursor;
values[0] = (void *) kCFBooleanFalse;
opts = CFDictionaryCreate(kCFAllocatorDefault, (const void **) keys, (const void **) values, 1, NULL, NULL);
stream = CGDisplayStreamCreateWithDispatchQueue(display_id,
pixelWidth,
pixelHeight,
'BGRA',
NULL,
opts,
screen_update_q,
streamHandler);
CFRelease(opts);
return 0;
@ -221,7 +233,7 @@ int mf_mlion_get_dirty_region(RFX_RECT* invalid)
int mf_mlion_peek_dirty_region(RFX_RECT* invalid)
{
size_t num_rects;
size_t num_rects, i;
CGRect dirtyRegion;
const CGRect * rects = CGDisplayStreamUpdateGetRects(lastUpdate, kCGDisplayStreamUpdateDirtyRects, &num_rects);
@ -231,7 +243,7 @@ int mf_mlion_peek_dirty_region(RFX_RECT* invalid)
}
dirtyRegion = *rects;
for (size_t i = 0; i < num_rects; i++)
for (i = 0; i < num_rects; i++)
{
dirtyRegion = CGRectUnion(dirtyRegion, *(rects+i));
}

View File

@ -180,7 +180,6 @@ void mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
context->rfx_context->width = client->settings->DesktopWidth;
context->rfx_context->height = client->settings->DesktopHeight;
rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
rfx_context_set_cpu_opt(context->rfx_context, CPU_SSE2);
//context->nsc_context = nsc_context_new();
//nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8);
@ -236,7 +235,7 @@ void mf_peer_init(freerdp_peer* client)
info_event_queue = mf_event_queue_new();
info_queue = dispatch_queue_create("testing.101", DISPATCH_QUEUE_SERIAL);
info_queue = dispatch_queue_create("FreeRDP.update.timer", DISPATCH_QUEUE_SERIAL);
info_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, info_queue);
if(info_timer)

View File

@ -46,6 +46,7 @@ static void mf_peer_rdpsnd_activated(rdpsnd_server_context* context)
{
OSStatus status;
int i;
recorderState.dataFormat.mSampleRate = 44100.0;
recorderState.dataFormat.mFormatID = kAudioFormatLinearPCM;
@ -83,7 +84,7 @@ static void mf_peer_rdpsnd_activated(rdpsnd_server_context* context)
mf_rdpsnd_derive_buffer_size(recorderState.queue, &recorderState.dataFormat, 0.05, &recorderState.bufferByteSize);
for (int i = 0; i < snd_numBuffers; ++i)
for (i = 0; i < SND_NUMBUFFERS; ++i)
{
AudioQueueAllocateBuffer(recorderState.queue,
recorderState.bufferByteSize,

View File

@ -43,12 +43,12 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
const AudioStreamPacketDescription *inPacketDescs);
static const int snd_numBuffers = 3;
#define SND_NUMBUFFERS 3
struct _AQRecorderState
{
AudioStreamBasicDescription dataFormat;
AudioQueueRef queue;
AudioQueueBufferRef buffers[snd_numBuffers];
AudioQueueBufferRef buffers[SND_NUMBUFFERS];
AudioFileID audioFile;
UInt32 bufferByteSize;
SInt64 currentPacket;

View File

@ -29,7 +29,7 @@
#include <winpr/synch.h>
typedef void* (*OBJECT_NEW_FN)();
typedef void* (*OBJECT_NEW_FN)(void);
typedef void (*OBJECT_FREE_FN)(void* obj);
typedef void (*OBJECT_EQUALS_FN)(void* objA, void* objB);

View File

@ -81,6 +81,7 @@ typedef struct _TP_CALLBACK_ENVIRON_V1
/* Non-Windows and pre Windows 7 */
#if ((!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0601)))
//#if !defined(_WIN32_WINNT_VISTA)
typedef struct _TP_CALLBACK_ENVIRON_V3
{
@ -130,9 +131,21 @@ typedef VOID (*PTP_WAIT_CALLBACK)(PTP_CALLBACK_INSTANCE Instance, PVOID Context,
#endif
/*
There is a bug in the Win8 header that defines the IO
callback unconditionally. Versions of Windows greater
than XP will conditionally define it. The following
logic tries to fix that.
*/
#ifdef _THREADPOOLAPISET_H_
#define PTP_WIN32_IO_CALLBACK_DEFINED 1
#else
#if (_WIN32_WINNT >= 0x0600)
#define PTP_WIN32_IO_CALLBACK_DEFINED 1
#endif
#endif
/* Non-Windows and pre Vista */
#if ((!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600)))
#ifndef PTP_WIN32_IO_CALLBACK_DEFINED
typedef VOID (*PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE Instance, PVOID Context, PVOID Overlapped,
ULONG IoResult, ULONG_PTR NumberOfBytesTransferred, PTP_IO Io);