android: Fix sound redirection.
authorzihao.jiang <zihao.jiang@yahoo.com>
Fri, 26 Feb 2016 18:20:49 +0000 (02:20 +0800)
committerzihao.jiang <zihao.jiang@yahoo.com>
Sun, 28 Feb 2016 05:43:11 +0000 (13:43 +0800)
After #3097, the java side pass command line argument to JNI for freerdp settings. However there's several issues need to be fixed:
1. The argument /sound should be appended if freerdp is required to play sound at local device
2. The option value for "audio-mode" is not correct.
It should match the definition in client/common/cmdline.c
/* Audio Mode */
define AUDIO_MODE_REDIRECT     0 /* Bring to this computer */
define AUDIO_MODE_PLAY_ON_SERVER   1 /* Leave at remote computer */
define AUDIO_MODE_NONE         2 /* Do not play */
3. Uncomment support for WAVE_FORMAT_PCM in audin. I tested on my android phone and Nokia N1 tablet. It works on both device

channels/audin/client/opensles/audin_opensl_es.c
client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/services/LibFreeRDP.java
client/Android/Studio/freeRDPCore/src/main/res/values-de/strings.xml
client/Android/Studio/freeRDPCore/src/main/res/values-es/strings.xml
client/Android/Studio/freeRDPCore/src/main/res/values-fr/strings.xml
client/Android/Studio/freeRDPCore/src/main/res/values-nl/strings.xml
client/Android/Studio/freeRDPCore/src/main/res/values-zh/strings.xml
client/Android/Studio/freeRDPCore/src/main/res/values/strings.xml

index 51917e4..a9123c5 100644 (file)
@@ -218,8 +218,6 @@ static BOOL audin_opensles_format_supported(IAudinDevice* device, audinFormat* f
 
        switch (format->wFormatTag)
        {
-               /* TODO: Deactivated, untested */
-#if 0
                case WAVE_FORMAT_PCM: /* PCM */
                        if (format->cbSize == 0 &&
                                (format->nSamplesPerSec <= 48000) &&
@@ -229,7 +227,6 @@ static BOOL audin_opensles_format_supported(IAudinDevice* device, audinFormat* f
                                return TRUE;
                        }
                        break;
-#endif
                        /* TODO: Deactivated format, does not work, find out why */
 //             case WAVE_FORMAT_ADPCM: /* IMA ADPCM */
                case WAVE_FORMAT_DVI_ADPCM: 
index 0d77c12..d1d337a 100644 (file)
@@ -257,10 +257,13 @@ public class LibFreeRDP {
             }
         }
 
-        /* 0 ... disable
-           1 ... local
-           2 ... remote */
+        /* 0 ... local
+           1 ... remote 
+           2 ... disable */
         args.add("/audio-mode:" + String.valueOf(advanced.getRedirectSound()));
+        if (advanced.getRedirectSound() == 0) {
+            args.add("/sound");
+        }
 
         if (advanced.getRedirectMicrophone()) {
             args.add("/microphone");
index 491f11d..0c724e8 100644 (file)
         <item>Auf Client abspielen</item>
     </string-array>
     <string-array name="redirect_sound_values_array">
-        <item>0</item>
-        <item>1</item>
         <item>2</item>
+        <item>1</item>
+        <item>0</item>
     </string-array>
     <string name="settings_redirect_microphone">Mikrophon umleiten</string>
     <string name="settings_security">Sicherheit</string>
index 1616299..74ef6fe 100644 (file)
         <item>Play on Device</item>\r
     </string-array>\r
     <string-array name="redirect_sound_values_array">\r
-        <item>0</item>\r
-        <item>1</item>\r
         <item>2</item>\r
+        <item>1</item>\r
+        <item>0</item>\r
     </string-array>\r
     <string name="settings_redirect_microphone">Redirect Microphone</string>\r
     <string name="settings_security">Seguridad</string>\r
index be4be24..abb6636 100644 (file)
         <item>Play on Device</item>
     </string-array>
     <string-array name="redirect_sound_values_array">
-        <item>0</item>
-        <item>1</item>
         <item>2</item>
+        <item>1</item>
+        <item>0</item>
     </string-array>
     <string name="settings_redirect_microphone">Redirect Microphone</string>
     <string name="settings_security">"Securité"</string>
index 6167cb1..3f23c0e 100644 (file)
         <item>Play on Device</item>
     </string-array>
     <string-array name="redirect_sound_values_array">
-        <item>0</item>
-        <item>1</item>
         <item>2</item>
+        <item>1</item>
+        <item>0</item>
     </string-array>
     <string name="settings_redirect_microphone">Redirect Microphone</string>
     <string name="settings_security">Beveiliging</string>
index bb98f94..3b57c00 100644 (file)
         <item>在此设备上播放</item>
     </string-array>
     <string-array name="redirect_sound_values_array">
-        <item>0</item>
-        <item>1</item>
         <item>2</item>
+        <item>1</item>
+        <item>0</item>
     </string-array>
     <string name="settings_redirect_microphone">麦克风重定向</string>
     <string name="settings_security">连接协议</string>
index 495c9b8..611382f 100644 (file)
         <item>Play on Device</item>
     </string-array>
     <string-array name="redirect_sound_values_array">
-        <item>0</item>
-        <item>1</item>
         <item>2</item>
+        <item>1</item>
+        <item>0</item>
     </string-array>
     <string name="settings_redirect_microphone">Redirect Microphone</string>
     <string name="settings_security">Security</string>