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

This commit is contained in:
Marc-André Moreau 2014-06-23 11:54:58 -04:00
commit 9c03f8b6bf
26 changed files with 799 additions and 654 deletions

View File

@ -76,11 +76,11 @@ if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
endif(ANDROID OR IOS)
include(GetGitRevisionDescription)
git_describe(GIT_REVISION --match "[0-9]*" --abbrev=4 --tags --always)
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
endif(ANDROID OR IOS)
git_describe(GIT_REVISION --match "[0-9]*" --abbrev=4 --tags --always)
message(STATUS "Git Revision ${GIT_REVISION}")
# Turn on solution folders (2.8.4+)

View File

@ -83,8 +83,8 @@ static BOOL rdpsnd_server_send_formats(RdpsndServerContext* context, wStream* s)
static BOOL rdpsnd_server_recv_waveconfirm(RdpsndServerContext* context, wStream* s)
{
UINT16 timestamp = 0;
BYTE confirmBlockNum = 0;
UINT16 timestamp;
BYTE confirmBlockNum;
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
@ -92,6 +92,9 @@ static BOOL rdpsnd_server_recv_waveconfirm(RdpsndServerContext* context, wStream
Stream_Read_UINT16(s, timestamp);
Stream_Read_UINT8(s, confirmBlockNum);
Stream_Seek_UINT8(s);
IFCALL(context->ConfirmBlock, context, confirmBlockNum, timestamp);
return TRUE;
}
@ -192,37 +195,41 @@ static void* rdpsnd_server_thread(void* arg)
UINT16 BodySize;
HANDLE events[8];
HANDLE ChannelEvent;
DWORD BytesReturned;
DWORD bytesReturned;
RdpsndServerContext* context;
BOOL doRun;
BOOL waitingHeader;
DWORD expectedBytes;
context = (RdpsndServerContext *)arg;
buffer = NULL;
BytesReturned = 0;
ChannelEvent = NULL;
bytesReturned = 0;
s = Stream_New(NULL, 4096);
if (!s)
return NULL;
if (WTSVirtualChannelQuery(context->priv->ChannelHandle, WTSVirtualEventHandle, &buffer, &BytesReturned))
if (!WTSVirtualChannelQuery(context->priv->ChannelHandle, WTSVirtualEventHandle, &buffer, &bytesReturned) || (bytesReturned != sizeof(HANDLE)))
{
if (BytesReturned == sizeof(HANDLE))
CopyMemory(&ChannelEvent, buffer, sizeof(HANDLE));
WTSFreeMemory(buffer);
fprintf(stderr, "%s: error during WTSVirtualChannelQuery(WTSVirtualEventHandle) or invalid returned size(%d)\n",
__FUNCTION__, bytesReturned);
return NULL;
}
CopyMemory(&ChannelEvent, buffer, sizeof(HANDLE));
WTSFreeMemory(buffer);
nCount = 0;
if (ChannelEvent)
events[nCount++] = ChannelEvent;
events[nCount++] = ChannelEvent;
events[nCount++] = context->priv->StopEvent;
if (!rdpsnd_server_send_formats(context, s))
goto out;
doRun = TRUE;
waitingHeader = TRUE;
expectedBytes = 4;
while (doRun)
{
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
@ -230,31 +237,34 @@ static void* rdpsnd_server_thread(void* arg)
if (WaitForSingleObject(context->priv->StopEvent, 0) == WAIT_OBJECT_0)
break;
Stream_SetPosition(s, 0);
if (!WTSVirtualChannelRead(context->priv->ChannelHandle, 0, (PCHAR)Stream_Buffer(s),
Stream_Capacity(s), &BytesReturned))
if (!WTSVirtualChannelRead(ChannelEvent, 0, (PCHAR)Stream_Pointer(s), expectedBytes, &bytesReturned))
{
if (!BytesReturned)
break;
fprintf(stderr, "%s: channel connection closed\n", __FUNCTION__);
break;
}
expectedBytes -= bytesReturned;
Stream_Seek(s, bytesReturned);
Stream_EnsureRemainingCapacity(s, BytesReturned);
if (expectedBytes)
continue;
if (!WTSVirtualChannelRead(context->priv->ChannelHandle, 0, (PCHAR)Stream_Buffer(s),
Stream_Capacity(s), &BytesReturned))
break;
Stream_SetPosition(s, 0);
if (waitingHeader)
{
/* header case */
Stream_Read_UINT8(s, msgType);
Stream_Seek_UINT8(s); /* bPad */
Stream_Read_UINT16(s, BodySize);
expectedBytes = BodySize;
waitingHeader = FALSE;
Stream_SetPosition(s, 0);
Stream_EnsureCapacity(s, BodySize);
if (expectedBytes)
continue;
}
if (Stream_GetRemainingLength(s) < 4)
break;
Stream_Read_UINT8(s, msgType);
Stream_Seek_UINT8(s); /* bPad */
Stream_Read_UINT16(s, BodySize);
if (Stream_GetRemainingLength(s) < BodySize)
break;
/* when here we have the header + the body */
switch (msgType)
{
case SNDC_WAVECONFIRM:
@ -277,6 +287,10 @@ static void* rdpsnd_server_thread(void* arg)
fprintf(stderr, "%s: UNKOWN MESSAGE TYPE!! (%#0X)\n\n", __FUNCTION__, msgType);
break;
}
expectedBytes = 4;
waitingHeader = TRUE;
Stream_SetPosition(s, 0);
}
out:
@ -353,7 +367,7 @@ static BOOL rdpsnd_server_select_format(RdpsndServerContext* context, int client
return TRUE;
}
static BOOL rdpsnd_server_send_audio_pdu(RdpsndServerContext* context)
static BOOL rdpsnd_server_send_audio_pdu(RdpsndServerContext* context, UINT16 wTimestamp)
{
int size;
BYTE* src;
@ -418,7 +432,7 @@ static BOOL rdpsnd_server_send_audio_pdu(RdpsndServerContext* context)
Stream_Write_UINT8(s, 0); /* bPad */
Stream_Write_UINT16(s, size + fill_size + 8); /* BodySize */
Stream_Write_UINT16(s, 0); /* wTimeStamp */
Stream_Write_UINT16(s, wTimestamp); /* wTimeStamp */
Stream_Write_UINT16(s, context->selected_client_format); /* wFormatNo */
Stream_Write_UINT8(s, context->block_no); /* cBlockNo */
Stream_Seek(s, 3); /* bPad */
@ -445,7 +459,7 @@ out:
return status;
}
static BOOL rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf, int nframes)
static BOOL rdpsnd_server_send_samples(RdpsndServerContext* context, const void* buf, int nframes, UINT16 wTimestamp)
{
int cframes;
int cframesize;
@ -466,7 +480,7 @@ static BOOL rdpsnd_server_send_samples(RdpsndServerContext* context, const void*
if (context->priv->out_pending_frames >= context->priv->out_frames)
{
if (!rdpsnd_server_send_audio_pdu(context))
if (!rdpsnd_server_send_audio_pdu(context, wTimestamp))
return FALSE;
}
}
@ -510,7 +524,7 @@ static BOOL rdpsnd_server_close(RdpsndServerContext* context)
if (context->priv->out_pending_frames > 0)
{
if (!rdpsnd_server_send_audio_pdu(context))
if (!rdpsnd_server_send_audio_pdu(context, 0))
return FALSE;
}

View File

@ -8,6 +8,7 @@ libs/armeabi*
AndroidManifest.xml
local.properties
!.project
appcompat_v7
FreeRDPCore/project.properties
FreeRDPCore/src/com/freerdp/freerdpcore/utils/BuildConfiguration.java

View File

@ -42,6 +42,11 @@ if(ANDROID_BUILD_JAVA)
endif()
endif(ANDROID_BUILD_JAVA)
set(ANDROID_COMMAND "${ANDROID_SDK}/tools/android")
if(NOT EXISTS ${ANDROID_COMMAND})
message(FATAL_ERROR "android not found but required to build android java")
endif()
if(ANDROID_BUILD_JAVA_DEBUG)
set(ANDROID_BUILD_TYPE "debug")
else()
@ -56,5 +61,11 @@ else()
set(NDK_DEBUG "0")
endif()
set(APPCOMPAT_DIR "${CMAKE_CURRENT_BINARY_DIR}/appcompat_v7")
add_custom_target(copy_appcompat ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ANDROID_SDK}/extras/android/support/v7/appcompat ${APPCOMPAT_DIR}
COMMAND ${ANDROID_COMMAND} update lib-project -p ${APPCOMPAT_DIR}
)
add_subdirectory(FreeRDPCore)
add_subdirectory(aFreeRDP)

