diff --git a/channels/rdpsnd/server/rdpsnd.c b/channels/rdpsnd/server/rdpsnd.c index 801ea8938..fc83fe002 100644 --- a/channels/rdpsnd/server/rdpsnd.c +++ b/channels/rdpsnd/server/rdpsnd.c @@ -263,12 +263,19 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie printf("rdpsnd_server_select_format: index %d is not correct.\n", client_format_index); 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) { diff --git a/client/Android/FreeRDPCore/jni/android_freerdp.c b/client/Android/FreeRDPCore/jni/android_freerdp.c index 7f84dea75..cf7945374 100644 --- a/client/Android/FreeRDPCore/jni/android_freerdp.c +++ b/client/Android/FreeRDPCore/jni/android_freerdp.c @@ -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); } diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/presentation/SessionActivity.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/presentation/SessionActivity.java index 5a637930c..657678bc7 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/presentation/SessionActivity.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/presentation/SessionActivity.java @@ -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 diff --git a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java index 672dcd934..8fec00aa7 100644 --- a/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java +++ b/client/Android/FreeRDPCore/src/com/freerdp/freerdpcore/services/LibFreeRDP.java @@ -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() diff --git a/client/iOS/Controllers/RDPSessionViewController.m b/client/iOS/Controllers/RDPSessionViewController.m index 08dbe7505..1aa94b5a5 100644 --- a/client/iOS/Controllers/RDPSessionViewController.m +++ b/client/iOS/Controllers/RDPSessionViewController.m @@ -375,7 +375,10 @@ - (void)sessionBitmapContextDidChange:(RDPSession*)session { // associate view with session - [_session_view setSession: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 diff --git a/client/iOS/FreeRDP/ios_freerdp_ui.m b/client/iOS/FreeRDP/ios_freerdp_ui.m index 436fa5038..432169226 100644 --- a/client/iOS/FreeRDP/ios_freerdp_ui.m +++ b/client/iOS/FreeRDP/ios_freerdp_ui.m @@ -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); } diff --git a/client/iOS/Models/RDPSession.m b/client/iOS/Models/RDPSession.m index 75e9c5ecf..adb45abf9 100644 --- a/client/iOS/Models/RDPSession.m +++ b/client/iOS/Models/RDPSession.m @@ -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]; diff --git a/client/iOS/Views/RDPSessionView.m b/client/iOS/Views/RDPSessionView.m index d36f315c1..6d0d0ac2b 100644 --- a/client/iOS/Views/RDPSessionView.m +++ b/client/iOS/Views/RDPSessionView.m @@ -24,7 +24,7 @@ - (void)drawRect:(CGRect)rect { - if(_session != nil) + if(_session != nil && [_session bitmapContext]) { CGContextRef context = UIGraphicsGetCurrentContext(); CGImageRef cgImage = CGBitmapContextCreateImage([_session bitmapContext]); diff --git a/cmake/iOSToolchain.cmake b/cmake/iOSToolchain.cmake index 41a4776ca..ed95d438f 100644 --- a/cmake/iOSToolchain.cmake +++ b/cmake/iOSToolchain.cmake @@ -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 diff --git a/cunit/test_nsc.c b/cunit/test_nsc.c index 4e74cd5b0..f26edf1a9 100644 --- a/cunit/test_nsc.c +++ b/cunit/test_nsc.c @@ -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); diff --git a/include/freerdp/codec/nsc.h b/include/freerdp/codec/nsc.h index d16bf4814..4ae32fd2f 100644 --- a/include/freerdp/codec/nsc.h +++ b/include/freerdp/codec/nsc.h @@ -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); diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c index c405997d0..abc3353f2 100644 --- a/libfreerdp/codec/nsc.c +++ b/libfreerdp/codec/nsc.c @@ -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) diff --git a/libfreerdp/codec/nsc_sse2.h b/libfreerdp/codec/nsc_sse2.h index f665dd148..8c7902019 100644 --- a/libfreerdp/codec/nsc_sse2.h +++ b/libfreerdp/codec/nsc_sse2.h @@ -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 */ diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index f105e648b..0df8d9967 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -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 { diff --git a/libfreerdp/codec/rfx_decode.c b/libfreerdp/codec/rfx_decode.c index 2d9cf3481..a7c0b08a9 100644 --- a/libfreerdp/codec/rfx_decode.c +++ b/libfreerdp/codec/rfx_decode.c @@ -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; } diff --git a/libfreerdp/codec/rfx_encode.c b/libfreerdp/codec/rfx_encode.c index b7ebe9d9d..e6cf10a0a 100644 --- a/libfreerdp/codec/rfx_encode.c +++ b/libfreerdp/codec/rfx_encode.c @@ -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); } diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 5cec55fbd..da67ef59b 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -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; } diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index f2e67a96b..e37fed785 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -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; diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index 544a9dd9e..7eecc6880 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -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); diff --git a/libfreerdp/core/security.c b/libfreerdp/core/security.c index 8511d8d0a..83298fdd1 100644 --- a/libfreerdp/core/security.c +++ b/libfreerdp/core/security.c @@ -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); diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 7e1566a10..08224ef2a 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -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 | diff --git a/server/Mac/mf_input.c b/server/Mac/mf_input.c index f2cec34a0..b24748464 100644 --- a/server/Mac/mf_input.c +++ b/server/Mac/mf_input.c @@ -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); diff --git a/server/Mac/mf_mountain_lion.c b/server/Mac/mf_mountain_lion.c index cf595575b..88d59033a 100644 --- a/server/Mac/mf_mountain_lion.c +++ b/server/Mac/mf_mountain_lion.c @@ -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)); } diff --git a/server/Mac/mf_peer.c b/server/Mac/mf_peer.c index e76987874..39e873180 100644 --- a/server/Mac/mf_peer.c +++ b/server/Mac/mf_peer.c @@ -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) diff --git a/server/Mac/mf_rdpsnd.c b/server/Mac/mf_rdpsnd.c index 0bd40d7ef..679cf08f1 100644 --- a/server/Mac/mf_rdpsnd.c +++ b/server/Mac/mf_rdpsnd.c @@ -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, diff --git a/server/Mac/mf_rdpsnd.h b/server/Mac/mf_rdpsnd.h index e5653b39a..e635be7d7 100644 --- a/server/Mac/mf_rdpsnd.h +++ b/server/Mac/mf_rdpsnd.h @@ -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; diff --git a/winpr/include/winpr/collections.h b/winpr/include/winpr/collections.h index e70bf4fcc..e8cafb01e 100644 --- a/winpr/include/winpr/collections.h +++ b/winpr/include/winpr/collections.h @@ -29,7 +29,7 @@ #include -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); diff --git a/winpr/include/winpr/pool.h b/winpr/include/winpr/pool.h index 2c707ad09..4ea9751b3 100644 --- a/winpr/include/winpr/pool.h +++ b/winpr/include/winpr/pool.h @@ -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);