Merge pull request #2 from bmiklautz/pull/2785

rdpsnd: restore old behavior and fixes
This commit is contained in:
MartinHaimberger 2015-07-20 15:10:55 +02:00
commit 08b17b5f64
4 changed files with 88 additions and 103 deletions

View File

@ -670,10 +670,13 @@ WIN32ERROR freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_PO
alsa->device.Free = rdpsnd_alsa_free; alsa->device.Free = rdpsnd_alsa_free;
args = pEntryPoints->args; args = pEntryPoints->args;
if ((error = rdpsnd_alsa_parse_addin_args((rdpsndDevicePlugin*) alsa, args))) if (args->argc > 1)
{ {
WLog_ERR(TAG, "rdpsnd_alsa_parse_addin_args failed with error %lu", error); if ((error = rdpsnd_alsa_parse_addin_args((rdpsndDevicePlugin *) alsa, args)))
goto error_parse_args; {
WLog_ERR(TAG, "rdpsnd_alsa_parse_addin_args failed with error %lu", error);
goto error_parse_args;
}
} }

View File

@ -654,11 +654,14 @@ WIN32ERROR freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_PO
pulse->device.Free = rdpsnd_pulse_free; pulse->device.Free = rdpsnd_pulse_free;
args = pEntryPoints->args; args = pEntryPoints->args;
ret = rdpsnd_pulse_parse_addin_args((rdpsndDevicePlugin*) pulse, args); if (args->argc > 1)
if (ret != CHANNEL_RC_OK)
{ {
WLog_ERR(TAG, "error parsing arguments"); ret = rdpsnd_pulse_parse_addin_args((rdpsndDevicePlugin *) pulse, args);
goto error; if (ret != CHANNEL_RC_OK)
{
WLog_ERR(TAG, "error parsing arguments");
goto error;
}
} }
ret = CHANNEL_RC_NO_MEMORY; ret = CHANNEL_RC_NO_MEMORY;

View File

@ -36,9 +36,6 @@
#include <winpr/crt.h> #include <winpr/crt.h>
#include <winpr/wlog.h> #include <winpr/wlog.h>
#include <winpr/synch.h>
#include <winpr/print.h>
#include <winpr/thread.h>
#include <winpr/stream.h> #include <winpr/stream.h>
#include <winpr/cmdline.h> #include <winpr/cmdline.h>
#include <winpr/sysinfo.h> #include <winpr/sysinfo.h>
@ -46,9 +43,6 @@
#include <freerdp/types.h> #include <freerdp/types.h>
#include <freerdp/addin.h> #include <freerdp/addin.h>
#include <freerdp/constants.h>
#include <freerdp/channels/log.h>
#include <freerdp/utils/signal.h>
#include "rdpsnd_main.h" #include "rdpsnd_main.h"
@ -751,75 +745,78 @@ static WIN32ERROR rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* ar
rdpsnd->wQualityMode = HIGH_QUALITY; /* default quality mode */ rdpsnd->wQualityMode = HIGH_QUALITY; /* default quality mode */
flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv, if (args->argc > 1)
rdpsnd_args, flags, rdpsnd, NULL, NULL);
if (status < 0)
return CHANNEL_RC_INITIALIZATION_ERROR;
arg = rdpsnd_args;
do
{ {
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT)) flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
continue; status = CommandLineParseArgumentsA(args->argc, (const char **) args->argv,
rdpsnd_args, flags, rdpsnd, NULL, NULL);
CommandLineSwitchStart(arg) if (status < 0)
return CHANNEL_RC_INITIALIZATION_ERROR;
CommandLineSwitchCase(arg, "sys") arg = rdpsnd_args;
{
if (!rdpsnd_set_subsystem(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "dev")
{
if (!rdpsnd_set_device_name(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "format")
{
rdpsnd->fixedFormat = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "rate")
{
rdpsnd->fixedRate = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "channel")
{
rdpsnd->fixedChannel = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "latency")
{
rdpsnd->latency = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "quality")
{
int wQualityMode = DYNAMIC_QUALITY;
if (_stricmp(arg->Value, "dynamic") == 0) do
wQualityMode = DYNAMIC_QUALITY;
else if (_stricmp(arg->Value, "medium") == 0)
wQualityMode = MEDIUM_QUALITY;
else if (_stricmp(arg->Value, "high") == 0)
wQualityMode = HIGH_QUALITY;
else
wQualityMode = atoi(arg->Value);
if ((wQualityMode < 0) || (wQualityMode > 2))
wQualityMode = DYNAMIC_QUALITY;
rdpsnd->wQualityMode = (UINT16) wQualityMode;
}
CommandLineSwitchDefault(arg)
{ {
if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
continue;
CommandLineSwitchStart(arg)
CommandLineSwitchCase(arg, "sys")
{
if (!rdpsnd_set_subsystem(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "dev")
{
if (!rdpsnd_set_device_name(rdpsnd, arg->Value))
return CHANNEL_RC_NO_MEMORY;
}
CommandLineSwitchCase(arg, "format")
{
rdpsnd->fixedFormat = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "rate")
{
rdpsnd->fixedRate = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "channel")
{
rdpsnd->fixedChannel = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "latency")
{
rdpsnd->latency = atoi(arg->Value);
}
CommandLineSwitchCase(arg, "quality")
{
int wQualityMode = DYNAMIC_QUALITY;
if (_stricmp(arg->Value, "dynamic") == 0)
wQualityMode = DYNAMIC_QUALITY;
else if (_stricmp(arg->Value, "medium") == 0)
wQualityMode = MEDIUM_QUALITY;
else if (_stricmp(arg->Value, "high") == 0)
wQualityMode = HIGH_QUALITY;
else
wQualityMode = atoi(arg->Value);
if ((wQualityMode < 0) || (wQualityMode > 2))
wQualityMode = DYNAMIC_QUALITY;
rdpsnd->wQualityMode = (UINT16) wQualityMode;
}
CommandLineSwitchDefault(arg)
{
}
CommandLineSwitchEnd(arg)
} }
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
CommandLineSwitchEnd(arg)
} }
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
@ -827,7 +824,7 @@ static WIN32ERROR rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* ar
static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd) static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
{ {
ADDIN_ARGV* args; ADDIN_ARGV* args;
WIN32ERROR status; WIN32ERROR status = ERROR_INTERNAL_ERROR;
char *subsystem_name = NULL, *device_name = NULL; char *subsystem_name = NULL, *device_name = NULL;
rdpsnd->latency = -1; rdpsnd->latency = -1;
@ -859,10 +856,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "ios"; subsystem_name = "ios";
device_name = ""; device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
@ -872,10 +866,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "opensles"; subsystem_name = "opensles";
device_name = ""; device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
@ -885,10 +876,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "pulse"; subsystem_name = "pulse";
device_name = ""; device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
@ -898,10 +886,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "alsa"; subsystem_name = "alsa";
device_name = "default"; device_name = "default";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
@ -911,10 +896,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "oss"; subsystem_name = "oss";
device_name = ""; device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
@ -925,10 +907,7 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "mac"; subsystem_name = "mac";
device_name = "default"; device_name = "default";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
@ -938,12 +917,11 @@ static WIN32ERROR rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
subsystem_name = "winmm"; subsystem_name = "winmm";
device_name = ""; device_name = "";
if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args))) if ((status = rdpsnd_load_device_plugin(rdpsnd, subsystem_name, args)))
{ WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", subsystem_name, status);
WLog_ERR(TAG, "unable to load the %s subsystem plugin because of error %lu", rdpsnd->subsystem, status);
return status;
}
} }
#endif #endif
if (status)
return status;
if (rdpsnd->device) if (rdpsnd->device)
{ {

View File

@ -211,8 +211,9 @@ static UINT64 tsmf_oss_get_latency(ITSMFAudioDevice* audio)
return latency; return latency;
} }
static void tsmf_oss_flush(ITSMFAudioDevice* audio) static BOOL tsmf_oss_flush(ITSMFAudioDevice* audio)
{ {
return TRUE;
} }
static void tsmf_oss_free(ITSMFAudioDevice* audio) static void tsmf_oss_free(ITSMFAudioDevice* audio)