View File

@ -65,7 +65,7 @@
android:windowSoftInputMode="stateHidden">
</activity>
<activity android:name=".presentation.SessionActivity"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:theme="@style/Theme.AppCompat"
android:configChanges="orientation|keyboardHidden|keyboard"
android:windowSoftInputMode="adjustResize">
</activity>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>

View File

@ -13,3 +13,4 @@
# Project target.
target=android-@ANDROID_APP_TARGET_SDK@
android.library=true
android.library.reference.1=../appcompat_v7

View File

@ -18,7 +18,6 @@
android:paddingRight="6dip"
android:paddingTop="7dip"
android:paddingBottom="16dip"
android:background="@drawable/search_plate"
android:gravity="center_vertical"
android:focusable="true"
android:descendantFocusability="afterDescendants">
@ -36,8 +35,6 @@
android:singleLine="true"
android:ellipsize="end"
android:inputType="text"
android:textColor="?android:attr/textColorPrimary"
android:textColorHint="?android:attr/textColorHint"
android:drawableLeft="@drawable/icon_edittext_search"
android:drawableRight="@drawable/icon_edittext_clear"
/>

View File

@ -4,14 +4,17 @@
<item android:id="@+id/bookmark_connect"
android:title="@string/menu_connect"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/bookmark_edit"
android:title="@string/menu_edit"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/bookmark_delete"
android:title="@string/menu_delete"
android:showAsAction="ifRoom"
/>
</menu>

