diff --git a/rdpsnd.c b/rdpsnd.c index d899043..73ecde5 100644 --- a/rdpsnd.c +++ b/rdpsnd.c @@ -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: diff --git a/rdpsnd_dsp.c b/rdpsnd_dsp.c index e293931..88f8f4c 100644 --- a/rdpsnd_dsp.c +++ b/rdpsnd_dsp.c @@ -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;