CVS: rdesktop rdpsnd_dsp.c,1.8,1.9
Michael Gernoth <[email protected]> Sun, 01 Oct 2006 05:26: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-serv6813
Modified Files:
rdpsnd_dsp.c
Log Message:
only resample when there is need
Index: rdpsnd_dsp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpsnd_dsp.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rdpsnd_dsp.c 1 Oct 2006 12:16:50 -0000 1.8
--- rdpsnd_dsp.c 1 Oct 2006 12:26:01 -0000 1.9
***************
*** 160,166 ****
int i;
if ((resample_to_bitspersample != format->wBitsPerSample) ||
! (resample_to_channels != format->nChannels) ||
! ((format->nSamplesPerSec != 44100) && (format->nSamplesPerSec != 22050)))
{
if (!warned)
--- 160,170 ----
int i;
+ if ((resample_to_bitspersample == format->wBitsPerSample) &&
+ (resample_to_channels == format->nChannels) &&
+ (resample_to_srate == format->nSamplesPerSec))
+ return 0;
+
if ((resample_to_bitspersample != format->wBitsPerSample) ||
! (resample_to_channels != format->nChannels) || (format->nSamplesPerSec != 22050))
{
if (!warned)
***************
*** 173,203 ****
}
! if (format->nSamplesPerSec == 22050)
! {
! outsize = size * 2;
! *out = xmalloc(outsize);
! /* Resample to 44100 */
! for (i = 0; i < (size / samplewidth); i++)
! {
! /* On a stereo-channel we must make sure that left and right
! does not get mixed up, so we need to expand the sample-
! data with channels in mind: 1234 -> 12123434
! If we have a mono-channel, we can expand the data by simply
! doubling the sample-data: 1234 -> 11223344 */
! if (resample_to_channels == 2)
! offset = ((i * 2) - (i & 1)) * samplewidth;
! else
! offset = (i * 2) * samplewidth;
! memcpy(*out + offset, in + (i * samplewidth), samplewidth);
! memcpy(*out + (resample_to_channels * samplewidth + offset),
! in + (i * samplewidth), samplewidth);
- }
- }
- else
- {
- outsize = 0;
}
--- 177,200 ----
}
! outsize = size * 2;
! *out = xmalloc(outsize);
! /* Resample from 22050 to 44100 */
! for (i = 0; i < (size / samplewidth); i++)
! {
! /* On a stereo-channel we must make sure that left and right
! does not get mixed up, so we need to expand the sample-
! data with channels in mind: 1234 -> 12123434
! If we have a mono-channel, we can expand the data by simply
! doubling the sample-data: 1234 -> 11223344 */
! if (resample_to_channels == 2)
! offset = ((i * 2) - (i & 1)) * samplewidth;
! else
! offset = (i * 2) * samplewidth;
! memcpy(*out + offset, in + (i * samplewidth), samplewidth);
! memcpy(*out + (resample_to_channels * samplewidth + offset),
! in + (i * samplewidth), samplewidth);
}
***************
*** 223,229 ****
if (current_driver->wave_out_format_supported == rdpsnd_dsp_resample_supported)
- {
out.size = rdpsnd_dsp_resample(&out.data, s->data, s->size, format);
- }
if (out.data == NULL)
--- 220,224 ----
-------------------------------------------------------------------------
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