View File

@ -4,21 +4,21 @@
<item android:id="@+id/newBookmark"
android:icon="@drawable/icon_menu_add"
android:title="@string/menu_new_bookmark"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/appSettings"
android:icon="@drawable/icon_menu_settings"
android:title="@string/menu_app_settings"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/help"
android:icon="@drawable/icon_menu_help"
android:title="@string/menu_help"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/about"
android:icon="@drawable/icon_menu_about"
android:title="@string/menu_about"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/exit"
android:icon="@drawable/icon_menu_exit"
android:title="@string/menu_exit"
/>
</menu>

View File

@ -5,22 +5,27 @@
<item android:id="@+id/session_touch_pointer"
android:title="@string/pointer"
android:icon="@drawable/icon_zoom_in"
android:showAsAction="ifRoom"
/>
-->
<item android:id="@+id/session_touch_pointer"
android:title="@string/menu_touch_pointer"
android:icon="@drawable/icon_menu_touch_pointer"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/session_sys_keyboard"
android:title="@string/menu_sys_keyboard"
android:icon="@drawable/icon_menu_sys_keyboard"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/session_ext_keyboard"
android:title="@string/menu_ext_keyboard"
android:icon="@drawable/icon_menu_ext_keyboard"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/session_disconnect"
android:title="@string/menu_disconnect"
android:icon="@drawable/icon_menu_disconnect"
android:showAsAction="ifRoom"
/>
</menu>

View File

