CVS: rdesktop rdpsnd.c, 1.16, 1.17 rdpsnd_dsp.c, 1.5, 1.6

Michael Gernoth <[email protected]> Sun, 17 Sep 2006 13:06:40 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16185

Modified Files:
	rdpsnd.c rdpsnd_dsp.c 
Log Message:
Recover missing 4 bytes in audio-stream thanks to a hint in an old
email from Robert Sanders <[email protected]>:

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.


Index: rdpsnd.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rdpsnd.c	17 Sep 2006 19:08:14 -0000	1.16
--- rdpsnd.c	17 Sep 2006 20:06:37 -0000	1.17
***************
*** 195,198 ****
--- 195,199 ----
  	static uint8 packet_index;
  	static BOOL awaiting_data_packet;
+ 	static unsigned char missing_bytes[4] = { 0, 0, 0, 0 };
  
  #ifdef RDPSND_DEBUG
***************
*** 227,230 ****
--- 228,234 ----
  		}
  
+ 		/* Insert the 4 missing bytes retrieved from last RDPSND_WRITE */
+ 		memcpy(s->data, missing_bytes, 4);
+ 
  		current_driver->
  			wave_out_write(rdpsnd_dsp_process
***************
*** 245,248 ****
--- 249,254 ----
  			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;

Index: rdpsnd_dsp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_dsp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rdpsnd_dsp.c	17 Sep 2006 18:08:51 -0000	1.5
--- rdpsnd_dsp.c	17 Sep 2006 20:06:37 -0000	1.6
***************
*** 130,139 ****
  #endif
  
! 	/* FIXME: where do we lose the 4 bytes referenced here? */
! 	out.data = xmalloc(s->size - 4);
  
! 	memcpy(out.data, s->data + 4, s->size - 4);
  
! 	out.size = s->size - 4;
  	out.p = out.data;
  	out.end = out.p + out.size;
--- 130,138 ----
  #endif
  
! 	out.data = xmalloc(s->size);
  
! 	memcpy(out.data, s->data, s->size);
  
! 	out.size = s->size;
  	out.p = out.data;
  	out.end = out.p + out.size;


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642