Merge pull request #1053 from C-o-r-E/master
Various small changes on the server and a fix for winpr-pool
This commit is contained in:
commit
f91efc8f05
@ -264,12 +264,19 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rdpsnd->src_bytes_per_sample = context->src_format.wBitsPerSample / 8;
|
rdpsnd->src_bytes_per_sample = context->src_format.wBitsPerSample / 8;
|
||||||
rdpsnd->src_bytes_per_frame = rdpsnd->src_bytes_per_sample * context->src_format.nChannels;
|
rdpsnd->src_bytes_per_frame = rdpsnd->src_bytes_per_sample * context->src_format.nChannels;
|
||||||
|
|
||||||
context->selected_client_format = client_format_index;
|
context->selected_client_format = client_format_index;
|
||||||
format = &context->client_formats[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)
|
if (format->wFormatTag == 0x11)
|
||||||
{
|
{
|
||||||
bs = (format->nBlockAlign - 4 * format->nChannels) * 4;
|
bs = (format->nBlockAlign - 4 * format->nChannels) * 4;
|
||||||
|
@ -287,8 +287,6 @@ static const CGKeyCode keymap[256] = {
|
|||||||
0xFF, //0xfe
|
0xFF, //0xfe
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
void mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||||
{
|
{
|
||||||
CGEventSourceRef source = CGEventSourceCreate (kCGEventSourceStateHIDSystemState);
|
CGEventSourceRef source = CGEventSourceCreate (kCGEventSourceStateHIDSystemState);
|
||||||
|
@ -48,6 +48,7 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
|
|||||||
RFX_RECT rect;
|
RFX_RECT rect;
|
||||||
unsigned long offset_beg;
|
unsigned long offset_beg;
|
||||||
unsigned long stride;
|
unsigned long stride;
|
||||||
|
int i;
|
||||||
|
|
||||||
rect.x = 0;
|
rect.x = 0;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
@ -64,7 +65,7 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
|
|||||||
|
|
||||||
stride = IOSurfaceGetBytesPerRow(frameSurface);
|
stride = IOSurfaceGetBytesPerRow(frameSurface);
|
||||||
//memcpy(localBuf, baseAddress + offset_beg, surflen);
|
//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));
|
offset_beg = (stride * (rect.y + i) + (rect.x * 4));
|
||||||
memcpy(localBuf + offset_beg,
|
memcpy(localBuf + offset_beg,
|
||||||
@ -160,15 +161,26 @@ int mf_mlion_screen_updates_init()
|
|||||||
|
|
||||||
localBuf = malloc(pixelWidth * pixelHeight * 4);
|
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,
|
stream = CGDisplayStreamCreateWithDispatchQueue(display_id,
|
||||||
pixelWidth,
|
pixelWidth,
|
||||||
pixelHeight,
|
pixelHeight,
|
||||||
'BGRA',
|
'BGRA',
|
||||||
NULL,
|
opts,
|
||||||
screen_update_q,
|
screen_update_q,
|
||||||
streamHandler);
|
streamHandler);
|
||||||
|
|
||||||
|
CFRelease(opts);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -221,7 +233,7 @@ int mf_mlion_get_dirty_region(RFX_RECT* invalid)
|
|||||||
|
|
||||||
int mf_mlion_peek_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;
|
CGRect dirtyRegion;
|
||||||
|
|
||||||
const CGRect * rects = CGDisplayStreamUpdateGetRects(lastUpdate, kCGDisplayStreamUpdateDirtyRects, &num_rects);
|
const CGRect * rects = CGDisplayStreamUpdateGetRects(lastUpdate, kCGDisplayStreamUpdateDirtyRects, &num_rects);
|
||||||
@ -231,7 +243,7 @@ int mf_mlion_peek_dirty_region(RFX_RECT* invalid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dirtyRegion = *rects;
|
dirtyRegion = *rects;
|
||||||
for (size_t i = 0; i < num_rects; i++)
|
for (i = 0; i < num_rects; i++)
|
||||||
{
|
{
|
||||||
dirtyRegion = CGRectUnion(dirtyRegion, *(rects+i));
|
dirtyRegion = CGRectUnion(dirtyRegion, *(rects+i));
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,6 @@ void mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
|
|||||||
context->rfx_context->width = client->settings->DesktopWidth;
|
context->rfx_context->width = client->settings->DesktopWidth;
|
||||||
context->rfx_context->height = client->settings->DesktopHeight;
|
context->rfx_context->height = client->settings->DesktopHeight;
|
||||||
rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
|
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();
|
//context->nsc_context = nsc_context_new();
|
||||||
//nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8);
|
//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_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);
|
info_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, info_queue);
|
||||||
|
|
||||||
if(info_timer)
|
if(info_timer)
|
||||||
|
@ -46,6 +46,7 @@ static void mf_peer_rdpsnd_activated(rdpsnd_server_context* context)
|
|||||||
{
|
{
|
||||||
|
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
|
int i;
|
||||||
|
|
||||||
recorderState.dataFormat.mSampleRate = 44100.0;
|
recorderState.dataFormat.mSampleRate = 44100.0;
|
||||||
recorderState.dataFormat.mFormatID = kAudioFormatLinearPCM;
|
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);
|
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,
|
AudioQueueAllocateBuffer(recorderState.queue,
|
||||||
recorderState.bufferByteSize,
|
recorderState.bufferByteSize,
|
||||||
|
@ -43,12 +43,12 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
|
|||||||
const AudioStreamPacketDescription *inPacketDescs);
|
const AudioStreamPacketDescription *inPacketDescs);
|
||||||
|
|
||||||
|
|
||||||
static const int snd_numBuffers = 3;
|
#define SND_NUMBUFFERS 3
|
||||||
struct _AQRecorderState
|
struct _AQRecorderState
|
||||||
{
|
{
|
||||||
AudioStreamBasicDescription dataFormat;
|
AudioStreamBasicDescription dataFormat;
|
||||||
AudioQueueRef queue;
|
AudioQueueRef queue;
|
||||||
AudioQueueBufferRef buffers[snd_numBuffers];
|
AudioQueueBufferRef buffers[SND_NUMBUFFERS];
|
||||||
AudioFileID audioFile;
|
AudioFileID audioFile;
|
||||||
UInt32 bufferByteSize;
|
UInt32 bufferByteSize;
|
||||||
SInt64 currentPacket;
|
SInt64 currentPacket;
|
||||||
|
@ -81,6 +81,7 @@ typedef struct _TP_CALLBACK_ENVIRON_V1
|
|||||||
|
|
||||||
/* Non-Windows and pre Windows 7 */
|
/* Non-Windows and pre Windows 7 */
|
||||||
#if ((!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0601)))
|
#if ((!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0601)))
|
||||||
|
//#if !defined(_WIN32_WINNT_VISTA)
|
||||||
|
|
||||||
typedef struct _TP_CALLBACK_ENVIRON_V3
|
typedef struct _TP_CALLBACK_ENVIRON_V3
|
||||||
{
|
{
|
||||||
@ -130,9 +131,21 @@ typedef VOID (*PTP_WAIT_CALLBACK)(PTP_CALLBACK_INSTANCE Instance, PVOID Context,
|
|||||||
|
|
||||||
#endif
|
#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 */
|
#ifndef PTP_WIN32_IO_CALLBACK_DEFINED
|
||||||
#if ((!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600)))
|
|
||||||
|
|
||||||
typedef VOID (*PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE Instance, PVOID Context, PVOID Overlapped,
|
typedef VOID (*PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE Instance, PVOID Context, PVOID Overlapped,
|
||||||
ULONG IoResult, ULONG_PTR NumberOfBytesTransferred, PTP_IO Io);
|
ULONG IoResult, ULONG_PTR NumberOfBytesTransferred, PTP_IO Io);
|
||||||
|
Loading…
Reference in New Issue
Block a user