@ -23,7 +23,7 @@
<string name="menu_ext_keyboard">Funcion teclado</string>
<string name="menu_touch_pointer">Puntero Tactil</string>
<string name="menu_home">Inicio</string>
<string name="menu_disconnect">desconectart</string>
<string name="menu_disconnect">Desconectart</string>
<!-- List section headers -->
<string name="section_bookmarks">Conexión Manual</string>
<string name="section_active_sessions">Sesiones Activas</string>
@ -197,4 +197,6 @@
<string name="dlg_msg_exit">Esta seguro que desea salir del programa?</string>
<string name="dlg_title_clear_cert_cache">Borrar Certificados?</string>
<string name="dlg_msg_clear_cert_cache">Esta seguro que desea borrar todos los certificados?</string>
<string name="debug_level">Debug Level</string>
<string name="settings_debug">Debug Settings</string>
</resources>

View File

@ -196,4 +196,6 @@
<string name="dlg_msg_exit">"Êtes-vous sûr de vouloir quitter l'application?"</string>
<string name="dlg_title_clear_cert_cache">"Êtes-vous sûrs de vouloir supprimer les certificats?"</string>
<string name="dlg_msg_clear_cert_cache">"Êtes-vous sûr de vouloir supprimer tous les certificats mis en cache?"</string>
<string name="debug_level">Debug Level</string>
<string name="settings_debug">Debug Settings</string>
</resources>

View File

@ -197,4 +197,6 @@
<string name="dlg_msg_exit">Weet u zeker dat u de applicatie wilt sluiten?</string>
<string name="dlg_title_clear_cert_cache">Verwijder certificaten?</string>
<string name="dlg_msg_clear_cert_cache">Weet u zeker dat u al uw cache certificaten wilt verwijderen?</string>
<string name="debug_level">Debug Level</string>
<string name="settings_debug">Debug Settings</string>
</resources>

View File

@ -23,7 +23,7 @@
<string name="menu_ext_keyboard">Function Keys</string>
<string name="menu_touch_pointer">Touch Pointer</string>
<string name="menu_home">home</string>
<string name="menu_disconnect">disconnect</string>
<string name="menu_disconnect">Disconnect</string>
<!-- List section headers -->
<string name="section_bookmarks">Manual Connections</string>
<string name="section_active_sessions">Active Sessions</string>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="Theme.Settings" parent="android:Theme.Light">
<style name="Theme.Settings" parent="@style/Theme.AppCompat">
<item name="android:listSeparatorTextViewStyle">@style/SettingsCategory</item>
</style>
<style name="Theme.Main" parent="android:Theme.Light">
<style name="Theme.Main" parent="@style/Theme.AppCompat">
</style>
<style name="SettingsCategory">
<item name="android:layout_width">match_parent</item>

View File

