From a7d618cbe67d2c084c80e31a5df21f4fb7221a76 Mon Sep 17 00:00:00 2001 From: iovar Date: Fri, 2 Feb 2007 02:22:22 +0000 Subject: Fixed bug on >1 channels audio recording with OSS git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@271 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/capture_sound.c | 2 +- recordmydesktop/src/encode_sound_buffer.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index d9ffa91..4314984 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -124,7 +124,7 @@ void *CaptureSound(ProgData *pdata){ do{ int temp_sret=read(pdata->sound_handle, &newbuf->data[sret], - pdata->args.buffsize); + pdata->args.buffsize-sret); if(temp_sret<0){ fprintf(stderr,"An error occured while reading from soundcard" "%s\n" diff --git a/recordmydesktop/src/encode_sound_buffer.c b/recordmydesktop/src/encode_sound_buffer.c index f20d98e..0e8fa2c 100644 --- a/recordmydesktop/src/encode_sound_buffer.c +++ b/recordmydesktop/src/encode_sound_buffer.c @@ -31,7 +31,7 @@ void *EncodeSoundBuffer(ProgData *pdata){ #ifdef HAVE_LIBASOUND int sampread=pdata->periodsize; #else - int sampread=pdata->args.buffsize>>1; + int sampread=(pdata->args.buffsize>>1)/pdata->args.channels; #endif pdata->v_encoding_clean=0; while((pdata->running)){ @@ -106,7 +106,8 @@ void SyncEncodeSoundBuffer(ProgData *pdata,signed char *buff){ #ifdef HAVE_LIBASOUND int sampread=(buff!=NULL)?pdata->periodsize:0; #else - int sampread=(buff!=NULL)?(pdata->args.buffsize>>1):0; + int sampread=(buff!=NULL)?((pdata->args.buffsize>>1)/ + pdata->args.channels):0; #endif vorbis_buffer=vorbis_analysis_buffer(&pdata->enc_data->m_vo_dsp,sampread); for(i=0;i