Run indent-all.sh script on source
This commit is contained in:
parent
6a14831965
commit
c16b74a974
@ -92,7 +92,8 @@ channel_send(STREAM s, VCHANNEL * channel)
|
||||
s_pop_layer(s, channel_hdr);
|
||||
length = s->end - s->p - 8;
|
||||
|
||||
logger(Protocol, Debug, "channel_send(), channel = %d, length = %d", channel->mcs_id, length);
|
||||
logger(Protocol, Debug, "channel_send(), channel = %d, length = %d", channel->mcs_id,
|
||||
length);
|
||||
|
||||
thislength = MIN(length, CHANNEL_CHUNK_LENGTH);
|
||||
/* Note: In the original clipboard implementation, this number was
|
||||
|
9
dvc.c
9
dvc.c
@ -33,9 +33,11 @@
|
||||
#define DYNVC_SOFT_SYNC_REQUEST 0x08
|
||||
#define DYNVC_SOFT_SYNC_RESPONSE 0x09
|
||||
|
||||
typedef union dvc_hdr_t {
|
||||
typedef union dvc_hdr_t
|
||||
{
|
||||
uint8 data;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
uint8 cbid:2;
|
||||
uint8 sp:2;
|
||||
uint8 cmd:4;
|
||||
@ -147,7 +149,8 @@ dvc_channels_add(const char *name, dvc_channel_process_fn handler, uint32 channe
|
||||
}
|
||||
}
|
||||
|
||||
logger(Core, Warning, "dvc_channels_add(), Failed to add channel, maximum number of channels are being used");
|
||||
logger(Core, Warning,
|
||||
"dvc_channels_add(), Failed to add channel, maximum number of channels are being used");
|
||||
return False;
|
||||
}
|
||||
|
||||
|
4
proto.h
4
proto.h
@ -274,8 +274,8 @@ void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8
|
||||
void ui_destroy_bitmap(RD_HBITMAP bmp);
|
||||
RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data);
|
||||
void ui_destroy_glyph(RD_HGLYPH glyph);
|
||||
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, uint32 width, uint32 height, uint8 * andmask,
|
||||
uint8 * xormask, int bpp);
|
||||
RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, uint32 width, uint32 height,
|
||||
uint8 * andmask, uint8 * xormask, int bpp);
|
||||
void ui_set_cursor(RD_HCURSOR cursor);
|
||||
void ui_destroy_cursor(RD_HCURSOR cursor);
|
||||
void ui_set_null_cursor(void);
|
||||
|
25
rdesktop.c
25
rdesktop.c
@ -118,8 +118,7 @@ RD_BOOL g_seamless_persistent_mode = True;
|
||||
RD_BOOL g_user_quit = False;
|
||||
uint32 g_embed_wnd;
|
||||
uint32 g_rdp5_performanceflags = (PERF_DISABLE_FULLWINDOWDRAG |
|
||||
PERF_DISABLE_MENUANIMATIONS |
|
||||
PERF_ENABLE_FONT_SMOOTHING);
|
||||
PERF_DISABLE_MENUANIMATIONS | PERF_ENABLE_FONT_SMOOTHING);
|
||||
/* Session Directory redirection */
|
||||
RD_BOOL g_redirect = False;
|
||||
char *g_redirect_server;
|
||||
@ -479,9 +478,12 @@ handle_disconnect_reason(RD_BOOL deactivated, uint16 reason)
|
||||
retval = EXRD_UNKNOWN;
|
||||
}
|
||||
|
||||
if (reason > 0x1000 && reason < 0x7fff && retval == EXRD_UNKNOWN) {
|
||||
if (reason > 0x1000 && reason < 0x7fff && retval == EXRD_UNKNOWN)
|
||||
{
|
||||
fprintf(stderr, "Internal protocol error: %x", reason);
|
||||
} else if (reason != ERRINFO_NO_INFO) {
|
||||
}
|
||||
else if (reason != ERRINFO_NO_INFO)
|
||||
{
|
||||
fprintf(stderr, "disconnect: %s.\n", text);
|
||||
}
|
||||
|
||||
@ -598,7 +600,8 @@ parse_server_and_port(char *server)
|
||||
}
|
||||
|
||||
// [WxH|P%|W%xH%][@DPI][+X[+Y]]|workarea
|
||||
int parse_geometry_string(const char *optarg)
|
||||
int
|
||||
parse_geometry_string(const char *optarg)
|
||||
{
|
||||
sint32 value;
|
||||
const char *ps;
|
||||
@ -643,7 +646,8 @@ int parse_geometry_string(const char *optarg)
|
||||
value = strtol(ps, &pe, 10);
|
||||
if (ps == pe || value <= 0)
|
||||
{
|
||||
logger(Core, Error, "invalid geometry, expected positive integer for height");
|
||||
logger(Core, Error,
|
||||
"invalid geometry, expected positive integer for height");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -745,7 +749,8 @@ setup_user_requested_session_size()
|
||||
break;
|
||||
|
||||
case Workarea:
|
||||
ui_get_workarea_size(&g_requested_session_width, &g_requested_session_height);
|
||||
ui_get_workarea_size(&g_requested_session_width,
|
||||
&g_requested_session_height);
|
||||
break;
|
||||
|
||||
case Fixed:
|
||||
@ -1359,7 +1364,8 @@ main(int argc, char *argv[])
|
||||
g_network_error = False;
|
||||
}
|
||||
|
||||
utils_apply_session_size_limitations(&g_requested_session_width, &g_requested_session_height);
|
||||
utils_apply_session_size_limitations(&g_requested_session_width,
|
||||
&g_requested_session_height);
|
||||
|
||||
if (!rdp_connect
|
||||
(server, flags, domain, g_password, shell, directory, g_reconnect_loop))
|
||||
@ -1461,7 +1467,8 @@ main(int argc, char *argv[])
|
||||
else if (g_pending_resize)
|
||||
{
|
||||
/* Enter a reconnect loop if we have a pending resize request */
|
||||
logger(Core, Verbose, "Resize reconnect loop triggered, new size %dx%d",
|
||||
logger(Core, Verbose,
|
||||
"Resize reconnect loop triggered, new size %dx%d",
|
||||
g_requested_session_width, g_requested_session_height);
|
||||
g_pending_resize = False;
|
||||
g_reconnect_loop = True;
|
||||
|
27
rdp.c
27
rdp.c
@ -496,7 +496,8 @@ rdp_send_client_info_pdu(uint32 flags, char *domain, char *user,
|
||||
/* Client Auto-Reconnect */
|
||||
if (g_has_reconnect_random)
|
||||
{
|
||||
logger(Protocol, Debug, "rdp_send_logon_info(), Sending auto-reconnect cookie.");
|
||||
logger(Protocol, Debug,
|
||||
"rdp_send_logon_info(), Sending auto-reconnect cookie.");
|
||||
out_uint16_le(s, 28); /* cbAutoReconnectLen */
|
||||
/* ARC_CS_PRIVATE_PACKET */
|
||||
out_uint32_le(s, 28); /* cbLen */
|
||||
@ -1029,8 +1030,7 @@ rdp_send_confirm_active(void)
|
||||
RDP_CAPLEN_SOUND +
|
||||
RDP_CAPLEN_GLYPHCACHE +
|
||||
RDP_CAPLEN_MULTIFRAGMENTUPDATE +
|
||||
RDP_CAPLEN_LARGE_POINTER +
|
||||
4 /* w2k fix, sessionid */ ;
|
||||
RDP_CAPLEN_LARGE_POINTER + 4 /* w2k fix, sessionid */ ;
|
||||
|
||||
logger(Protocol, Debug, "%s()", __func__);
|
||||
|
||||
@ -1277,7 +1277,8 @@ process_colour_pointer_common(STREAM s, int bpp)
|
||||
/* keep hotspot within cursor bounding box */
|
||||
x = MIN(x, width - 1);
|
||||
y = MIN(y, height - 1);
|
||||
if (g_local_cursor) return ; /* don't bother creating a cursor we won't use */
|
||||
if (g_local_cursor)
|
||||
return; /* don't bother creating a cursor we won't use */
|
||||
cursor = ui_create_cursor(x, y, width, height, mask, data, bpp);
|
||||
ui_set_cursor(cursor);
|
||||
cache_put_cursor(cache_idx, cursor);
|
||||
@ -1342,8 +1343,7 @@ set_system_pointer(uint32 ptr)
|
||||
break;
|
||||
default:
|
||||
logger(Protocol, Warning,
|
||||
"set_system_pointer(), unhandled pointer type 0x%x",
|
||||
ptr);
|
||||
"set_system_pointer(), unhandled pointer type 0x%x", ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1594,17 +1594,20 @@ process_pdu_logon(STREAM s)
|
||||
switch (infotype)
|
||||
{
|
||||
case INFOTYPE_LOGON_PLAINNOTIFY: /* TS_PLAIN_NOTIFY */
|
||||
logger(Protocol, Debug, "process_pdu_logon(), Received TS_LOGIN_PLAIN_NOTIFY");
|
||||
logger(Protocol, Debug,
|
||||
"process_pdu_logon(), Received TS_LOGIN_PLAIN_NOTIFY");
|
||||
in_uint8s(s, 576); /* pad */
|
||||
break;
|
||||
|
||||
case INFOTYPE_LOGON_EXTENDED_INF: /* TS_LOGON_INFO_EXTENDED */
|
||||
logger(Protocol, Debug, "process_pdu_logon(), Received TS_LOGIN_INFO_EXTENDED");
|
||||
logger(Protocol, Debug,
|
||||
"process_pdu_logon(), Received TS_LOGIN_INFO_EXTENDED");
|
||||
process_ts_logon_info_extended(s);
|
||||
break;
|
||||
|
||||
default:
|
||||
logger(Protocol, Warning, "process_pdu_logon(), Unhandled login infotype %d", infotype);
|
||||
logger(Protocol, Warning,
|
||||
"process_pdu_logon(), Unhandled login infotype %d", infotype);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1615,7 +1618,8 @@ process_ts_set_error_info_pdu(STREAM s, uint32 * ext_disc_reason)
|
||||
{
|
||||
in_uint32_le(s, *ext_disc_reason);
|
||||
|
||||
logger(Protocol, Debug, "process_ts_set_error_info_pdu(), error info = %d", *ext_disc_reason);
|
||||
logger(Protocol, Debug, "process_ts_set_error_info_pdu(), error info = %d",
|
||||
*ext_disc_reason);
|
||||
}
|
||||
|
||||
/* Process data PDU */
|
||||
@ -1908,7 +1912,8 @@ rdp_main_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason)
|
||||
{
|
||||
g_exit_mainloop = True;
|
||||
}
|
||||
} while(g_exit_mainloop == False);
|
||||
}
|
||||
while (g_exit_mainloop == False);
|
||||
}
|
||||
|
||||
/* used in uiports and rdp_main_loop, processes the RDP packets waiting */
|
||||
|
7
rdp5.c
7
rdp5.c
@ -69,8 +69,8 @@ process_ts_fp_update_by_code(STREAM s, uint8 code)
|
||||
process_new_pointer_pdu(s);
|
||||
break;
|
||||
default:
|
||||
logger(Protocol, Warning, "process_ts_fp_updates_by_code(), unhandled opcode %d",
|
||||
code);
|
||||
logger(Protocol, Warning,
|
||||
"process_ts_fp_updates_by_code(), unhandled opcode %d", code);
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +135,8 @@ process_ts_fp_updates(STREAM s)
|
||||
{
|
||||
assembled[code] = xmalloc(sizeof(struct stream));
|
||||
memset(assembled[code], 0, sizeof(struct stream));
|
||||
s_realloc(assembled[code], RDESKTOP_FASTPATH_MULTIFRAGMENT_MAX_SIZE);
|
||||
s_realloc(assembled[code],
|
||||
RDESKTOP_FASTPATH_MULTIFRAGMENT_MAX_SIZE);
|
||||
s_reset(assembled[code]);
|
||||
}
|
||||
|
||||
|
4
rdpdr.c
4
rdpdr.c
@ -284,7 +284,9 @@ rdpdr_send_client_device_list_announce(void)
|
||||
STREAM s;
|
||||
PRINTER *printerinfo;
|
||||
DISK_DEVICE *diskinfo;
|
||||
struct stream drv = {0}, prt = {0};
|
||||
struct stream drv = { 0 }, prt =
|
||||
{
|
||||
0};
|
||||
|
||||
s = channel_init(rdpdr_channel, announcedata_size());
|
||||
out_uint16_le(s, RDPDR_CTYP_CORE);
|
||||
|
@ -89,8 +89,8 @@ rdpedisp_send_monitor_layout_pdu(uint32 width, uint32 height)
|
||||
|
||||
memset(&s, 0, sizeof(s));
|
||||
|
||||
logger(Protocol, Debug, "rdpedisp_send_monitor_layout_pdu(), width = %d, height = %d", width,
|
||||
height);
|
||||
logger(Protocol, Debug, "rdpedisp_send_monitor_layout_pdu(), width = %d, height = %d",
|
||||
width, height);
|
||||
|
||||
rdpedisp_init_packet(&s, DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT, 16 + 1 * 40);
|
||||
|
||||
|
248
rdpsnd_pulse.c
248
rdpsnd_pulse.c
@ -88,7 +88,8 @@ static RD_BOOL pulse_init(void);
|
||||
static void pulse_deinit(void);
|
||||
static RD_BOOL pulse_context_init(void);
|
||||
static void pulse_context_deinit(void);
|
||||
static RD_BOOL pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplewidth, pa_stream_flags_t flags);
|
||||
static RD_BOOL pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplewidth,
|
||||
pa_stream_flags_t flags);
|
||||
static void pulse_stream_close(pa_stream ** stream);
|
||||
|
||||
static void pulse_send_msg(int fd, char message);
|
||||
@ -127,12 +128,14 @@ pulse_init(void)
|
||||
mainloop = pa_threaded_mainloop_new();
|
||||
if (mainloop == NULL)
|
||||
{
|
||||
logger(Sound, Error, "pulse_init(), Error creating PulseAudio threaded mainloop");
|
||||
logger(Sound, Error,
|
||||
"pulse_init(), Error creating PulseAudio threaded mainloop");
|
||||
break;
|
||||
}
|
||||
if (pa_threaded_mainloop_start(mainloop) != 0)
|
||||
{
|
||||
logger(Sound, Error, "pulse_init(), Error starting PulseAudio threaded mainloop");
|
||||
logger(Sound, Error,
|
||||
"pulse_init(), Error starting PulseAudio threaded mainloop");
|
||||
break;
|
||||
}
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
@ -145,7 +148,8 @@ pulse_init(void)
|
||||
}
|
||||
if (pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "rdesktop") != 0)
|
||||
{
|
||||
logger(Sound, Error, "pulse_init(), Error setting option to PulseAudio proplist");
|
||||
logger(Sound, Error,
|
||||
"pulse_init(), Error setting option to PulseAudio proplist");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -210,13 +214,16 @@ pulse_context_init(void)
|
||||
break;
|
||||
}
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
context = pa_context_new_with_proplist(pa_threaded_mainloop_get_api(mainloop), NULL, proplist);
|
||||
context =
|
||||
pa_context_new_with_proplist(pa_threaded_mainloop_get_api(mainloop), NULL,
|
||||
proplist);
|
||||
#else
|
||||
context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "rdesktop");
|
||||
#endif
|
||||
if (context == NULL)
|
||||
{
|
||||
logger(Sound, Error, "pulse_context_init(), error creating PulseAudio context");
|
||||
logger(Sound, Error,
|
||||
"pulse_context_init(), error creating PulseAudio context");
|
||||
break;
|
||||
}
|
||||
pa_context_set_state_callback(context, pulse_context_state_cb, mainloop);
|
||||
@ -295,7 +302,8 @@ pulse_context_deinit(void)
|
||||
}
|
||||
|
||||
static RD_BOOL
|
||||
pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplewidth, pa_stream_flags_t flags)
|
||||
pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplewidth,
|
||||
pa_stream_flags_t flags)
|
||||
{
|
||||
pa_sample_spec samples;
|
||||
pa_buffer_attr buffer_attr;
|
||||
@ -318,7 +326,8 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
#if PA_CHECK_VERSION(0,9,13)
|
||||
if (pa_sample_spec_init(&samples) == NULL)
|
||||
{
|
||||
logger(Sound, Error, "pulse_stream_open(), error initializing PulseAudio sample format");
|
||||
logger(Sound, Error,
|
||||
"pulse_stream_open(), error initializing PulseAudio sample format");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -328,22 +337,29 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
samples.format = PA_SAMPLE_U8;
|
||||
else
|
||||
{
|
||||
logger(Sound, Error, "pulse_stream_open(), wrong samplewidth for the PulseAudio stream: %d", samplewidth);
|
||||
logger(Sound, Error,
|
||||
"pulse_stream_open(), wrong samplewidth for the PulseAudio stream: %d",
|
||||
samplewidth);
|
||||
break;
|
||||
}
|
||||
samples.rate = samplerate;
|
||||
samples.channels = channels;
|
||||
if (!pa_sample_spec_valid(&samples))
|
||||
{
|
||||
logger(Sound, Error, "pulse_stream_open(), Invalid PulseAudio sample format");
|
||||
logger(Sound, Error,
|
||||
"pulse_stream_open(), Invalid PulseAudio sample format");
|
||||
break;
|
||||
}
|
||||
/* PulseAudio stream creation */
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
if (stream == &playback_stream)
|
||||
*stream = pa_stream_new_with_proplist(context, "Playback Stream", &samples, NULL, proplist);
|
||||
*stream =
|
||||
pa_stream_new_with_proplist(context, "Playback Stream", &samples,
|
||||
NULL, proplist);
|
||||
else
|
||||
*stream = pa_stream_new_with_proplist(context, "Capture Stream", &samples, NULL, proplist);
|
||||
*stream =
|
||||
pa_stream_new_with_proplist(context, "Capture Stream", &samples,
|
||||
NULL, proplist);
|
||||
#else
|
||||
if (stream == &playback_stream)
|
||||
*stream = pa_stream_new(context, "Playback Stream", &samples, NULL);
|
||||
@ -353,7 +369,8 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
if (*stream == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_stream_open(), pa_stream_new: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_stream_open(), pa_stream_new: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
pa_stream_set_state_callback(*stream, pulse_stream_state_cb, mainloop);
|
||||
@ -368,9 +385,12 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
if (stream == &playback_stream)
|
||||
{
|
||||
#if PA_CHECK_VERSION(0,9,0)
|
||||
buffer_attr.tlength = pa_usec_to_bytes(1000000/playback_latency_part, &samples);
|
||||
buffer_attr.tlength =
|
||||
pa_usec_to_bytes(1000000 / playback_latency_part, &samples);
|
||||
#else
|
||||
buffer_attr.tlength = (samples.rate/playback_latency_part) * samples.channels * (samples.format == PA_SAMPLE_S16LE ? 2 : 1);
|
||||
buffer_attr.tlength =
|
||||
(samples.rate / playback_latency_part) * samples.channels *
|
||||
(samples.format == PA_SAMPLE_S16LE ? 2 : 1);
|
||||
#endif
|
||||
buffer_attr.prebuf = 0;
|
||||
buffer_attr.maxlength = buffer_attr.tlength;
|
||||
@ -378,9 +398,12 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
else
|
||||
{
|
||||
#if PA_CHECK_VERSION(0,9,0)
|
||||
buffer_attr.fragsize = pa_usec_to_bytes(1000000/capture_latency_part, &samples);
|
||||
buffer_attr.fragsize =
|
||||
pa_usec_to_bytes(1000000 / capture_latency_part, &samples);
|
||||
#else
|
||||
buffer_attr.fragsize = (samples.rate/capture_latency_part) * samples.channels * (samples.format == PA_SAMPLE_S16LE ? 2 : 1);
|
||||
buffer_attr.fragsize =
|
||||
(samples.rate / capture_latency_part) * samples.channels *
|
||||
(samples.format == PA_SAMPLE_S16LE ? 2 : 1);
|
||||
#endif
|
||||
buffer_attr.maxlength = buffer_attr.fragsize;
|
||||
}
|
||||
@ -390,13 +413,16 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
#endif
|
||||
|
||||
if (stream == &playback_stream)
|
||||
err = pa_stream_connect_playback(*stream, device, &buffer_attr, flags, NULL, NULL);
|
||||
err = pa_stream_connect_playback(*stream, device, &buffer_attr, flags, NULL,
|
||||
NULL);
|
||||
else
|
||||
err = pa_stream_connect_record(*stream, device, &buffer_attr, flags);
|
||||
if (err)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_stream_open(), error connecting PulseAudio stream: %s", pa_strerror(err));
|
||||
logger(Sound, Error,
|
||||
"pulse_stream_open(), error connecting PulseAudio stream: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
do
|
||||
@ -411,7 +437,9 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
if (state != PA_STREAM_READY)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_stream_open(), error connecting PulseAudio stream: %s", pa_strerror(err));
|
||||
logger(Sound, Error,
|
||||
"pulse_stream_open(), error connecting PulseAudio stream: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -422,8 +450,10 @@ pulse_stream_open(pa_stream ** stream, int channels, int samplerate, int samplew
|
||||
#if PA_CHECK_VERSION(0,9,0)
|
||||
const pa_buffer_attr *res_ba;
|
||||
res_ba = pa_stream_get_buffer_attr(*stream);
|
||||
logger(Sound, Debug, "pulse_stream_open(), PulseAudio stream buffer metrics: maxlength %u, minreq %u, prebuf %u, tlength %u, fragsize %u",
|
||||
res_ba->maxlength, res_ba->minreq, res_ba->prebuf, res_ba->tlength, res_ba->fragsize);
|
||||
logger(Sound, Debug,
|
||||
"pulse_stream_open(), PulseAudio stream buffer metrics: maxlength %u, minreq %u, prebuf %u, tlength %u, fragsize %u",
|
||||
res_ba->maxlength, res_ba->minreq, res_ba->prebuf, res_ba->tlength,
|
||||
res_ba->fragsize);
|
||||
#endif
|
||||
|
||||
/* Set the data callbacks for the PulseAudio stream */
|
||||
@ -460,7 +490,9 @@ pulse_stream_close(pa_stream ** stream)
|
||||
if (pa_stream_disconnect(*stream) != 0)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_stream_close(), pa_stream_disconnect: %s\n", pa_strerror(err));
|
||||
logger(Sound, Error,
|
||||
"pulse_stream_close(), pa_stream_disconnect: %s\n",
|
||||
pa_strerror(err));
|
||||
}
|
||||
}
|
||||
pa_stream_unref(*stream);
|
||||
@ -480,7 +512,8 @@ pulse_send_msg(int fd, char message)
|
||||
ret = write(fd, &message, sizeof message);
|
||||
while (ret == -1 && errno == EINTR);
|
||||
if (ret == -1)
|
||||
logger(Sound, Error, "pulse_send_msg(), error writing message to the pipe: %s\n", strerror(errno));
|
||||
logger(Sound, Error, "pulse_send_msg(), error writing message to the pipe: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
static RD_BOOL
|
||||
@ -494,7 +527,8 @@ pulse_playback_start(void)
|
||||
|
||||
if (playback_stream == NULL)
|
||||
{
|
||||
logger(Sound, Warning, "pulse_playback_start(), trying to start PulseAudio stream while it's not exists");
|
||||
logger(Sound, Warning,
|
||||
"pulse_playback_start(), trying to start PulseAudio stream while it's not exists");
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -504,7 +538,8 @@ pulse_playback_start(void)
|
||||
{
|
||||
if (pa_stream_get_state(playback_stream) != PA_STREAM_READY)
|
||||
{
|
||||
logger(Sound, Warning, "pulse_playback_start(), trying to start PulseAudio stream while it's not ready");
|
||||
logger(Sound, Warning,
|
||||
"pulse_playback_start(), trying to start PulseAudio stream while it's not ready");
|
||||
break;
|
||||
}
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
@ -515,7 +550,8 @@ pulse_playback_start(void)
|
||||
if (ret < 0)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_playback_start(), pa_stream_is_corked: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_playback_start(), pa_stream_is_corked: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
else if (ret != 0)
|
||||
@ -524,7 +560,8 @@ pulse_playback_start(void)
|
||||
if (po == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_playback_start(), pa_stream_corked: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_playback_start(), pa_stream_corked: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -552,7 +589,8 @@ pulse_playback_stop(void)
|
||||
|
||||
if (playback_stream == NULL)
|
||||
{
|
||||
logger(Sound, Debug, "pulse_playback_stop(), trying to stop PulseAudio stream while it's not exists");
|
||||
logger(Sound, Debug,
|
||||
"pulse_playback_stop(), trying to stop PulseAudio stream while it's not exists");
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -562,7 +600,8 @@ pulse_playback_stop(void)
|
||||
{
|
||||
if (pa_stream_get_state(playback_stream) != PA_STREAM_READY)
|
||||
{
|
||||
logger(Sound, Error, "pulse_playback_stop(), trying to stop PulseAudio stream while it's not ready");
|
||||
logger(Sound, Error,
|
||||
"pulse_playback_stop(), trying to stop PulseAudio stream while it's not ready");
|
||||
break;
|
||||
}
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
@ -573,7 +612,8 @@ pulse_playback_stop(void)
|
||||
if (ret < 0)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_playback_stop(), pa_stream_is_corked: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_playback_stop(), pa_stream_is_corked: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
else if (ret == 0)
|
||||
@ -582,7 +622,8 @@ pulse_playback_stop(void)
|
||||
if (po == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_playback_stop(), pa_stream_cork: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_playback_stop(), pa_stream_cork: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -593,7 +634,8 @@ pulse_playback_stop(void)
|
||||
if (po == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_playback_stop(), pa_stream_flush: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_playback_stop(), pa_stream_flush: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -617,7 +659,8 @@ pulse_playback_set_audio(int channels, int samplerate, int samplewidth)
|
||||
|
||||
pulse_stream_close(&playback_stream);
|
||||
|
||||
flags = PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE;
|
||||
flags = PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING |
|
||||
PA_STREAM_AUTO_TIMING_UPDATE;
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
flags |= PA_STREAM_ADJUST_LATENCY;
|
||||
#endif
|
||||
@ -638,7 +681,8 @@ pulse_capture_start(void)
|
||||
|
||||
if (capture_stream == NULL)
|
||||
{
|
||||
logger(Sound, Warning, "pulse_capture_start(), trying to start PulseAudio stream while it's not exists");
|
||||
logger(Sound, Warning,
|
||||
"pulse_capture_start(), trying to start PulseAudio stream while it's not exists");
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -648,7 +692,8 @@ pulse_capture_start(void)
|
||||
{
|
||||
if (pa_stream_get_state(capture_stream) != PA_STREAM_READY)
|
||||
{
|
||||
logger(Sound, Error, "pulse_capture_start(), trying to start PulseAudio stream while it's not exists");
|
||||
logger(Sound, Error,
|
||||
"pulse_capture_start(), trying to start PulseAudio stream while it's not exists");
|
||||
break;
|
||||
}
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
@ -659,7 +704,8 @@ pulse_capture_start(void)
|
||||
if (ret < 0)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_capture_start(), pa_stream_is_corked: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_capture_start(), pa_stream_is_corked: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
else if (ret != 0)
|
||||
@ -668,7 +714,8 @@ pulse_capture_start(void)
|
||||
if (po == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_capture_start(), pa_stream_cork: %s\n", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_capture_start(), pa_stream_cork: %s\n",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -696,7 +743,8 @@ pulse_capture_stop(void)
|
||||
|
||||
if (capture_stream == NULL)
|
||||
{
|
||||
logger(Sound, Debug, "pulse_capture_stop(), trying to stop PulseAudio stream while it's not exists");
|
||||
logger(Sound, Debug,
|
||||
"pulse_capture_stop(), trying to stop PulseAudio stream while it's not exists");
|
||||
return True;
|
||||
}
|
||||
|
||||
@ -706,7 +754,8 @@ pulse_capture_stop(void)
|
||||
{
|
||||
if (pa_stream_get_state(capture_stream) != PA_STREAM_READY)
|
||||
{
|
||||
logger(Sound, Error, "pulse_capture_stop(), trying to stop PulseAudio stream while it's not exists");
|
||||
logger(Sound, Error,
|
||||
"pulse_capture_stop(), trying to stop PulseAudio stream while it's not exists");
|
||||
break;
|
||||
}
|
||||
#if PA_CHECK_VERSION(0,9,11)
|
||||
@ -717,7 +766,8 @@ pulse_capture_stop(void)
|
||||
if (ret < 0)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_capture_stop(), pa_stream_is_corked: %s\n", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_capture_stop(), pa_stream_is_corked: %s\n",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
else if (ret == 0)
|
||||
@ -726,7 +776,8 @@ pulse_capture_stop(void)
|
||||
if (po == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_capture_stop(), pa_stream_cork: %s\n", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_capture_stop(), pa_stream_cork: %s\n",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -774,7 +825,9 @@ pulse_capture_set_audio(int channels, int samplerate, int samplewidth)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
pa_threaded_mainloop_unlock(mainloop);
|
||||
logger(Sound, Error, "pulse_capture_set_audio(), pa_stream_is_corked: %s\n", pa_strerror(err));
|
||||
logger(Sound, Error,
|
||||
"pulse_capture_set_audio(), pa_stream_is_corked: %s\n",
|
||||
pa_strerror(err));
|
||||
return False;
|
||||
}
|
||||
}
|
||||
@ -815,12 +868,14 @@ pulse_stream_state_cb(pa_stream * p, void * userdata)
|
||||
{
|
||||
if (p == playback_stream)
|
||||
{
|
||||
logger(Sound, Debug, "pulse_stream_state_cb(), PulseAudio playback stream is in a fail state");
|
||||
logger(Sound, Debug,
|
||||
"pulse_stream_state_cb(), PulseAudio playback stream is in a fail state");
|
||||
pulse_send_msg(pulse_ctl[1], RDPSND_PULSE_OUT_ERR);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger(Sound, Debug, "pulse_stream_state_cb(), PulseAudio capture stream is in a fail state");
|
||||
logger(Sound, Debug,
|
||||
"pulse_stream_state_cb(), PulseAudio capture stream is in a fail state");
|
||||
pulse_send_msg(pulse_ctl[1], RDPSND_PULSE_IN_ERR);
|
||||
}
|
||||
}
|
||||
@ -853,13 +908,15 @@ pulse_cork_cb(pa_stream * p, int success, void * userdata)
|
||||
{
|
||||
if (p == playback_stream)
|
||||
{
|
||||
logger(Sound, Warning, "pulse_cork_cb(), fail to cork/uncork the PulseAudio playback stream: %s",
|
||||
logger(Sound, Warning,
|
||||
"pulse_cork_cb(), fail to cork/uncork the PulseAudio playback stream: %s",
|
||||
pa_strerror(pa_context_errno(context)));
|
||||
pulse_send_msg(pulse_ctl[1], RDPSND_PULSE_OUT_ERR);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger(Sound, Warning, "pulse_cork_cb(), fail to cork/uncork the PulseAudio capture stream: %s",
|
||||
logger(Sound, Warning,
|
||||
"pulse_cork_cb(), fail to cork/uncork the PulseAudio capture stream: %s",
|
||||
pa_strerror(pa_context_errno(context)));
|
||||
pulse_send_msg(pulse_ctl[1], RDPSND_PULSE_IN_ERR);
|
||||
}
|
||||
@ -890,7 +947,8 @@ pulse_update_timing_cb(pa_stream * p, int success, void * userdata)
|
||||
|
||||
if (!success)
|
||||
{
|
||||
logger(Sound, Warning, "pulse_update_timing_cb(), fail to update timing info of the PulseAudio stream: %s",
|
||||
logger(Sound, Warning,
|
||||
"pulse_update_timing_cb(), fail to update timing info of the PulseAudio stream: %s",
|
||||
pa_strerror(pa_context_errno(context)));
|
||||
pulse_send_msg(pulse_ctl[1], RDPSND_PULSE_OUT_ERR);
|
||||
}
|
||||
@ -933,13 +991,15 @@ pulse_check_fds(fd_set * rfds, fd_set * wfds)
|
||||
break;
|
||||
else
|
||||
{
|
||||
logger(Sound, Error, "pulse_check_fds(), read: %s\n", strerror(errno));
|
||||
logger(Sound, Error, "pulse_check_fds(), read: %s\n",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (n == 0)
|
||||
{
|
||||
logger(Sound, Warning, "pulse_check_fds(), audio control pipe was closed");
|
||||
logger(Sound, Warning,
|
||||
"pulse_check_fds(), audio control pipe was closed");
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -949,7 +1009,8 @@ pulse_check_fds(fd_set * rfds, fd_set * wfds)
|
||||
if (pulse_play() != True)
|
||||
if (pulse_recover(&playback_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_check_fds(), PulseAudio playback error");
|
||||
logger(Sound, Error,
|
||||
"pulse_check_fds(), PulseAudio playback error");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -957,26 +1018,31 @@ pulse_check_fds(fd_set * rfds, fd_set * wfds)
|
||||
if (pulse_record() != True)
|
||||
if (pulse_recover(&capture_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_check_fds(), PulseAudio capture error");
|
||||
logger(Sound, Error,
|
||||
"pulse_check_fds(), PulseAudio capture error");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case RDPSND_PULSE_OUT_ERR:
|
||||
if (pulse_recover(&playback_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_check_fds(), an error occured in audio thread with PulseAudio playback stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_check_fds(), an error occured in audio thread with PulseAudio playback stream");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case RDPSND_PULSE_IN_ERR:
|
||||
if (pulse_recover(&capture_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_check_fds(), an error occured in audio thread with PulseAudio capture stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_check_fds(), an error occured in audio thread with PulseAudio capture stream");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logger(Sound, Error, "pulse_check_fds(), wrong command from the audio thread: %d", audio_cmd);
|
||||
logger(Sound, Error,
|
||||
"pulse_check_fds(), wrong command from the audio thread: %d",
|
||||
audio_cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1008,7 +1074,8 @@ pulse_close_out(void)
|
||||
if (playback_stream && pulse_playback_stop() != True)
|
||||
if (pulse_recover(&playback_stream) != True)
|
||||
{
|
||||
logger(Sound, Error ,"pulse_close_out(), fail to close the PulseAudio playback stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_close_out(), fail to close the PulseAudio playback stream");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1038,10 +1105,12 @@ pulse_set_format_out(RD_WAVEFORMATEX * pwfx)
|
||||
playback_samplerate = pwfx->nSamplesPerSec;
|
||||
playback_samplewidth = pwfx->wBitsPerSample / 8;
|
||||
|
||||
if (pulse_playback_set_audio(pwfx->nChannels, pwfx->nSamplesPerSec, pwfx->wBitsPerSample / 8) != True)
|
||||
if (pulse_playback_set_audio
|
||||
(pwfx->nChannels, pwfx->nSamplesPerSec, pwfx->wBitsPerSample / 8) != True)
|
||||
if (pulse_recover(&playback_stream) != True)
|
||||
{
|
||||
logger(Sound, Error ,"pulse_set_format_out(), fail to open the PulseAudio playback stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_set_format_out(), fail to open the PulseAudio playback stream");
|
||||
return False;
|
||||
}
|
||||
}
|
||||
@ -1051,7 +1120,8 @@ pulse_set_format_out(RD_WAVEFORMATEX * pwfx)
|
||||
if (pulse_playback_start() != True)
|
||||
if (pulse_recover(&playback_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_set_format_out(), fail to start the PulseAudio playback stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_set_format_out(), fail to start the PulseAudio playback stream");
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -1090,17 +1160,21 @@ pulse_play(void)
|
||||
if (ti == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_get_timing_info: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_get_timing_info: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
|
||||
if (ti->read_index_corrupt || ti->write_index_corrupt)
|
||||
{
|
||||
po = pa_stream_update_timing_info(playback_stream, pulse_update_timing_cb, mainloop);
|
||||
po = pa_stream_update_timing_info(playback_stream, pulse_update_timing_cb,
|
||||
mainloop);
|
||||
if (po == NULL)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_update_timing_info: %s", pa_strerror(err));
|
||||
logger(Sound, Error,
|
||||
"pulse_play(), pa_stream_update_timing_info: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -1121,10 +1195,12 @@ pulse_play(void)
|
||||
audio_size = out->end - out->p <= avail_space ? out->end - out->p : avail_space;
|
||||
if (audio_size)
|
||||
{
|
||||
if (pa_stream_write(playback_stream, out->p, audio_size, NULL, 0, playback_seek) != 0)
|
||||
if (pa_stream_write
|
||||
(playback_stream, out->p, audio_size, NULL, 0, playback_seek) != 0)
|
||||
{
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_write: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_write: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
else if (playback_seek == PA_SEEK_RELATIVE_ON_READ)
|
||||
@ -1138,12 +1214,15 @@ pulse_play(void)
|
||||
ret = pa_stream_get_latency(playback_stream, &delay, NULL);
|
||||
if (ret != 0 && (err = pa_context_errno(context)) == PA_ERR_NODATA)
|
||||
{
|
||||
po = pa_stream_update_timing_info(playback_stream, pulse_update_timing_cb, mainloop);
|
||||
po = pa_stream_update_timing_info(playback_stream,
|
||||
pulse_update_timing_cb, mainloop);
|
||||
if (po == NULL)
|
||||
{
|
||||
delay = 0;
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_update_timing_info: %s", pa_strerror(err));
|
||||
logger(Sound, Error,
|
||||
"pulse_play(), pa_stream_update_timing_info: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
while (pa_operation_get_state(po) == PA_OPERATION_RUNNING)
|
||||
@ -1156,11 +1235,14 @@ pulse_play(void)
|
||||
{
|
||||
delay = 0;
|
||||
err = pa_context_errno(context);
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_get_latency: %s", pa_strerror(err));
|
||||
logger(Sound, Error, "pulse_play(), pa_stream_get_latency: %s",
|
||||
pa_strerror(err));
|
||||
break;
|
||||
}
|
||||
|
||||
logger(Sound, Debug, "pulse_play(), PulseAudio playback stream latency %lu usec", (long) delay);
|
||||
logger(Sound, Debug,
|
||||
"pulse_play(), PulseAudio playback stream latency %lu usec",
|
||||
(long) delay);
|
||||
}
|
||||
|
||||
result = True;
|
||||
@ -1193,7 +1275,8 @@ pulse_close_in(void)
|
||||
if (capture_stream && pulse_capture_stop() != True)
|
||||
if (pulse_recover(&capture_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_close_in(), fail to close the PulseAudio capture stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_close_in(), fail to close the PulseAudio capture stream");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1210,10 +1293,12 @@ pulse_set_format_in(RD_WAVEFORMATEX * pwfx)
|
||||
capture_samplerate = pwfx->nSamplesPerSec;
|
||||
capture_samplewidth = pwfx->wBitsPerSample / 8;
|
||||
|
||||
if (pulse_capture_set_audio(pwfx->nChannels, pwfx->nSamplesPerSec, pwfx->wBitsPerSample / 8) != True)
|
||||
if (pulse_capture_set_audio
|
||||
(pwfx->nChannels, pwfx->nSamplesPerSec, pwfx->wBitsPerSample / 8) != True)
|
||||
if (pulse_recover(&capture_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_set_format_in(), fail to open the PulseAudio capture stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_set_format_in(), fail to open the PulseAudio capture stream");
|
||||
return False;
|
||||
}
|
||||
}
|
||||
@ -1223,7 +1308,8 @@ pulse_set_format_in(RD_WAVEFORMATEX * pwfx)
|
||||
if (pulse_capture_start() != True)
|
||||
if (pulse_recover(&capture_stream) != True)
|
||||
{
|
||||
logger(Sound, Error, "pulse_set_format_in(), fail to start the PulseAudio capture stream");
|
||||
logger(Sound, Error,
|
||||
"pulse_set_format_in(), fail to start the PulseAudio capture stream");
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -1247,7 +1333,8 @@ pulse_record(void)
|
||||
{
|
||||
if (pa_stream_peek(capture_stream, &pulse_buf, &audio_size) != 0)
|
||||
{
|
||||
logger(Sound, Error, "pulse_record(), pa_stream_peek: %s", pa_strerror(pa_context_errno(context)));
|
||||
logger(Sound, Error, "pulse_record(), pa_stream_peek: %s",
|
||||
pa_strerror(pa_context_errno(context)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1270,7 +1357,8 @@ pulse_record(void)
|
||||
|
||||
if (pa_stream_drop(capture_stream) != 0)
|
||||
{
|
||||
logger(Sound, Error, "pulse_record(), pa_stream_drop: %s", pa_strerror(pa_context_errno(context)));
|
||||
logger(Sound, Error, "pulse_record(), pa_stream_drop: %s",
|
||||
pa_strerror(pa_context_errno(context)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1301,13 +1389,15 @@ pulse_recover(pa_stream ** stream)
|
||||
|
||||
if (stream == &playback_stream)
|
||||
{
|
||||
if (pulse_playback_set_audio(playback_channels, playback_samplerate, playback_samplewidth) == True)
|
||||
if (pulse_playback_set_audio
|
||||
(playback_channels, playback_samplerate, playback_samplewidth) == True)
|
||||
if (playback_started != True || pulse_playback_start() == True)
|
||||
return True;
|
||||
}
|
||||
else if (stream == &capture_stream)
|
||||
{
|
||||
if (pulse_capture_set_audio(capture_channels, capture_samplerate, capture_samplewidth) == True)
|
||||
if (pulse_capture_set_audio
|
||||
(capture_channels, capture_samplerate, capture_samplewidth) == True)
|
||||
if (capture_started != True || pulse_capture_start() == True)
|
||||
return True;
|
||||
}
|
||||
@ -1321,13 +1411,15 @@ pulse_recover(pa_stream ** stream)
|
||||
{
|
||||
if (playback == True)
|
||||
{
|
||||
if (pulse_playback_set_audio(playback_channels, playback_samplerate, playback_samplewidth) != True
|
||||
if (pulse_playback_set_audio
|
||||
(playback_channels, playback_samplerate, playback_samplewidth) != True
|
||||
|| (playback_started == True && pulse_playback_start() != True))
|
||||
break;
|
||||
}
|
||||
if (capture == True)
|
||||
{
|
||||
if (pulse_capture_set_audio(capture_channels, capture_samplerate, capture_samplewidth) != True
|
||||
if (pulse_capture_set_audio
|
||||
(capture_channels, capture_samplerate, capture_samplewidth) != True
|
||||
|| (capture_started == True && pulse_capture_start() != True))
|
||||
break;
|
||||
}
|
||||
|
19
scard.c
19
scard.c
@ -1729,9 +1729,11 @@ TS_SCardStatus(STREAM in, STREAM out, RD_BOOL wide)
|
||||
"TS_SCardStatus(), hcard: 0x%08x [0x%08lx], reader len: %d bytes, atr len: %d bytes",
|
||||
(unsigned) hCard, (unsigned long) myHCard, (int) dwReaderLen, (int) dwAtrLen);
|
||||
|
||||
if (dwReaderLen == 0 || dwReaderLen == (SERVER_DWORD)SCARD_AUTOALLOCATE || dwReaderLen > SCARD_MAX_MEM)
|
||||
if (dwReaderLen == 0 || dwReaderLen == (SERVER_DWORD) SCARD_AUTOALLOCATE
|
||||
|| dwReaderLen > SCARD_MAX_MEM)
|
||||
dwReaderLen = SCARD_MAX_MEM;
|
||||
if (dwAtrLen == 0 || dwAtrLen == (SERVER_DWORD)SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM)
|
||||
if (dwAtrLen == 0 || dwAtrLen == (SERVER_DWORD) SCARD_AUTOALLOCATE
|
||||
|| dwAtrLen > SCARD_MAX_MEM)
|
||||
dwAtrLen = SCARD_MAX_MEM;
|
||||
|
||||
#if 1
|
||||
@ -1846,7 +1848,8 @@ TS_SCardState(STREAM in, STREAM out)
|
||||
(unsigned) hCard, (unsigned long) myHCard, (int) dwAtrLen);
|
||||
|
||||
dwReaderLen = SCARD_MAX_MEM;
|
||||
if (dwAtrLen <= 0 || dwAtrLen == (SERVER_DWORD)SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM)
|
||||
if (dwAtrLen <= 0 || dwAtrLen == (SERVER_DWORD) SCARD_AUTOALLOCATE
|
||||
|| dwAtrLen > SCARD_MAX_MEM)
|
||||
dwAtrLen = SCARD_MAX_MEM;
|
||||
|
||||
readerName = SC_xmalloc(&lcHandle, dwReaderLen + 2);
|
||||
@ -2187,9 +2190,11 @@ TS_SCardControl(STREAM in, STREAM out)
|
||||
|
||||
/* ATM, I removed features code transformations */
|
||||
/* You know what to do if any problem arises in the future. */
|
||||
if ((dwControlCode & 0xff000000) != SCARD_CTL_CODE(0)) {
|
||||
if ((dwControlCode & 0xff000000) != SCARD_CTL_CODE(0))
|
||||
{
|
||||
logger(SmartCard, Warning,
|
||||
"TS_SCardControl(), bogus smart card control code 0x%08x", dwControlCode);
|
||||
"TS_SCardControl(), bogus smart card control code 0x%08x",
|
||||
dwControlCode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2729,7 +2734,8 @@ scard_reset_state()
|
||||
queueFirst = queueLast = NULL;
|
||||
}
|
||||
|
||||
void scard_release_all_contexts(void)
|
||||
void
|
||||
scard_release_all_contexts(void)
|
||||
{
|
||||
_scard_handle_list_t *item, *next;
|
||||
|
||||
@ -2749,4 +2755,3 @@ void scard_release_all_contexts(void)
|
||||
|
||||
g_scard_handle_list = NULL;
|
||||
}
|
||||
|
||||
|
6
secure.c
6
secure.c
@ -461,9 +461,9 @@ sec_out_mcs_connect_initial_pdu(STREAM s, uint32 selected_protocol)
|
||||
if (g_dpi > 0)
|
||||
{
|
||||
/* Extended client info describing monitor geometry */
|
||||
utils_calculate_dpi_scale_factors(g_requested_session_width, g_requested_session_height, g_dpi,
|
||||
&physwidth, &physheight,
|
||||
&desktopscale, &devicescale);
|
||||
utils_calculate_dpi_scale_factors(g_requested_session_width,
|
||||
g_requested_session_height, g_dpi, &physwidth,
|
||||
&physheight, &desktopscale, &devicescale);
|
||||
out_uint32_le(s, physwidth); /* physicalwidth */
|
||||
out_uint32_le(s, physheight); /* physicalheight */
|
||||
out_uint16_le(s, ORIENTATION_LANDSCAPE); /* Orientation */
|
||||
|
15
tcp.c
15
tcp.c
@ -446,8 +446,7 @@ static RD_BOOL
|
||||
tcp_connect_resolve_hostname(const char *server)
|
||||
{
|
||||
return (g_server_address == NULL ||
|
||||
g_last_server_name == NULL ||
|
||||
strcmp(g_last_server_name, server) != 0);
|
||||
g_last_server_name == NULL || strcmp(g_last_server_name, server) != 0);
|
||||
}
|
||||
|
||||
/* Establish a connection on the TCP layer
|
||||
@ -485,7 +484,8 @@ tcp_connect(char *server)
|
||||
|
||||
if ((n = getaddrinfo(server, tcp_port_rdp_s, &hints, &res)))
|
||||
{
|
||||
logger(Core, Error, "tcp_connect(), getaddrinfo() failed: %s", gai_strerror(n));
|
||||
logger(Core, Error, "tcp_connect(), getaddrinfo() failed: %s",
|
||||
gai_strerror(n));
|
||||
return False;
|
||||
}
|
||||
}
|
||||
@ -505,10 +505,12 @@ tcp_connect(char *server)
|
||||
continue;
|
||||
}
|
||||
|
||||
n = getnameinfo(addr->ai_addr, addr->ai_addrlen, buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
|
||||
n = getnameinfo(addr->ai_addr, addr->ai_addrlen, buf, sizeof(buf), NULL, 0,
|
||||
NI_NUMERICHOST);
|
||||
if (n != 0)
|
||||
{
|
||||
logger(Core, Error, "tcp_connect(), getnameinfo() failed: %s", gai_strerror(n));
|
||||
logger(Core, Error, "tcp_connect(), getnameinfo() failed: %s",
|
||||
gai_strerror(n));
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -581,8 +583,7 @@ tcp_connect(char *server)
|
||||
|
||||
logger(Core, Debug, "tcp_connect(), trying %s (%s)",
|
||||
server, inet_ntop(g_server_address->sin_family,
|
||||
&g_server_address->sin_addr,
|
||||
buf, sizeof(buf)));
|
||||
&g_server_address->sin_addr, buf, sizeof(buf)));
|
||||
|
||||
if (connect(g_sock, (struct sockaddr *) g_server_address, sizeof(struct sockaddr)) < 0)
|
||||
{
|
||||
|
3
types.h
3
types.h
@ -308,7 +308,8 @@ FILEINFO;
|
||||
|
||||
typedef RD_BOOL(*str_handle_lines_t) (const char *line, void *data);
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
Fixed,
|
||||
PercentageOfScreen,
|
||||
Workarea,
|
||||
|
77
xwin.c
77
xwin.c
@ -1573,7 +1573,9 @@ xwin_refresh_pointer_map(void)
|
||||
int i;
|
||||
unsigned int pointer_buttons;
|
||||
|
||||
pointer_buttons = (unsigned int)XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map));
|
||||
pointer_buttons =
|
||||
(unsigned int) XGetPointerMapping(g_display, phys_to_log_map,
|
||||
sizeof(phys_to_log_map));
|
||||
if (pointer_buttons > sizeof(phys_to_log_map))
|
||||
pointer_buttons = sizeof(phys_to_log_map);
|
||||
|
||||
@ -2248,7 +2250,8 @@ ui_resize_window(uint32 width, uint32 height)
|
||||
return;
|
||||
}
|
||||
|
||||
logger(GUI, Debug, "ui_resize_window(), Changing window %dx%d to match new session %dx%d size",
|
||||
logger(GUI, Debug,
|
||||
"ui_resize_window(), Changing window %dx%d to match new session %dx%d size",
|
||||
attr.width, attr.height, width, height);
|
||||
|
||||
sizehints = XAllocSizeHints();
|
||||
@ -2566,7 +2569,8 @@ xwin_process_events(void)
|
||||
/* send seamless destroy process message */
|
||||
seamless_send_destroy(sw->id);
|
||||
}
|
||||
else if (xevent.xclient.data.l[0] == (long)g_net_wm_ping_atom)
|
||||
else if (xevent.xclient.data.l[0] ==
|
||||
(long) g_net_wm_ping_atom)
|
||||
{
|
||||
/* pass ping message further to root window */
|
||||
xevent.xclient.window =
|
||||
@ -2822,7 +2826,8 @@ xwin_process_events(void)
|
||||
g_window_width = attr.width;
|
||||
g_window_height = attr.height;
|
||||
|
||||
logger(GUI, Debug, "xwin_process_events(), Window mapped with size %dx%d",
|
||||
logger(GUI, Debug,
|
||||
"xwin_process_events(), Window mapped with size %dx%d",
|
||||
g_window_width, g_window_height);
|
||||
|
||||
is_g_wnd_mapped = True;
|
||||
@ -2851,11 +2856,12 @@ xwin_process_events(void)
|
||||
{
|
||||
/* only for fullscreen or x%-of-screen-sized windows */
|
||||
if (g_window_size_type == PercentageOfScreen
|
||||
|| g_window_size_type == Fullscreen
|
||||
|| g_fullscreen)
|
||||
|| g_window_size_type == Fullscreen || g_fullscreen)
|
||||
{
|
||||
if (xevent.xconfigure.width != WidthOfScreen(g_screen)
|
||||
|| xevent.xconfigure.height != HeightOfScreen(g_screen))
|
||||
if (xevent.xconfigure.width !=
|
||||
WidthOfScreen(g_screen)
|
||||
|| xevent.xconfigure.height !=
|
||||
HeightOfScreen(g_screen))
|
||||
{
|
||||
|
||||
logger(GUI, Debug,
|
||||
@ -2868,7 +2874,10 @@ xwin_process_events(void)
|
||||
/* Resize fullscreen window to match root window size */
|
||||
/* TODO: Handle percentage of screen */
|
||||
if (g_fullscreen)
|
||||
ui_resize_window(xevent.xconfigure.width, xevent.xconfigure.height);
|
||||
ui_resize_window(xevent.xconfigure.
|
||||
width,
|
||||
xevent.xconfigure.
|
||||
height);
|
||||
g_pending_resize = True;
|
||||
}
|
||||
}
|
||||
@ -2876,9 +2885,11 @@ xwin_process_events(void)
|
||||
XRRUpdateConfiguration(&xevent);
|
||||
XSync(g_display, False);
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (xevent.xconfigure.window == g_wnd && !g_seamless_rdp && is_g_wnd_mapped)
|
||||
if (xevent.xconfigure.window == g_wnd && !g_seamless_rdp
|
||||
&& is_g_wnd_mapped)
|
||||
{
|
||||
|
||||
/* Update window size */
|
||||
@ -2891,21 +2902,17 @@ xwin_process_events(void)
|
||||
|
||||
utils_apply_session_size_limitations(&w, &h);
|
||||
|
||||
logger(GUI, Debug, "xwin_process_events(), ConfigureNotify: session: %dx%d, new window: %dx%d (adj: %dx%d)",
|
||||
g_session_width,
|
||||
g_session_height,
|
||||
g_window_width,
|
||||
g_window_height,
|
||||
w, h);
|
||||
logger(GUI, Debug,
|
||||
"xwin_process_events(), ConfigureNotify: session: %dx%d, new window: %dx%d (adj: %dx%d)",
|
||||
g_session_width, g_session_height, g_window_width,
|
||||
g_window_height, w, h);
|
||||
|
||||
if (g_session_width != w
|
||||
|| g_session_height != h)
|
||||
if (g_session_width != w || g_session_height != h)
|
||||
{
|
||||
logger(GUI, Debug, "xwin_process_events(), ConfigureNotify: session: %dx%d, new window: %dx%d",
|
||||
g_session_width,
|
||||
g_session_height,
|
||||
g_window_width,
|
||||
g_window_height);
|
||||
logger(GUI, Debug,
|
||||
"xwin_process_events(), ConfigureNotify: session: %dx%d, new window: %dx%d",
|
||||
g_session_width, g_session_height,
|
||||
g_window_width, g_window_height);
|
||||
|
||||
/* perform a resize */
|
||||
gettimeofday(&g_resize_timer, NULL);
|
||||
@ -2994,8 +3001,7 @@ process_fds(int rdp_socket, int ms)
|
||||
{
|
||||
if (ret == -1)
|
||||
{
|
||||
logger(GUI, Error, "process_fds(), select failed: %s",
|
||||
strerror(errno));
|
||||
logger(GUI, Error, "process_fds(), select failed: %s", strerror(errno));
|
||||
}
|
||||
#ifdef WITH_RDPSND
|
||||
rdpsnd_check_fds(&rfds, &wfds);
|
||||
@ -3104,8 +3110,7 @@ process_pending_resize ()
|
||||
*/
|
||||
|
||||
logger(GUI, Verbose, "Window resize detected, reconnecting to new size %dx%d",
|
||||
g_requested_session_width,
|
||||
g_requested_session_height);
|
||||
g_requested_session_width, g_requested_session_height);
|
||||
|
||||
return True;
|
||||
}
|
||||
@ -3115,12 +3120,11 @@ process_pending_resize ()
|
||||
if (now_ts - g_wait_for_deactivate_ts <= 5)
|
||||
return False;
|
||||
|
||||
logger(GUI, Verbose, "Window resize detected, requesting matching session size %dx%d",
|
||||
g_requested_session_width,
|
||||
g_requested_session_height);
|
||||
logger(GUI, Verbose,
|
||||
"Window resize detected, requesting matching session size %dx%d",
|
||||
g_requested_session_width, g_requested_session_height);
|
||||
|
||||
rdpedisp_set_session_size(g_requested_session_width,
|
||||
g_requested_session_height);
|
||||
rdpedisp_set_session_size(g_requested_session_width, g_requested_session_height);
|
||||
|
||||
g_pending_resize = False;
|
||||
g_wait_for_deactivate_ts = now_ts;
|
||||
@ -3498,7 +3502,8 @@ void
|
||||
ui_set_cursor(RD_HCURSOR cursor)
|
||||
{
|
||||
extern RD_BOOL g_local_cursor;
|
||||
if (g_local_cursor) return ;
|
||||
if (g_local_cursor)
|
||||
return;
|
||||
logger(GUI, Debug, "ui_set_cursor(): g_current_cursor = %p, new = %p",
|
||||
g_current_cursor, cursor);
|
||||
|
||||
@ -4519,8 +4524,8 @@ ui_seamless_create_window(unsigned long id, unsigned long group, unsigned long p
|
||||
if (sw_parent)
|
||||
XSetTransientForHint(g_display, wnd, sw_parent->wnd);
|
||||
else
|
||||
logger(GUI, Warning, "ui_seamless_create_window(): no parent window 0x%lx\n",
|
||||
parent);
|
||||
logger(GUI, Warning,
|
||||
"ui_seamless_create_window(): no parent window 0x%lx\n", parent);
|
||||
}
|
||||
|
||||
if (flags & SEAMLESSRDP_CREATE_MODAL)
|
||||
|
Loading…
Reference in New Issue
Block a user