@ -363,10 +363,6 @@ public class HomeActivity extends Activity
Intent helpIntent = new Intent(this, HelpActivity.class);
startActivity(helpIntent);
}
else if (itemId == R.id.exit)
{
finish();
}
else if (itemId == R.id.about)
{
Intent aboutIntent = new Intent(this, AboutActivity.class);

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>

View File

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -27,7 +27,7 @@ option(ANDROID_BUILD_JAVA "Automatically android java code - build type depends
option(ANDROID_BUILD_JAVA_DEBUG "Create a android debug package" ${JAVA_DEBUG_DEFAULT})
set(ANDROID_APP_VERSION 3 CACHE STRING "Application version")
set(ANDROID_APP_TARGET_SDK 11 CACHE STRING "Application target android SDK")
set(ANDROID_APP_TARGET_SDK 14 CACHE STRING "Application target android SDK")
set(ANDROID_APP_MIN_SDK 9 CACHE STRING "Application minimum android SDK requirement")
set(ANDROID_APP_GOOGLE_TARGET_SDK "16" CACHE STRING "Application target google SDK")

View File

@ -32,7 +32,8 @@ typedef int (*psRdpsndStop)(RdpsndServerContext* context);
typedef BOOL (*psRdpsndServerInitialize)(RdpsndServerContext* context);
typedef BOOL (*psRdpsndServerSelectFormat)(RdpsndServerContext* context, int client_format_index);
typedef BOOL (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, int nframes);
typedef BOOL (*psRdpsndServerSendSamples)(RdpsndServerContext* context, const void* buf, int nframes, UINT16 wTimestamp);
typedef BOOL (*psRdpsndServerConfirmBlock)(RdpsndServerContext* context, BYTE confirmBlockNum, UINT16 wtimestamp);
typedef BOOL (*psRdpsndServerSetVolume)(RdpsndServerContext* context, int left, int right);
typedef BOOL (*psRdpsndServerClose)(RdpsndServerContext* context);
@ -82,6 +83,10 @@ struct _rdpsnd_server_context
* nframes * src_format.nBitsPerSample * src_format.nChannels / 8
*/
psRdpsndServerSendSamples SendSamples;
/**
* Called when block confirm is received from the client
*/
psRdpsndServerConfirmBlock ConfirmBlock;
/**
* Set the volume level of the client. Valid range is between 0 and 0xFFFF.
*/

View File

@ -197,7 +197,8 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
return ;
}
rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData, inBuffer->mAudioDataByteSize/4);
rState->snd_context->SendSamples(rState->snd_context, inBuffer->mAudioData,
inBuffer->mAudioDataByteSize/4, (UINT16)(GetTickCount() & 0xffff));
status = AudioQueueEnqueueBuffer(
rState->queue,

View File

@ -162,8 +162,8 @@ DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam)
//FIXME: frames = bytes/(bytespersample * channels)
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData, dwCaptureLength/4);
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData2, dwCaptureLength2/4);
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData, dwCaptureLength/4, (UINT16)(beg & 0xffff));
context->rdpsnd->SendSamples(context->rdpsnd, pbCaptureData2, dwCaptureLength2/4, (UINT16)(beg & 0xffff));
hr = capBuf->lpVtbl->Unlock(capBuf, pbCaptureData, dwCaptureLength, pbCaptureData2, dwCaptureLength2);

View File

@ -271,7 +271,7 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
//Here we are writing the audio data
//not sure if this flag is ever set by the system; msdn is not clear about it
if (!(flags & AUDCLNT_BUFFERFLAGS_SILENT))
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength);
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength, (UINT16)(GetTickCount() & 0xffff));
hr = pCaptureClient->lpVtbl->ReleaseBuffer(pCaptureClient, numFramesAvailable);
if (FAILED(hr))
@ -313,4 +313,4 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
CoUninitialize();
return 0;
}
}

View File

@ -333,7 +333,11 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
pipe = (WINPR_PIPE*) Object;
io_status = read(pipe->fd, lpBuffer, nNumberOfBytesToRead);
do
{
io_status = read(pipe->fd, lpBuffer, nNumberOfBytesToRead);
}
while ((io_status < 0) && (errno == EINTR));
if (io_status < 0)
{
@ -364,7 +368,11 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
if (pipe->clientfd == -1)
return FALSE;
io_status = read(pipe->clientfd, lpBuffer, nNumberOfBytesToRead);
do
{
io_status = read(pipe->clientfd, lpBuffer, nNumberOfBytesToRead);
}
while ((io_status < 0) && (errno == EINTR));
if (io_status == 0)
{
@ -478,7 +486,11 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
pipe = (WINPR_PIPE*) Object;
io_status = write(pipe->fd, lpBuffer, nNumberOfBytesToWrite);
do
{
io_status = write(pipe->fd, lpBuffer, nNumberOfBytesToWrite);
}
while ((io_status < 0) && (errno == EINTR));
if ((io_status < 0) && (errno == EWOULDBLOCK))
io_status = 0;
@ -501,7 +513,11 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
if (pipe->clientfd == -1)
return FALSE;
io_status = write(pipe->clientfd, lpBuffer, nNumberOfBytesToWrite);
do
{
io_status = write(pipe->clientfd, lpBuffer, nNumberOfBytesToWrite);
}
while ((io_status < 0) && (errno == EINTR));
if (io_status < 0)
{