Recover missing 4 bytes in audio-stream thanks to a hint in an old

email from Robert Sanders <esquimaux73@mailblocks.com>:

I found a trick that seems to solve this.  Basically, I copy the last
4 bytes of the RDPSND_WRITE command that precedes the sample data.
It's not being used by anything else.  I can't tell whether this is
some trick to "pre-load" the sample buffer, or some error in
rdesktop's interpretation of the RDP sound protocol.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1264 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michael Gernoth 2006-09-17 20:06:37 +00:00
parent f80ca3e60e
commit c4b90c2072
2 changed files with 9 additions and 4 deletions

View File

@ -194,6 +194,7 @@ rdpsnd_process(STREAM s)
static uint16 tick, format;
static uint8 packet_index;
static BOOL awaiting_data_packet;
static unsigned char missing_bytes[4] = { 0, 0, 0, 0 };
#ifdef RDPSND_DEBUG
printf("RDPSND recv:\n");
@ -226,6 +227,9 @@ rdpsnd_process(STREAM s)
current_format = format;
}
/* Insert the 4 missing bytes retrieved from last RDPSND_WRITE */
memcpy(s->data, missing_bytes, 4);
current_driver->
wave_out_write(rdpsnd_dsp_process
(s, current_driver, &formats[current_format]), tick,
@ -244,6 +248,8 @@ rdpsnd_process(STREAM s)
in_uint16_le(s, tick);
in_uint16_le(s, format);
in_uint8(s, packet_index);
/* Here are our lost bytes, but why? */
memcpy(missing_bytes, s->end - 4, 4);
awaiting_data_packet = True;
break;
case RDPSND_CLOSE:

View File

@ -129,12 +129,11 @@ rdpsnd_dsp_process(STREAM s, struct audio_driver *current_driver, WAVEFORMATEX *
rdpsnd_dsp_swapbytes(s->data, s->size, format);
#endif
/* FIXME: where do we lose the 4 bytes referenced here? */
out.data = xmalloc(s->size - 4);
out.data = xmalloc(s->size);
memcpy(out.data, s->data + 4, s->size - 4);
memcpy(out.data, s->data, s->size);
out.size = s->size - 4;
out.size = s->size;
out.p = out.data;
out.end = out.p + out.size;