CVS: rdesktop rdpsnd_oss.c,1.27,1.28

Michael Gernoth <[email protected]> Sun, 01 Oct 2006 11:47:06 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv26605

Modified Files:
	rdpsnd_oss.c 
Log Message:
use resampling in OSS driver when native samplerate is not available


Index: rdpsnd_oss.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_oss.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** rdpsnd_oss.c	1 Oct 2006 14:03:43 -0000	1.27
--- rdpsnd_oss.c	1 Oct 2006 18:47:04 -0000	1.28
***************
*** 117,126 ****
  	}
  
  	snd_rate = pwfx->nSamplesPerSec;
  	if (ioctl(g_dsp_fd, SNDCTL_DSP_SPEED, &snd_rate) == -1)
  	{
! 		perror("SNDCTL_DSP_SPEED");
! 		close(g_dsp_fd);
! 		return False;
  	}
  
--- 117,153 ----
  	}
  
+ 	oss_driver.need_resampling = 0;
  	snd_rate = pwfx->nSamplesPerSec;
  	if (ioctl(g_dsp_fd, SNDCTL_DSP_SPEED, &snd_rate) == -1)
  	{
! 		int rates[] = { 44100, 48000, 0 };
! 		int *prates = rates;
! 
! 		while (*prates != 0)
! 		{
! 			if ((pwfx->nSamplesPerSec != *prates)
! 			    && (ioctl(g_dsp_fd, SNDCTL_DSP_SPEED, prates) != -1))
! 			{
! 				oss_driver.need_resampling = 1;
! 				snd_rate = *prates;
! 				if (rdpsnd_dsp_resample_set
! 				    (snd_rate, pwfx->wBitsPerSample, pwfx->nChannels) == False)
! 				{
! 					error("rdpsnd_dsp_resample_set failed");
! 					close(g_dsp_fd);
! 					return False;
! 				}
! 
! 				break;
! 			}
! 			prates++;
! 		}
! 
! 		if (*prates == 0)
! 		{
! 			perror("SNDCTL_DSP_SPEED");
! 			close(g_dsp_fd);
! 			return False;
! 		}
  	}
  


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV